Here's an interesting little subroutine, similar to one published in a recent issue of the PowerBASIC Gazette. It converts a binary value in register AL (0-255) to the equivalent ASCII hex digits (00-FF). The hi-order hex digit is returned in register DL, the lo-order hex digit in register DH, so you can easily store it in memory with: MOV [MemoryWord], DX.
Code:
Bin8ToHex: push eax ror al, four call Bin8a mov dl, dh pop eax Bin8a: and al,00001111b add al,90h daa adc al,40h daa mov dh, al ret
Comment