My goal is to create a high/low game where my computer does a simple calculation of half way between the last two possible numbers it could be. It asks, "Am I getting warmer?" The thing I need to get it going (and I don't know if this is nasm specific or something) is knowledge of why the cmp
instruction isn't working. I've tried several answers and they do not work.
I tried using
mov r8w, 'Y'
I have also tried
mov r8w, 59h
Both to compare to the word register r8w
. I want to know where in my code I'm skipping the logic. Here's the code.
.loop:
mov rax, 1
mov rdi, 1
mov rsi, hot_cold
mov rdx, w_len
syscall
mov r9w, 0
mov rax, 0 ; setup for input
mov rbx, 0 ;
mov rdi, 2 ;
mov si, r9w ; collect input
syscall ; init collection
mov r8w, 0 ;
mov r8w, 'Y' ; 59h
cmp r9w, r8w ; compare to Y
jne .hop_no ; compare fail, try N
jmp _for_y ; compare success, change numbers
;syscall
jmp .loop ; loop on successful Y
.hop_no:
mov r8w, 0
mov r8w, 'N' ;4Eh
cmp r8w, r9w ; compare to N
jne _exit ; compare fail, exit
call _for_n ; compare success change numbers
;syscall
jmp .loop