TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ROBERT GLODT
from: BARRY BLOCK
date: 1997-10-01 13:12:00
subject: lock keys

Hello Robert,
 RG> I'm trying to make the caps,num,scroll lock lights flash.
 RG> Could someone post some code that does this,...
     Yes. I can do this one :-)
;toggle keyboard lights sequentially - Barry Block 11-96 - A86 comfile
org 100h
scroll   equ 16                 ;bit 4 - scroll lock  (16)
numlock  equ 32                 ;bit 5 - numlock      (32)
capslock equ 64                 ;bit 6 - caps lock    (64)
delay    equ  2                 ;x/18 of a second
mov ax, 0040h
mov ds, ax                      ;point ds to bios segment
push ds:[0017h]                 ;save lites as they are now
or  b[0017h],70h                ;turn on lites
;-------------------------------
L1:
call esc                        ;if keypress, break out of loop
xor b[0017h],scroll
call timer
call esc
xor b[0017h],numlock
call timer
call esc
xor b[0017h],capslock
call timer
jmp  short L1
;-------------------------------
timer:  mov cx,delay            ;Wait CX clock ticks
wait1:  mov ax,ds:[006Ch]       ;get low word of tick counter
wait2:  cmp ax,ds:[006Ch]       ;wait for it to change
je      wait2
loop    wait1                   ;count CX changes
ret
;-------------------------------
esc:
mov  ah,1       ;check for key press (to abort)
int  16h
jz   ret        ;no key press, so return
mov  ax,0C00h   ;a key was pressed. flush keyboard buffer
int  21h
pop  ax         ;Remove ret from stack
pop  ds:[0017h] ;restore lites as when we started
mov  ax,4c00h   ;exit clean
int  21h
;-------------------------------
Kind regards, Barry
--- Terminate 4.00/Pro
---------------
* Origin: EBO-BBS A'dam +31-20-6002828 (2:280/901.42)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.