x86 - comparing characters in assembly, nasm -
i trying input user , output text depending on user put in.
my issue reason thinks , dont know why. can find code below:
bits 16 org 0x100 jmp main message: db 'please enter a or b:',0ah,0dh,'$' character: db 1 outp_a: db 'it a',0ah,0dh,'$' outp_b: db 'it b',0ah,0dh,'$' finish db 'good bye',0ah,0dh,'$' clearscreen: mov dx, 10 mov bh, 0 mov ah, 2 int 10h mov cx, 2000 mov bh, 0 mov bl, 01eh mov al, 20h mov ah, 09h int 10h ret disply: mov ah,09h int 21h ret get_input: mov ah,01h int 21h ret input_a: mov dx,outp_a call disply ret input_b: mov dx,outp_b call disply ret compare: mov cl,'a' cmp [character],cl jae input_a mov cl,'b' cmp [character],cl jae input_b ret main: call clearscreen mov dx,message call disply call get_input mov [character],ax call compare mov dx,finish call disply int 20h
jae means jump if above or equal, when compare 'a', jump taken character encoding greater or equal 'a'.
what want instead je, means jump if values same.
Comments
Post a Comment