add: and operand, return after je/jne

This commit is contained in:
ALittlePatate
2023-04-28 11:54:59 +02:00
committed by GitHub
parent 99780e710c
commit cbd52958e0

View File

@@ -10,7 +10,7 @@
; if (i >= 58 && i <= 64) {
; continue;
; }
; if (GetAsyncKeyState(i)) {
; if (GetAsyncKeyState(i) & 0x8000) {
; printf("%c", i);
; }
; }
@@ -32,6 +32,7 @@ add a1, 1 ; i++
push a1 ; arg 1 (vKey)
call GetAsyncKeyState
and eax, 32768 ; 0x8000 but i haven't implemented hex yet
cmp eax, 1
jne numbers ; if GetAsyncKeyState was false, jump to numbers
@@ -42,6 +43,8 @@ call printf
jmp numbers
; https://stackoverflow.com/a/18670716
; note about returns : you can directly call ret from a je/jne/ja/jna/jb/jnb with "jb return".
; so return cannot be used as a label.
check:
cmp a1, 58
jb return ; if <
@@ -55,6 +58,3 @@ ret
inc_and_numbers:
add a1, 1
call numbers
return:
ret