:D I know I already posted another question earlier today about Tasm as well, but this one is about a different topic so I wanted to post a new question :D.
Basically, it seems like my function of checking if a key got pressed and then seeing if it is a WASD key just isnt working.
Code:
'''proc KeyPress ;function which gets key press from WASD and will change var 'Direction' according to it.
push ax
cmp [KeyPressed], 0
jne EndKeyPress
startofCheck:
mov ah, 0bh
int 21h;returns AL=0 - NO KEY PRESSED, AL!=0 - KEY PRESSED.
cmp al, 0
je startofCheck
;PROCESS KEY.
mov ah, 0
int 16h ;get the key.
Wait_for_Data:
cmp al, 87;'W'
je MovingUp
cmp al, 65;'A'
je MovingLeft
cmp al, 83;'S'
je MovingDown
cmp al, 68;'D'
je MovingRight
jmp startofCheck
MovingUp:
mov [Direction], 2d
jmp EndKeyPress
MovingLeft:
mov [Direction], 3d
jmp EndKeyPress
MovingDown:
mov [Direction], 4d
jmp EndKeyPress
MovingRight:
mov [Direction], 1d
jmp EndKeyPress
EndKeyPress:
inc [KeyPressed]
pop ax
ret
endp KeyPress '''
What i want to do is basically check if key has been pressed, and if so check if it was a WASD. depending on the key pressed, i will change the direction of the snake.
Any help or advice will be appreciated =D