IDENT KEYUTIL
MACHINE Z80
TITLE KEYUTIL - KEY UTILITY HOST LOADED CONTROLWARE.
*COMMENT KEYUTIL - KEY UTILITY HOST LOADED CONTROLWARE.
COMMENT COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
KYU SPACE 4,10
*** KEYUTIL - KEY UTILITY HOST LOADED CONTROLWARE.
*
* W. F. ANSLEY. 83/06/01.
* M. L. SWANSON. 85/01/03.
KYU SPACE 4,10
*** *KEYUTIL* IS THE SOURCE CODE FOR THE Z80 PROGRAM THAT
* IS LOADED INTO THE 721 TERMINAL BY THE *KEY* UTILITY.
* THE PROGRAM *KEYEX* ACTUALLY HAS THE BINARY FOR THIS
* PROGRAM HARDCODED WITHIN ITSELF; THIS PROGRAM IS INCLUDED
* ON THE OPL FOR DOCUMENTATION PURPOSES ONLY. IF ANY
* CHANGES ARE MADE TO THIS PROGRAM, CORRESPONDING CHANGES
* MUST BE MADE TO THE HARDCODED VALUES WITHIN *KEYEX*.
KYU SPACE 4,10
*** ASSEMBLY CONSTANTS.
SENDB EQU #0087 SEND CHARACTER IN B
OBYTE2 EQU #E047
DLMENA EQU #E0B9
KYT EQU #D7E0 KEY TABLE ADDRESS
KTL EQU #F0 KEY TABLE LENGTH
DEFB EQU #C000 DEFINITION BUFFER
DFBE EQU #CAFF DEFINITION BUFFER END
ORG #D100
KYU SPACE 4,25
*** PUSH - PUSH FUNCTION KEY DEFINITIONS.
*
* *PUSH* COPIES THE IMAGE OF THE CURRENT KEY DEFINITIONS
* AND COPIES IT TO A BUFFER WITHIN THE TERMINAL.
*
* CALLS RESET.
PUSH BSS 0 PUSH ROUTINE
LD DE,SKTB GET KEY TABLE ADDRESS
LD BC,KTL GET BYTE COUNTER
LD HL,KYT GET KEY TABLE SAVE AREA
LDIR PUSH KEY TABLE
LD A,(OBYTE2)
LD (OBS2),A SAVE SETUP CHARACTERISTICS
LD A,(DLMENA)
LD (DLMS),A SAVE DELIMITER FLAG
SCF CARRIAGE RETURN AFTER FUNCTION KEY
CCF CLEAR CARRY FLAG
LD A,(DEFB) GET LENGTH OF KEY DEFINITIONS
LD D,A
LD A,(DEFB+1)
LD E,A
INC DE
INC DE SET DE TO LENGTH+2
LD (DFLS),DE SAVE TOTAL LENGTH
LD HL,DFBE MOVE HL TO END OF DEF BUFF
SBC HL,DE SET HL TO START OF PUSH AREA
LD (DFSA),HL SAVE WHERE MOVED
EX DE,HL MOVE DE TO LOCATION MOVED
LD HL,DEFB SET HL TO KEY DEFINITION BUFFER
LD BC,(DFLS) SET NUMBER OF BYTES TO MOVE
LDIR PUSH DEFINITIONS
CALL RESET RESET DEFINITION TABLE
RET RETURN
KYU SPACE 4,25
*** POP - POP FUNCTION KEY DEFINITIONS.
*
* *POP* COPIES THE STORED FUNCTION KEY DEFINITIONS
* FROM THE BUFFER WITHIN THE TERMINAL TO THE
* RESIDENT FUNCTION KEY DEFINITION AREA.
POP BSS 0 ENTRY
LD HL,SKTB RESTORE KEY TABLE BUFFER ADDRESS
LD BC,KTL RESTORE KEY TABLE LENGTH
LD DE,KYT RESTORE KEY TABLE AREA
LDIR RETURN USERS DEFINITIONS
LD A,(OBS2)
LD (OBYTE2),A RESTORE OBYTE2
LD A,(DLMS)
LD (DLMENA),A RESTORE DELIMITER FLAG
LD HL,(DFSA) DEF SAVED ADDRESS
LD A,H
OR L
RET Z IF NONE
LD DE,DEFB RESTORE DEFINITION BUFFER
LD BC,(DFLS) NUMBER OF BYTES TO MOVE
LDIR RESTORE DEFINITIONS
RET RETURN
KYU SPACE 4,25
*** RESET - RESET DEFINITION TABLE.
*
* *RESET* INITIALIZES THE RESIDENT KEY DEFINITION TABLE
* WITHIN THE TERMINAL.
RESET BSS 0 ENTRY
LD A,(OBYTE2) GET OBYTE2
OR 2 SET NUMERIC PAD SHIFTED
LD (OBYTE2),A REPLACE OBYTE2
LD A,0
LD (DLMENA),A SET DELIMITER FLAG FALSE
LD BC,KTL+3
RESET1 BSS 0
DEC BC
DEC BC
DEC BC
LD A,B
OR C
RET Z UNTIL DONE WITH TABLE
LD HL,KYT-3 SET HL TO KEY TABLE-3
ADD HL,BC SET HL TO DEFINITION BYTE
LD (HL),#30 UNDEFINE KEY
JR RESET1
KYU SPACE 4,25
*** LABEL - GET LABELS FROM MEMORY.
*
* *LABEL* RETRIEVES THE STORED FUNCTION KEY LABELS
* FROM WITHIN THE TERMINAL MEMORY.
*
* CALLS POP, PUSH, SENDB.
LABEL BSS 0 ENTRY
LD A,(#D8DD)
LD H,A
LD A,(#D8DE)
LD L,A
LABEL1 BSS 0
LD B,(HL)
LD A,B
CP #FF
JP Z,LABEL2 UNTIL REACH LAST BYTE
PUSH HL
CALL SENDB SEND CHARACTER TO HOST
POP HL
INC HL TO NEXT CHARACTER
JR LABEL1
LABEL2 BSS 0
LD B,#0D
CALL SENDB SEND CARRIAGE RETURN
RET RETURN
DFSA BSS 2 DEFINITIONS SAVED ADDRESS
SKTB BSS KTL SAVE KEY TABLE BUFFER
OBS2 CON 0 OBYTE2 SAVE AREA
DLMS CON 0 DELMENA SAVE AREA
DFLS CON 0 DEF LENGTH SAVE AREA
END