2474
|
1 ****************************************
|
|
2
|
|
3 * Convert hex byte to 2 hex digits
|
|
4
|
|
5 * OTHER MODULES REQUIRED: none
|
|
6
|
|
7 * ENTRY: B= value to convert
|
|
8
|
|
9 * EXIT: D=2 byte hex digits
|
|
10
|
|
11
|
|
12 nam Convert Byte to Hex
|
|
13 ttl Assembler Library Module
|
|
14
|
|
15 psect BIN2HEX,0,0,0,0,0
|
|
16
|
|
17 BIN2HEX:
|
|
18 pshs b
|
|
19 lsrb get msn
|
|
20 lsrb
|
|
21 lsrb
|
|
22 lsrb fall through to convert msn and return
|
|
23 bsr ToHex
|
|
24 tfr b,a 1st digit in A
|
|
25 puls b get lsn
|
|
26 andb #%00001111 keep msn
|
|
27
|
|
28 ToHex
|
|
29 addb #'0 convert to ascii
|
|
30 cmpb #'9
|
|
31 bls ToHex1
|
|
32 addb #7 convert plus 9 to A..F
|
|
33 ToHex1
|
|
34 rts
|
|
35
|
|
36 endsect
|
|
37
|