I want to compare a large code string. I tried this:


.data
Table1 db "69540a0d093a656dh",0

yada
yada
mov ebx, ; code string
mov esi,eax
mov eax, dword ptr
cmp eax,ebx
jz $+05h
inc esi
loopnz $-07h
Posted on 2003-09-12 13:40:39 by mrgone
.data

Table1 db "69540a0d093a656dh:%s",0


;subroutine to convert ASCII to hex since MASM converts strings to ASCII

Ascii2Hex:
mov al,

cmp al,39h
ja $+09h
sub al,30h
shl al,04h
jmp $+0dh
test al,02h
jz $+04h
sub al,20h
sub al,37h
shl al,04h
mov ah,al
inc edx
mov al,

cmp al,39h
ja $+06h
sub al,30h
jmp $+0ah
test al,02h
jz $+04h
sub al,20h
sub al,37h
or al,ah
ret
Posted on 2003-09-12 20:29:40 by mrgone
Very nice code. This helps to remember how many bytes each instruction takes :)

I'm some confused still...
I just wander why not use:
Table1 db 69h,54h,0ah,0dh,09h,3ah,65h,6dh,0
Posted on 2003-09-13 02:05:14 by S.T.A.S.
Gee wiz,:( I always do things the hard way.
Posted on 2003-09-13 13:20:48 by mrgone
correction: just to set the record straight

Ascii2Hex:

mov al,

cmp al,39h
ja $+09h
sub al,30h
shl al,04h
jmp $+0dh
test al,020h
jz $+04h
sub al,20h
sub al,37h
shl al,04h
mov ah,al
inc edx
mov al,

cmp al,39h
ja $+06h
sub al,30h
jmp $+0ah
test al,020h
jz $+04h
sub al,20h
sub al,37h
or al,ah
ret
Posted on 2003-09-15 07:55:14 by mrgone
Hi, everyone.
mrgone, shouldn't it be easier to use the BCD instructions? I saw a routine like that somewhere, I think at the Assembler Gems site.
Posted on 2003-09-15 18:18:01 by QvasiModo