Has anyone experienced This? When compiling with options .286 and otion expr16 the xlatb opcodes doesnt seem to work. I was trying to make an Word to hexadecimal translator using xlatb but had to find another way.
original:
;-------------------------------------------------------------------------------------------
; szam konvertalasa hex ascii kodokka , hextable db "0123456789ABCDEF","$" a progi elejére
;
; AX= konvertalando szám
; di = puffer címe (7 bájt)
;-------------------------------------------------------------------------------------------
wtohex:
.data
wtohex_hextable db "0123456789abcdef"
.code
push bx
lea bx, wtohex_hextable
push ax
and ax,0f000h
shr ax,12
xlat
mov byte ptr [di],al
pop ax
push ax
and ax, 00f00h
shr ax,8
xlat
mov byte ptr [di+1],al
pop ax
push ax
and ax, 000f0h
shr ax,4
xlat
mov byte ptr [di+2],al
pop ax
and ax, 0000fh
xlat
mov byte ptr [di+3],al
mov byte ptr [di+4],'h'
mov byte ptr [di+5],"%"
mov byte ptr [di+6],"%"
pop bx
ret
;-------------------------------------------------------------
modified:
;-------------------------------------------------------------------------------------------
; szam konvertalasa hex ascii kodokka , hextable db "0123456789ABCDEF","$" a progi elejére
;
; AX= konvertalando szám
; di = puffer címe (7 bájt)
;-------------------------------------------------------------------------------------------
wtohex:
push bx
push ax
and ax,0f000h
shr ax,12
cmp al,10
jge letter1
add al, 48
jmp next
letter1:
add al, 65
next:
mov byte ptr [di],al
pop ax
push ax
and ax, 00f00h
shr ax,8
cmp al, 10
jge letter2
add al, 48
jmp next2
letter2:
add al, 65
next2:
mov byte ptr [di+1],al
pop ax
push ax
and ax, 000f0h
shr ax,4
cmp al, 10
jge letter3
add al, 48
jmp next3
letter3:
add al, 65
next3:
mov byte ptr [di+2],al
pop ax
push ax
and ax, 0000fh
cmp al, 10
jge letter4
add al, 48
jmp next4
letter4:
add al, 65
next4:
mov byte ptr [di+3],al
pop ax
mov byte ptr [di+4],'h'
mov byte ptr [di+5],"%"
mov byte ptr [di+6],"%"
pop bx
ret
;-------------------------------------------------------------