> ok, i've tried this a few HUNDERED different ways in C/C++, but to no
> avail. I'm trying to make the caps,num,scroll lock lights flash.
> could someone post some code that does this, because i'm having one
> heck of a time with it.
Mmm.. Some BIOS require that you call 16/1 to update things..
mov dx,0040h ; Set Data segment to 0040h
mov ds,dx
mov bx,0017h
mov al,[bx] ; Get the byte at 0040:0017
xor al,00100000b ; Toggle bit 5, NumLock
mov [bx],al ; Put it back into 0040:0017
mov ah,1
int 16h ; Update Keyboard.
ret
Here's one that talks to the ports.
;----------------------------
; by MARC KOOY
;"LedsGo -- A program to cycle LED's of keyboard"
R EQU 00000001b
L EQU 00000010b
M EQU 00000100b ; It's strange, but okay!
cseg segment
assume cs:cseg, ds:cseg
org 100h
.286
LedsGo_Main:
Mov cx,0Ah
lgm1: Mov LedsOn, L
Call UpdateLeds
Mov LedsOn, M
Call UpdateLeds
Mov LedsOn, R
Call UpdateLeds
Loop lgm1
Int 20h
LedsOn db 1
UpdateLeds Proc near ; Use this Proc to update the LED's when
PushA ; LedsOn is filled with a new value
Mov AL, 0EDh
Out 60h, AL ; Give "Change LED status" command
BufferDelay1:
In AL, 64h ; Read Status register
Test AL, 02h
JNZ BufferDelay1 ; Wait till the Command register is empty
Mov AL, LedsOn
Out 60h, AL ; Give data for LED's that must go on
BufferDelay2:
In AL, 64h ; Read Status register
Test AL, 02h
JNZ BufferDelay2 ; Wait til the Data register is empty
Mov BX,02h
ul1: Mov CX,0FFFFh ; Delay loop- fast machines might
;out 4Fh,al ; want to uncomment this line.
Loop $
Dec BX
Jne ul1
PopA
Ret ; End of UpdateLeds
UpdateLeds EndP
cseg ends
End LedsGo_Main
--- ifmail-tx (i386 Linux)
---------------
* Origin: jvahn@short.circuit.com (1:346/15.1@fidonet)
|