2474
|
1 ********************************************
|
|
2 *
|
|
3 * Binary to hexadecimal convertor
|
|
4 *
|
|
5 * This subroutine will convert the binary value in
|
|
6 * 'D' to a 4 digit hexadecimal ascii string.
|
|
7
|
|
8
|
|
9 * OTHER MODULES NEEDED: BIN2HEX
|
|
10
|
|
11 * ENTRY: D=value to convert
|
|
12 * X=buffer for hex string-null terminated
|
|
13
|
|
14 * EXIT all registers (except CC) preserved.
|
|
15
|
|
16 nam Convert # to Hex String
|
|
17 ttl Assembler Library Module
|
|
18
|
|
19
|
|
20 psect BIN_HEX,0,0,0,0,0
|
|
21
|
|
22 BIN_HEX:
|
|
23 pshs d,x
|
|
24 ldb ,s
|
|
25 lbsr BIN2HEX convert 1 byte
|
|
26 std ,x++
|
|
27 ldb 1,s
|
|
28 lbsr BIN2HEX convert 2nd byte
|
|
29 std ,x++
|
|
30 clr ,x term with null
|
|
31 puls d,x
|
|
32
|
|
33 endsect
|
|
34
|
|
35 |