ViaThinkSoft CodeLib
This article is in:
CodeLib → Programming aids → Assembler
Attention: This does only work in real mode, i.e. DOS. It does not work in Windows apps!
Enabling numlock:
Disabling numlock:
Enabling numlock:
set_numlock_on PROC
push ds
mov ax, 40h
mov ds, ax ; go to BIOS Data Area ( http://stanislavs.org/helppc/bios_data_area.html )
mov bx, 17h ; Load Keyboard flag byte 0
mov al, [bx] ; read
or al, 20h ; set bit 5 (numlock) to 1
mov [bx], al ; write
pop ds
ret
set_numlock_on ENDP
Disabling numlock:
set_numlock_off PROC
push ds
mov ax, 40h
mov ds, ax ; go to BIOS Data Area ( http://stanislavs.org/helppc/bios_data_area.html )
mov bx, 17h ; Load Keyboard flag byte 0
mov al, [bx] ; read
and al, DFh ; unset bit 5 (numlock)
mov [bx], al ; write
pop ds
ret
set_numlock_off ENDP
Daniel Marschall
ViaThinkSoft Co-Founder
ViaThinkSoft Co-Founder