Page 1 of 1

Caps lock

Posted: Mon Jul 28, 2008 5:04 pm
by chezzestix
I am trying to get capslock to work but the code I have isnt recognizing that capslock is on. Does it look correct? I've only tested this in VirtualBox, could it just be the emulator?

The code is based off the falicy that if the value of al is greater than 64 then capslock is on (reference). I know that this can also be caused by insert but I'm just trying to get this thing to confim that its on. I will use bit masking later.

Code: Select all

A005_capslock:
       mov si,A005_strci
       call print ;prints null terminated string in si
       mov ah,02h
       int 16h ;get shift flags
       cmp al,40h ;if its greater than 40h either capslock is on or insert is
       jl A005_off
       mov si,A005_stron
       call print
       jmp A005_end
       A005_off:
       mov si,A005_stroff
       call print
       A005_end:
       ret

A005_strci   db "Caps Lock is ",0
A005_stron   db "on",0Dh,0Ah,0
A005_stroff  db "off",0Dh,0Ah,0  

Re: Caps lock

Posted: Tue Jul 29, 2008 12:36 am
by bewing
AFAIK, the byte in the BDA at physical address 0x497 contains the LED bits/shift state when you are in Real mode. The Caps Lock bit is bit #2, value = 4. So it looks to me like you are doing it the hard way. :wink: