annotate lib/alib/hex_bin.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 * Hexadecimal string to BINARY conversion
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 REQUIRED: TO_UPPER, IS_TERMIN, IS_XDIGIT
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: X=start of a hex string terminated by a space,
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
8 * comma, CR, or NULL.
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 * EXIT: D=binary number
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
11 * CC carry set iferror (too large, non-numeric)
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
12 * Y=terminator position or error char.
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
13
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
14
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
15 nam Convert Hex String to Binary
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
16 ttl Assembler Library Module
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
17
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
18 psect HEX_BIN,0,0,0,0,0
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
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
21 HEX_BIN:
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
22 clra init number
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
23 clrb
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
24 pshs d,x
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
25 tfr d,y digit counter
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 loop
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
28 ldb ,x+ get next digit
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
29 lbsr TO_UPPER convert to uppercase
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
30 lbsr IS_TERMIN end of string?
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
31 beq exit yes, go home
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
32 lbsr IS_XDIGIT make sure it's valid digit
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
33 bne error not 0..9, a..f
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
34 cmpb #'9 convert to binary value
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
35 bls notAtoF
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
36 subb #7 fix a..f
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
37 notAtoF
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
38 subb #'0 convert to binary 0..15
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
39
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
40 * now shift the digit to bits 7..4
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
41
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
42 lslb
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
43 lslb
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
44 lslb
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
45 lslb
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
46
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
47 * now shift the value in to the result
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
48
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
49 lda #4 number of bits
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
50 l1
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
51 lslb digit bit to carry
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
52 rol 1,s carry bit to result
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
53 rol 0,s
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
54 deca done 4?
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
55 bne l1 no, loop
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
56
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
57 leay 1,y number of digits done
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
58 cmpy #4
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
59 bhi error more than 4
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
60 bra loop keep going
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
61
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
62
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
63 exit
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
64 clrb clear carry=no error
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
65 sty -2,s test y (count)
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
66 bne done no digits?
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
67
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
68 error
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
69 clr 0,s
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
70 clr 1,s
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
71 orcc #1 set carry
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 done
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
74 leay -1,x terminator/error pos
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
75 puls d,x,pc
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
76
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
77 endsect
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
78
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
79