annotate lib/alib/bin_rom.a @ 2765:0bd16cca86b7

Updated rules.mak for all the os9 format's to format the entire disk. People were having some issues with the disk images not being formatted to their full capacity and preventing some functions from working.
author drencor-xeen
date Thu, 17 Jan 2013 11:03:26 -0600
parents 7d70b7e1cb21
children aaba193af04f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2474
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
1 ***************************************
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
2
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
3 * Subroutine to convert binary number to roman numerals
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
4
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
5 * OTHER MODULES NEEDED: none
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
6
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
7 * ENTRY: D=number to convert
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
8 * X=start of buffer (20 bytes)
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
9
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
10
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
11 * EXIT: all registers preserved
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
12
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
13 * Note: the buffer should be set to 20 bytes. This permits the
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
14 * longest possible number to be converted without a buffer overflow.
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
15 * This routine trunates any numbers >8191 to ensure that no number
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
16 * is longer than 19 characters (plus null terminator).
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
17 * The number 7888 converts to a 19 character string. To permit larger
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
18 * number conversions one could delete the anda #%00011111 statement.
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
19
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
20 * This routine has been converted from the BASIC09 sample in
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
21 * the Basic09 Reference Manual (Microware) page a-3.
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
22
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
23 nam Binary to Roman numberal conversion
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
24 ttl Assembler Library Module
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
25
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
26
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
27 psect BINROM,0,0,0,0,0
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
28
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
29
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
30 BIN_ROM:
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
31 pshs d,x,y,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
32
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
33 leau nums,pcr number conversion table
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
34 clr ,-s counter on stack
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
35 lda 1,s restore value
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
36 anda #%00011111 ensure no value>8191 permitted
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
37
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
38 roman1
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
39 cmpd ,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
40 blo roman2
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
41 leay chars,pcr
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
42 bsr addchar
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
43 subd ,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
44 bra roman1
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
45
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
46 roman2
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
47 pshs d
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
48 ldd ,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
49 subd 2,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
50 cmpd ,s
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
51 puls d
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
52 bhi roman3
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
53
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
54 leay subs,pcr
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
55 bsr addchar
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
56 leay chars,pcr
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
57 bsr addchar
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
58 subd ,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
59 addd 2,u
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
60
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
61 roman3
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
62 leau 4,u next pair of values
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
63 pshs d
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
64 inc 2,s counter
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
65 lda 2,s
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
66 cmpa #7 done?
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
67 puls d
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
68 bne roman1 no, do more
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
69
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
70 puls a
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
71 clr ,x null terminator
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
72
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
73 puls d,x,y,u,pc
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
74
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
75 addchar
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
76 pshs d
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
77 lda 4,s get loop count
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
78 lda a,y get char
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
79 sta ,x+
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
80 puls d,pc
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
81
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
82 nums fdb 1000,100
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
83 fdb 500,100
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
84 fdb 100,10
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
85 fdb 50,10
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
86 fdb 10,1
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
87 fdb 5,1
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
88 fdb 1,0
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
89
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
90 chars fcc /MDCLXVI/
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
91 subs fcc /CCXXII/
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
92
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
93 endsect
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
94