The LazyBoy Library Manual - WordToHex

Part of the Number Conversions group.

%imacro WordToHex 2
Prefers: ES:DI, AX
Prefers: DI, AX

Convert a word to a hexadecimal ASCIIZ string.

The destination buffer must be at least 5 bytes. 4 for the hexadecimal characters and 1 for the null terminated ASCIIZ string. (range 0000..FFFF)

If the destination pointer does not provide a segment register, ES is assumed.

If a Code Label is provided for the destination pointer, then CS is assumed.

Examples:

    WordToHex   es:di, ax       ; convert ax to hex, store at es:di
    WordToHex   di, cx          ; convert cx to hex, store at es:di
    WordToHex   ds:si, dx       ; convert dx to hex, store at ds:si
    WordToHex   MY_BUF, bx      ; convert bx to hex, store at cs:MY_BUF
    WordToHex   MY_BUF, [si]    ; convert word at [ds:si] to hex, store
                                ; at memory location cs:MY_BUF