assembly - assembler - How to check, if a specific key is being pressed -


i`m doing bit of programming in assembly language. have got question. how can check if key being pressed, e.g. if pressing f8 key, jump reboot.

this works me (assuming x86 real mode):

[org 0x100] [bits 16]  mov dx,prompt mov ah,9 int 21h  wait_for_f8:   mov ah,0   int 16h       ; keystroke    cmp ah,42h    ; 42h == scancode f8   jne wait_for_f8  mov dx,exit_msg mov ah,9 int 21h  mov ax,4c00h int 21h  prompt: db 'please press f8..$' exit_msg: db 13,10,'f8 pressed',13,10,'$' 

the dos interrupts (int 21h) there give feedback user. in boot loader wouldn't need (if need text output in boot loader use int 10h instead, or write directly video memory).


Comments