I’m writing a basic game in MASM , targeting x64. In the below code, I call INT 16.1 to get input from keyboard. However, when running the app to test for keyboard input, the app crashes. When running the app in the VS Debugger, the INT 16 call produces the following error:
Exception thrown at 0x00007FF73D0D176F in AssemblyGame.exe:
0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
I’ve pasted the code that produces the error below
_GameLoop PROC
call _GameInput
mov rax, 0h
ret
_GameLoop ENDP
_GameInput PROC
; Check if any key is being pressed
mov ah, 01h
int 16h ;; <--- This is the line where the error is produced
call DebugPrint
jz NO_KEY_PRESSED
; Check which key is being pressed (AL contains ascii character)
mov ah, 00h
mov ah, 00h
int 16h
; Check W key
cmp al, 77h ; Lowercase w
je W_KEY_PRESSED
cmp al, 57h ; Uppercase W
je W_KEY_PRESSED
...