home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
24b
/
keyboard.zip
/
SCROLOCK.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-06-17
|
8KB
|
177 lines
page 60,132
title SCROLOCK - routine to activate the scroll lock key
subttl (C) Copyright 1984 by System Enhancement Associates
page
;
; This routine is intended to make the scroll lock key
; (uppermost, rightmost key) function as its name implies.
; That is, stop the screen from scrolling.
;
; BIOS normally performs this function in response to
; control-numlock, for some mysterious reason, but the result
; is neither elegant, convenient, nor esthetically pleasing.
;
; This routine works by installing a resident module
; that intercepts interrupts for video output.
;
; Once this module is installed, any request for BIOS video
; output comes here first. This module first passes the request
; on to BIOS, then it checks the status of the scroll lock
; toggle (which is maintained but ignored by BIOS). If scroll
; lock is on, this routine will loop until it goes off.
;
; Scroll locking action may be turned on and off by re-running
; this module.
;
; Two items of interest should be noted:
;
; 1) This routine halts output by stopping the machine
; from doing anything at all except wait for scroll lock
; to go away. Hence, hitting scroll lock causes the
; machine to effectively grind to a halt (the same is
; true, however, about control-numlock).
;
; 2) The machine does not, however, grind to a halt until
; it tries to output something. So you can hit scroll
; lock, and your machine will continue to run until
; it tries to type something.
;
; 3) This module was originally driven by the keyboard
; interrupt, and hence was guaranteed to pick up on
; a keystroke, but it would occasionally stop the machine
; when video output was disabled (thus reducing its
; usefulness). This version is much less likely to do
; that, but it will not stop output which is being
; generated without using BIOS. Such output, however,
; generally does not scroll.
;
page
code segment
assume cs:code
org 100h
scrolock:jmp setup ;skip over resident part
savevid dd ? ;old video interrupt
lockon db 0 ;non-zero when scroll locking enabled
newvid: cmp ah,50h ;new video interrupt
jz vidhey ;are we installed?
cmp ah,51h
jz vidswit ;turn locking on or off
jmp short vidlock ;else do our thing
vidhey: mov bx,1954h ;hey to you, too
mov al,cs:lockon ;say how we are set
iret
vidswit: mov cs:lockon,al ;set our on/off switch
iret
vidlock: pushf ;get set to fake an interrupt
call cs:savevid ;fake old video call
push ax ;save BIOS reply
sti ;allow more ints while we work
vidloop: cmp cs:lockon,0 ;see if we are active
jz videxit ;forget it if not
mov ah,2 ;check keyboard status
int 16h
and al,10h ;yes - check for scroll lock
jnz vidloop ;loop as long as it's on
videxit: pop ax ;restore old value in ax
iret ;return transparently (we hope)
endres: page
;
; That takes care of the resident portion of SCROLOCK.
; Now we do what is needed to get it properly set up and
; in place.
;
grtmsg db 13,10,'S c r o L o c k Version '
TED_VERSION DB '2.09',13,10,'Created on '
TED_DATE DB '06/17/86 at '
TED_TIME DB '11:31:02, Our card:',13,10
db '┌───────────────────────────────────┐',13,10
db '│ │',13,10
db '│ │',13,10
db '│ System Enhancement Associates │',13,10
db '│ 21 New Street, Wayne NJ 07470 │',13,10
db '│ │',13,10
db '│ Voice: (201) 694-4710│',13,10
db '│ Data: (201) 472-8065│',13,10
db '└───────────────────────────────────┘',13,10
db '(C) Copyright 1984,85,86 by System Enhancement'
db ' Associates;'
db 13,10,' May be freely distributed.',13,10
db 13,10,' Resident portion loaded, Boss!',13,10,'$'
onmsg db 13,10,'Your scroll lock key is now enabled.',13,10,'$'
offmsg db 13,10,'Your scroll lock key is now disabled.',13,10,'$'
install db 0 ;non-zero when install must be done
setup: mov ah,50h ;yoo hoo!
int 10h
cmp bx,1954h ;see if we are installed
je herenow ;skip setup if so
mov install,1 ;else we must stay resident
mov ax,3510h ;read old video output vector
int 21h
mov savevid,bx ;save offset
mov savevid[2],es ;save segment
mov dx,offset newvid ;offset for new video routine
mov ax,2510h ;write new video output vector
int 21h
mov dx,offset grtmsg ;point to greeting
mov ah,09h ;print string
int 21h
push ds ;set es to our segment
pop es
herenow: mov ah,50h ;get current on/off state
int 10h
cmp al,0 ;see if we were on
jz turnon
mov al,0 ;turn off now
mov dx,offset offmsg ;point to off message
jmp short done
turnon: mov al,1 ;turn on now
mov dx,offset onmsg ;point to on message
done: mov ah,51h ;set on/off switch
int 10h
mov ah,09h ;print string
int 21h
cmp install,0 ;are we to stay resident?
jnz stayres ;yes
mov ah,50h ;get switch setting again
int 10h
mov ah,4ch ;terminate with error level
int 21h
stayres: mov ax,offset endres ;address of end of resident portion
mov cl,4 ;shift count
shr ax,cl ;convert length to paragraph count
mov dx,ax ;put paragraph count in dx
inc dx ;round up
mov ah,50h ;get switch setting again
int 10h
mov ah,31h ;terminate and stay resident
int 21h
code ends
end scrolock