Home > Mobile >  How to check the CapsLock status in Assembly
How to check the CapsLock status in Assembly

Time:06-21

I tried BIOS Interrupt INT 16h, 02h but it is not supported on Emu8086. Can someone teach me how to get directly Capslock status on memory location 0:0417h or other Assembler which supported BIOS Interrupt 16h 02h I've tried MASM but it's not going well. Sorry about my bad English

CodePudding user response:

The status of the caps lock key can be found in bit 40h of the keyboard status word at address 0040:0017. To access this bit, first load the BDA segment into a segment register, then access memory using this segment register. The syntax should be something like:

        mov     ax, 40h                 ; load segment into AX
        mov     es, ax                  ; so we can move it into ES
        test    byte ptr es:[17h], 40h  ; is caps-lock depressed?
        jnz     caps_pressed

caps_not_pressed:
        ...

caps_pressed:
        ...
  • Related