Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Assemble with nasm -f bin getkeyh.asm -o getkeyh.com
- GetKeyH:
- push bp
- mov bp, sp
- les bx, [bp+6] ; ES:BX = address of variable to return value in
- ; [bp+0] is where BP was pushed
- ; [bp+2] is where the 32-bit far return address is
- ; [bp+6] is where last parameter is
- ; Parameters are pushed on stack left to right
- ; like pascal calling convention.
- in al,60h ; Get scancode from keyboard
- xchg dx,ax
- xor ax,ax ; assume no key (AX=0)
- test dl,10000000b ; is it key up event?
- jnz short getkeyhD ; if it is return 0 (in AX)
- mov al, dl ; Otherwise keydown, AX = scan code
- getkeyhD:
- mov [es:bx], ax ; Update variable with scancode so BASIC can read it.
- pop bp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement