diff lib/alib/bin2hex.as @ 2783:03f26e88b809 lwtools-port

Renamed files and setup for lwasm/lwlink work
author Boisy Pitre <boisy.pitre@nuance.com>
date Sat, 26 Jan 2013 17:18:24 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/alib/bin2hex.as	Sat Jan 26 17:18:24 2013 -0600
@@ -0,0 +1,37 @@
+****************************************
+
+* Convert hex byte to 2 hex digits
+
+* OTHER MODULES REQUIRED: none
+
+* ENTRY: B= value to convert
+
+* EXIT: D=2 byte hex digits
+
+
+ nam Convert Byte to Hex
+ ttl Assembler Library Module
+
+ section .text
+
+BIN2HEX:
+ pshs b
+ lsrb get msn
+ lsrb
+ lsrb
+ lsrb fall through to convert msn and return
+ bsr ToHex
+ tfr b,a 1st digit in A
+ puls b get lsn
+ andb #%00001111 keep msn
+
+ToHex
+ addb #'0 convert to ascii
+ cmpb #'9
+ bls ToHex1
+ addb #7 convert plus 9 to A..F
+ToHex1
+ rts
+
+ endsect
+