home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
loadcall.zip
/
CONTROL.TXT
< prev
next >
Wrap
Text File
|
1987-04-06
|
8KB
|
284 lines
Keyboard and Cursor Control on the IBM PC
by Ralph Davis, Steve Kurasch, and Olivier Biggerstaff
The following assembly language routines toggle certain hardware
features on and off. The first two sets of routines go into the
system data segment (at absolute address 400H) and change the
keyboard flag, which resides at offset 17H in this segment. This
flag sets its bits to inform the system which Shift keys are on
and which are off. Bit 6 reflects the state of the Capslock key,
and Bit 5 that of the Numlock key. Therefore, the masks are as
follows: to turn the Capslock key on, 40H; to turn it off, 0BFH
(the one's complement of 40H; to turn the Numlock key on, 20H; to
turn it off, 0DFH.
The byte at offset 18H is referred to in the IBM Technical
Reference Manual as KB_FLAG_1, and it also records the state of
the Shift keys. Therefore, these routines also change this byte.
The third set of routines uses BIOS interrupt 10H to turn the
cursor off and on. They also use interrupt 11H to see if you are
using a color monitor, as the masks are different for color and
monochrome.
Turning the Capslock Key On and Off
; Program ...: Caps.ASM
; Author ....: Ralph Davis
; Date ......: September 1, 1985
; Note ......: Turns the Capslock key on or off. Note that this
; listing includes the set of instructions for
; turning the Capslock key both on and off.
;
;
.LFCOND ; List false conditionals.
PAGE 60,132 ; Page length 60, width 132
COM EQU 0 ; Assemble as .BIN file
D3 EQU 1 ; for Developer's Release.
CODESEG SEGMENT BYTE PUBLIC 'CODE'
CAPSLOCK PROC FAR
ASSUME CS:CODESEG
IF COM
ORG 100H ; ORG at 100H for .COM file.
ENDIF
START: PUSH AX ; Save registers.
PUSH DS
PUSH SI
PUSH CX
MOV AX,40H ; Point DS to system data segment
MOV DS,AX
MOV SI,17H ; and SI to KB_FLAG.
MOV CX,2 ; Set counter to perform
; loop twice.
LOOPER: MOV BL,[SI] ; Load flag contents
AND BL,0BFH ; and turn off Capslock bit.
; Note that the instruction
; to turn the Capslock key on
; is OR BL,40H.
; Every other instruction is
; identical.
MOV [SI],BL ; Replace flag.
INC SI ; Point to KB_FLAG_1
LOOP LOOPER ; and do the same thing.
POP CX ; Restore registers.
POP SI
POP DS
POP AX
IF COM
INT 20H ; INT 20H if .COM file.
ELSE
RET ; Far return to dBASE III.
ENDIF
;
CAPSLOCK ENDP
CODESEG ENDS
END START
dBASE II POKE sequence to turn off the Capslock key:
SET CALL TO 61440
*-----------0---1---2---3---4---5---6---7---8---9
POKE 61440, 80, 30, 86, 81,184, 64, 0,142,216,190
POKE 61450, 23, 0,185, 2, 0,138, 28,128,227,191
POKE 61460,136, 28, 70,226,246, 89, 94, 31, 88,195
dBASE II POKE sequence to turn on the Capslock key:
SET CALL TO 61440
* -----------0---1---2---3---4---5---6---7---8---9
POKE 61440, 80, 30, 86, 81,184, 64, 0,142,216,190
POKE 61450, 23, 0,185, 2, 0,138, 28,128,203, 64
POKE 61460,136, 28, 70,226,246, 89, 94, 31, 88,195
Turning the Numlock Key On and Off
; Program ...: Numlock.ASM
; Author ....: Ralph Davis
; Date ......: September 1, 1985
; Note ......: Turns the Numlock on or off. Note that this
; listing includes the set of instructions for
; turning the Numlock key both on and off.
;
;
.LFCOND ; List false conditionals.
PAGE 60,132 ; Page length 60, width 132.
COM EQU 0 ; Assemble as .BIN file
D3 EQU 1 ; for Developer's Release.
CODESEG SEGMENT BYTE PUBLIC 'CODE'
NUMLOCK PROC FAR
ASSUME CS:CODESEG
IF COM
ORG 100H ; ORG at 100H for .COM file.
ENDIF
START: PUSH AX ; Save registers.
PUSH DS
PUSH SI
PUSH CX
MOV AX,40H ; Point DS to system data segment
MOV DS,AX
MOV SI,17H ; and SI to KB_FLAG.
MOV CX,2 ; Set counter to perform
; loop twice.
LOOPER: MOV BL,[SI] ; Load flag contents
AND BL,0DFH ; and turn off Numlock bit.
; Note that the instruction
; to turn the Numlock key on
; is OR BL,20H.
MOV [SI],BL ; Replace flag.
INC SI ; Point to KB_FLAG_1
LOOP LOOPER ; and do the same thing.
POP CX ; Restore registers.
POP SI
POP DS
POP AX
IF COM
INT 20H ; INT 20H if .COM file.
ELSE
RET ; Far return to dBASE III.
ENDIF
;
NUMLOCK ENDP
CODESEG ENDS
END START
dBASE II POKE sequence to turn off the Numlock key:
SET CALL TO 61440
* -----------0---1---2---3---4---5---6---7---8---9
POKE 61440, 80, 30, 86, 81,184, 64, 0,142,216,190
POKE 61450, 23, 0,185, 2, 0,138, 28,128,227,223
POKE 61460,136, 28, 70,226,246, 89, 94, 31, 88,195
dBASE II POKE sequence to turn on the Numlock key:
SET CALL TO 61440
* -----------0---1---2---3---4---5---6---7---8---9
POKE 61440, 80, 30, 86, 81,184, 64, 0,142,216,190
POKE 61450, 23, 0,185, 2, 0,138, 28,128,203, 32
POKE 61460,136, 28, 70,226,246, 89, 94, 31, 88,195
Turning the Cursor On and Off
Turn cursor off:
; Program ...: Curoff.ASM
; Author ....: Steve Kurasch and Olivier Biggerstaff
; Date ......: September 1, 1985
; Note ......: Turns the cursor off.
.LFCOND ; List false conditionals.
PAGE 60,132 ; Page length 60, width 132.
COM EQU 0 ; Assemble as .BIN file
D3 EQU 1 ; for Developer's Release.
CODESEG SEGMENT BYTE PUBLIC 'CODE'
CURSOFF PROC FAR
ASSUME CS:CODESEG
IF COM
ORG 100H ; ORG at 100H for .COM file.
ENDIF
START: PUSH AX ; Save registers.
PUSH CX
MOV AH,1 ; SET CURSOR TYPE function.
MOV CX,8F8FH ; Cursor specifications in CH
; & CL.
INT 10H ; Call ROM BIOS.
POP CX ; Restore register.
POP AX
IF COM
INT 20H ; INT 20H if .COM file.
ELSE
RET ; Far return to dBASE III.
ENDIF
;
CURSOFF ENDP
CODESEG ENDS
END START
Turn cursor on:
; Program ...: Curon.ASM
; Author ....: Steve Kurash and Olivier Biggerstaff
; Date ......: September 1, 1985
; Note ......: Turns the cursor on.
.LFCOND ; List false conditionals.
PAGE 60,132 ; Page length 60, width 132.
COM EQU 1 ; Assemble as .COM file.
D3 EQU 0
CODESEG SEGMENT BYTE PUBLIC 'CODE'
CURSON PROC FAR
ASSUME CS:CODESEG
IF COM
ORG 100H ; ORG at 100H for .COM file.
ENDIF
START: PUSH AX ; Save registers.
PUSH CX
INT 11H ;
MOV CX,8687H ; Mask for color monitor.
AND AL,10H ; Check bit for color card.
JZ CALL_ROM ; JMP if color
MOV CX,8B8CH ; otherwise set up mask for
; monochrome.
CALL_ROM:
MOV AH,1 ; Set cursor type function.
INT 10H ; Call ROM BIOS.
POP CX ; Restore registers.
POP AX
IF COM
INT 20H ; INT 20H if .COM file.
ELSE
RET ; Far return to dBASE III.
ENDIF
;
CURSON ENDP
CODESEG ENDS
END START
dBASE II POKE sequence to turn the Cursor off:
SET CALL TO 61440
* -----------0---1---2---3---4---5---6---7---8---9
POKE 61440, 80, 81,180, 1,185,143,143,205, 16, 89
POKE 61450, 88,195
dBASE II POKE sequence to turn the Cursor on:
SET CALL TO 61440
* -----------0---1---2---3---4---5---6---7---8---9
POKE 61440, 80, 81,205, 17,185,135,134, 36, 16,116
POKE 61450, 3,185,140,139,180, 1,205, 16, 89, 88
POKE 61460,195
You have two ways to execute these routines from dBASE II. You
can enter the poke sequences, then type CALL from the dot prompt.
Or, you can assemble them as .COM files, then type
QUIT TO '<program>'
From dBASE III versions 1.0 and 1.1, you use the RUN command to
execute them as .COM files.
From the Developer's Release of dBASE III, after assembling the
programs as .BIN files, you type
LOAD <module>
CALL <module>