home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
FIXLOK.ZIP
/
FIXLOCK.ASM
next >
Wrap
Assembly Source File
|
1987-09-14
|
5KB
|
373 lines
TITLE fixlock
;scan codes
CAPS_LOCK equ 3ah
NUM_LOCK equ 45h
SCR_LOCK equ 46h
SYSREQ equ 54h
_text segment
assume cs:_text, ds:_text, ss:_text
org 100h
start:
jmp begin
oldint9 dd 0
oldint28 dd 0
myint9 proc far
pushf
push ax
in al,60h
cmp al,SYSREQ
jne testit
mov cs:[was_sysreq],1
jmp short continue
testit:
cmp cs:[mode_type],0
jne continue
and al,7fh
cmp al,CAPS_LOCK
je ignore
cmp al,NUM_LOCK
je ignore
cmp al,SCR_LOCK
jne continue
ignore:
mov al,20h
out 20h,al
pop ax
popf
iret
continue:
pop ax
popf
jmp dword ptr cs:[oldint9]
myint9 endp
onmode db 'ON ',0
offmode db 'OFF',0
mode_len equ 3
msg_1 db '┌────────────────────────────┐',0
msg_2 db '│ Current Lock Status: ___ │',0
msg_3 db '│ │',0
msg_4 db '│ Type SpaceBar to Change │',0
msg_5 db '│ <ESC> to Exit │',0
msg_6 db '└────────────────────────────┘',0
save_buffer db 400 dup(?)
mode_type db 0
msg_len equ 30
msg_att equ 7
mode_att equ 70h
msg_x equ 25
msg_y equ 2
mode_x equ 48
mode_y equ 3
in28 db 0
was_sysreq db 0
signature dw 4352h
myint28 proc far
pushf
cmp cs:[in28],0
jne no_28
cmp cs:[was_sysreq],0
je no_28
dec cs:[was_sysreq]
jnz no_28
inc cs:[in28]
push es
push ds
push ax
push bx
push cx
push dx
push bp
push di
push si
call save_box
call write_box
call wait_key
call rest_box
pop si
pop di
pop bp
pop dx
pop cx
pop bx
pop ax
pop ds
pop es
dec cs:[in28]
mov cs:[was_sysreq],0
no_28:
popf
jmp dword ptr cs:[oldint28]
myint28 endp
cursor_1 dw 0
cursor_2 dw 0
save_box proc near
mov ah,3
xor bx,bx
int 10h ;get cursor position
mov cs:[cursor_1],cx
mov cs:[cursor_2],dx
mov ah,1
xor bx,bx
mov cx,0f000h
int 10h ;turn cursor off
push cs
pop es
lea di,save_buffer
mov dh,msg_y
mov dl,msg_x
mov cx,6
push dx
box_loop1:
push cx
mov cx,30d
line_loop1:
xor bh,bh
mov ah,2
int 10h ;set position
mov ah,8
mov bh,0
int 10h ;get character
stosw
inc dl
loop line_loop1
pop cx ;get back line count
pop dx
inc dh
push dx ;save for later
loop box_loop1
pop dx
ret
save_box endp
rest_box proc near
push cs
pop ds
lea si,save_buffer
mov dh,msg_y
mov dl,msg_x
mov cx,6
push dx
box_loop:
push cx
mov cx,30d
line_loop:
xor bh,bh
mov ah,2
int 10h ;set position
lodsw
mov bl,ah ;mov attribute
push cx
mov ah,9
mov bh,0
mov cx,1
int 10h ;put character
pop cx
inc dl
loop line_loop
pop cx ;get back line count
pop dx
inc dh
push dx ;save for later
loop box_loop
pop dx
mov ah,1
xor bx,bx
mov cx,cs:[cursor_1]
int 10h ;set cursor type
mov ah,2
xor bx,bx
mov dx,cs:[cursor_2]
int 10h ;set cursor position
ret
rest_box endp
write_box proc near
mov bl,msg_att
mov cx,msg_len
mov dh,msg_y
mov dl,msg_x
push cs
pop es
lea bp,msg_1
call write_string
inc dh
lea bp,msg_2
call write_string
inc dh
lea bp,msg_3
call write_string
inc dh
lea bp,msg_4
call write_string
inc dh
lea bp,msg_5
call write_string
inc dh
lea bp,msg_6
call write_string
call write_mode
ret
write_box endp
write_mode proc near
mov bl,mode_att
mov cx,mode_len
mov dh,mode_y
mov dl,mode_x
cmp cs:[mode_type],0
je do_off
lea bp,onmode
jmp short writeit
do_off:
lea bp,offmode
writeit:
call write_string
ret
write_mode endp
wait_key proc near
sti
try_again:
mov ah,0
int 16h
cmp al,01bh ;escape to exit?
je exit_key
cmp al,20h ;change mode?
jne try_again
xor cs:[mode_type],1 ;change modes
call write_mode
jmp short try_again
exit_key:
ret
wait_key endp
write_string proc near
mov ax,1300h
mov bh,0
int 10h
ret
write_string endp
end_resident:
error_msg db 'You must be using OS/2 to use this program',0dh,0ah,'$'
error_msg1 db 'FIXLOCK is already resident!',0dh,0ah,'$'
ok_msg db 'FIXLOCK has been loaded!',0dh,0ah,'$'
begin:
;comment the next four lines to let this run under MS-DOS
mov ax,3000h
int 21h
cmp al,0ah ;is it 0S/2?
jne error_exit
xor ax,ax
mov es,ax
mov byte ptr es:[417h],0 ;clear current flags
mov ax,3528h
int 21h
mov word ptr [oldint28],bx
mov word ptr [oldint28+2],es
cmp word ptr es:[bx-2],4352h
je already_res
lea dx,myint28
mov ax,2528h
int 21h
mov ax,3509h
int 21h
mov word ptr [oldint9],bx
mov word ptr [oldint9+2],es
lea dx,myint9
mov ax,2509h
int 21h
mov cs:[mode_type],0 ;initialize
lea dx,ok_msg
mov ax,0900h
int 21h
mov ax, offset end_resident
add ax,16
xor dx,dx
mov si,10h
div si
mov dx,ax
mov ax,3100h
int 21h
already_res:
lea dx,error_msg1
jmp short out1
error_exit:
lea dx,error_msg
out1:
mov ax,0900h
int 21h
mov ax,4c01h
int 21h
_text ends
end start