Mercurial > hg > Members > kono > nitros9-code
annotate lib/alib/bin2hex.as @ 3295:6b7a7b233925 default tip
makefile: Allow PORTS with level1/2 mix
https://sourceforge.net/p/nitros9/feature-requests/10/
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Tue, 19 Apr 2022 18:12:17 +0200 |
parents | 03f26e88b809 |
children |
rev | line source |
---|---|
2783
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
1 **************************************** |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
2 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
3 * Convert hex byte to 2 hex digits |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
4 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
5 * OTHER MODULES REQUIRED: none |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
6 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
7 * ENTRY: B= value to convert |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
8 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
9 * EXIT: D=2 byte hex digits |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
10 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
11 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
12 nam Convert Byte to Hex |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
13 ttl Assembler Library Module |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
14 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
15 section .text |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
16 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
17 BIN2HEX: |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
18 pshs b |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
19 lsrb get msn |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
20 lsrb |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
21 lsrb |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
22 lsrb fall through to convert msn and return |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
23 bsr ToHex |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
24 tfr b,a 1st digit in A |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
25 puls b get lsn |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
26 andb #%00001111 keep msn |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
27 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
28 ToHex |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
29 addb #'0 convert to ascii |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
30 cmpb #'9 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
31 bls ToHex1 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
32 addb #7 convert plus 9 to A..F |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
33 ToHex1 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
34 rts |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
35 |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
36 endsect |
03f26e88b809
Renamed files and setup for lwasm/lwlink work
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
37 |