Printing hex values in x86 assembly
This attempts to increment a literal label, which isn't correct. Also, your STRING memory location only allocates one byte (char) instead of a larger number to accommodate the size of string you intend.
STRING:
db 0
inc STRING ;THIS WON'T WORK
mov [STRING], ah ;append the new character to a string of bytes
inc STRING ;THIS WON'T WORK
mov [STRING], al ;append the new character to the string of bytes
A neutral comment: the character table used for xlat
does not need to be zero terminated.
Also I'd recommend saving and restoring some registers as good asm programming practice. That way, the calling function doesn't need to worry about registers being changed "behind its back". Ultimately then, you probably want something like this:
TABLE:
db "0123456789ABCDEF", 0
hex_to_char:
push bx
mov bx, TABLE
mov ax, dx
mov ah, al ;make al and ah equal so we can isolate each half of the byte
shr ah, 4 ;ah now has the high nibble
and al, 0x0F ;al now has the low nibble
xlat ;lookup al's contents in our table
xchg ah, al ;flip around the bytes so now we can get the higher nibble
xlat ;look up what we just flipped
mov bx, STRING
xchg ah, al
mov [bx], ax ;append the new character to the string of bytes
pop bx
ret
section .bss
STRING:
resb 50 ; reserve 50 bytes for the string
EDIT: some desirable tweaks based upon Peter Cordes' input.