|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 1152 (0x480) Types: TextFile Names: »HEX2BN.MAC«
└─⟦01b5c9619⟧ Bits:30005906 Microsoft Multiplan v1.05 og HELP └─ ⟦this⟧ »HEX2BN.MAC«
; ; ; ; Title Hex ASCII to binary ; Name: HEX2BN ; ; ; Purpose: Convert two ASCII characters to one ; byte of binary data ; ; Entry: Register H = ASCII more significant digit ; Register L = ASCII less significant digit ; ; Exit: Register A = Binary data ; ; Registers used: AF,B ; ; Time: Approximately 148 cycles ; ; Size: Program 24 bytes ; ; ; HEX2BN: ld a,l ;Get low character call a2hex ;Convert it to hexadecimal ld b,a ;Save hex value in B ld a,h ;Get high character call a2hex ;Convert it to hexadecimal rrca ;Shift hex value to upper 4 bits rrca rrca rrca or b ;Or in low hex value ret ;-------------------------------------------------- ; Subroutine: A2HEX ; Purpose: Convert ASCII digit to a hex digit ; Entry: A = ASCII hexadecimal digit ; Exit: A = Binary vaule of ASCII digit ; Registers used: A,F ;-------------------------------------------------- A2HEX: sub '0' ;Subtract ASCII ofset cp 10 jr c,A2HEX1 ;Branch if A is a decimal digit sub 7 ;Else subtract ofset for letters A2HEX1: ret «eof»