home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
tdossigi
/
fkey.a
< prev
next >
Wrap
Text File
|
1986-07-05
|
1KB
|
79 lines
; FKEY for TurboDOS
; By ESKAY 4/85 No Lefts Reversed
;
LOC Data#
;
LEADIN:: BYTE 0X01 ; LEAD-IN CHARACTER
LASTC: BYTE 0 ; PREVIOUS CHAR
INFK: BYTE 0 ; FF=IN SEQUENCE
FKPTR: WORD 0 ; POINTS TO CURRENT FKEY
FKEYS:: BYTE 0
RES 4095
;
LOC Code#
;
FKEY:: MOV BX,&LEADIN
CMP AL,[BX]
JZ ISLI ; JUMP IF IT IS LEADIN
INC BX
MOV [BX],AL
RET
;
; COME HERE IF WE JUST RECEIVED A LEADIN CHARACTER
;
ISLI: CMP FKEYS,=0
JNZ DOFK ; FKEYS ARE ENABLED
RET
;
DOFK: INC BX
MOV [BX],AL ; SET PREVIOUS CHAR
PUSH DX
MOV DL,=1 ; GET CHAR
CALL SERIAL#
;
; THIS CHAR IS THE FKEY
;
PUSH CX
MOV BX,&FKEYS-1 ; HL POINTS TO FKEYS
MOV CX,=4095 ; 4095 CHARS TO CHECK
MOV AH,AL ; SAVE CHAR
BEGOFK: INC BX
CMP [BX],AH
JZ FNDFK
CMP BYTE [BX],=0XFF ;EOF?
JZ PDEX
INC BX
DEC CX
NXTFK: CMP BYTE [BX],=0
JZ BEGOFK
CMP BYTE [BX],=0XFF
JZ PDEX
INC BX
LOOP NXTFK
PDEX: POP CX
POP DX
RET ; FKEY NOT IN TABLE
;
FNDFK: INC BX
MOV BYTE INFK,=0XFF
MOV AL,[BX]
INC BX
MOV FKPTR,BX
JMPS PDEX
;
GETFK:: CMP BYTE INFK,=0
JNZ __X
RET ; NO FKEY SEQUENCE
;
__X: MOV BX,FKPTR
MOV AL,[BX]
INC FKPTR
OR AL,AL
JNZ RETFK
MOV BYTE INFK,=0 ; RESET IN-FK FLAG
RET ; RETURN (CONTINUE NORMALLY)
;
RETFK: POP BX ; KILL RET ADDR
RET ; RETURN TO PREVIOUS CALLER
END