home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
programs
/
bkgrondr
/
bgiidrv.lbr
/
S19FNK.AQM
/
S19FNK.ASM
Wrap
Assembly Source File
|
1987-03-22
|
6KB
|
327 lines
.title "S19FNK.asm Super19 function key overlay for BG 6/17/86"
;
; For Super19 Rom for Heath/Zenith 19/89/90 terminals.
;
; NOTE:
; There is apparently no way to determine the current status
; of the terminal's modes. Therefore, the initialiation/
; deinitialization routines cannot save/restore the startup
; modes.
;
.ident S19FNK
.pabs
.phex
.xsym
.xlist
MAXLEN equ 6*80H ;MAX SIZE OF OVERLAY
MAXCOD equ 200h ;MAX size of code & initialized data
;
release equ '0'
vers equ '1'
;
NUL EQU 0
ESC EQU 1Bh
TRUE EQU 0FFh
;
;===============================
; Identification sector at 3e80h
;
.loc 3e80h
fnkyid: .ascii "Super 19 (Heath/Zenith 19/89/90) function-key overlay v. "
db release
db '.'
db vers
db 0 ;NUL-terminated string
;
;==================================
; Table of Function-key 8-bit codes and associated labels at 3f00h.
; Each entry is a 1-byte key value, followed by a 4-byte ascii label.
;
.loc 3f00h
;
labtbl: db nm8kys ;number of keys
;
fstky:
;
; Alternate Keypad Mode - top row function keys
db 'P'+80H
.ascii "blue" ;blue
db 'Q'+80H
.ascii "red " ;red
db 'R'+80H
.ascii "whit" ;white/grey
db 'S'+80H
.ascii "f1 " ;f1
db 'T'+80H
.ascii "f2 " ;f2
db 'U'+80H
.ascii "f3 " ;f3
db 'V'+80H
.ascii "f4 " ;f4
db 'W'+80H
.ascii "f5 " ;f5
db 'J'+80H
.ascii "eras" ;erase
;
; Shifted Alternate Keypad Mode - top row function keys
db '$'+80H
.ascii "BLUE"
db '%'+80H
.ascii "RED "
db '&'+80H
.ascii "WHIT"
db "'"+80H
.ascii "F1 "
db '{'+80H
.ascii "F2 "
db '}'+80H
.ascii "F3 "
db '*'+80H
.ascii "F4 "
db '+'+80H
.ascii "F5 "
db 'E'+80H
.ascii "ERAS"
;
; Shifted Keypad Mode - numeric keypad keys
db 'L'+80H
.ascii "key1"
db 'B'+80H
.ascii "key2"
db 'M'+80H
.ascii "key3"
db 'D'+80H
.ascii "key4"
db 'H'+80H
.ascii "key5"
db 'C'+80H
.ascii "key6"
db '@'+80H ; kp 7
.ascii "key7"
db 'O'+80H ; kp 7 if insert on. ??
.ascii "key7"
db 'A'+80H
.ascii "key8"
db 'N'+80H
.ascii "key9"
;
; Alternate or Shifted Alternate Keypad Mode - numeric keypad keys
db '1'+80H
.ascii "KEY1"
db '2'+80H
.ascii "KEY2"
db '3'+80H
.ascii "KEY3"
db '4'+80H
.ascii "KEY4"
db '5'+80H
.ascii "KEY5"
db '6'+80H
.ascii "KEY6"
db '7'+80H ; kp 7
.ascii "KEY7"
db '8'+80H
.ascii "KEY8"
db '9'+80H
.ascii "KEY9"
;
; Alternate Keypad Mode
db '0'+80H
.ascii "key0" ;zero
db '.'+80H
.ascii "key." ;dot
db '/'+80H
.ascii "entr" ;enter
;
; Shifted Alternate Keypad Mode
db '_'+80H
.ascii "KEY0" ;ZERO
; DOT is the same
db '?'+80H
.ascii "ENTR" ;ENTER
;
nm8kys equ (.-fstky)/(1+4)
;
.ifg (. - labtbl - 100h), [
.prntx "Overflow in label table"
]
;
.ifn (.-fstky)@(1+4), [
.prntx "alignment error in labels"
]
;
;==================================
; The function-key overlay at 4000h.
;
.loc 4000h
;
; Enter A = 0 ... 7 function number.
; After exit, this overlay is written to swap file to preserve
; changed data.
;
START: ora a
jz init ;0
dcr a
jz deinit ;1
dcr a
jz ashft ;2
dcr a
jz bshft ;3
dcr a
jz aunshft ;4
dcr a
jz bunshft ;5
dcr a
jz asave ;6
dcr a
jz bsave ;7
dcr a
jz arest ;8
dcr a
jz brest ;9
ret ;not supported
;
;-----------------
; Function 0. INIT.
; This routine is called when BG is first loaded.
;
; Save initial state of function keys.
; Set 8-bit function key codes for BG.
;
INIT: lxi h,Zshift ;8bit and alternate
jmp display
;
;-------------------
; Function 1. DEINIT.
; Restore 7-bit mode.
;
DEINIT: lxi h,Zunshft ;7 bit and not alternate
jmp display
;
;----------------------
; Functions 2, 3. SHIFT.
;
; Set 8-bit function key mode.
;
; "A" refers to the initial task, "B" to the Alternate task.
;
ASHFT: mvi a,TRUE ;record mode
sta Ashftq
doshft: lxi h,Zshift
jmp display
;
BSHFT: mvi a,TRUE
sta Bshftq
jmp doshft
;
;------------------------
; Functions 4, 5. UNSHIFT.
; Restore 7-bit mode.
;
;
AUNSHF: xra a
sta Ashftq
dounsh: lxi h,Zunshft
jmp display
;
BUNSHF: xra a
sta Bshftq
jmp dounsh
;
;---------------------
; Functions 6, 7. SAVE.
; Save current function keys in preparation for task swap.
;
ASAVE: RET
;
BSAVE: RET
;
;------------------------
; Functions 8, 9. RESTORE.
; Restore current function keys following task swap.
;
AREST: lda Ashftq
arest1: ora a
jnz doshft
jmp dounsh
;
BREST: lda Bfirst ;on first swap, there's nothing to restore
ora a
mvi a,0
sta Bfirst
rnz
lda Bshftq
jmp arest1
;
;--------------------------
;
; print NUl-terminated string to conout
display:
mov a,m
ora a
rz
push h
mov c,a
call bios0c
pop h
inx h
jmp display
;
bios0c: lhld 1 ;bios conout
mvi l,0ch
pchl
;
;
Zshift:
zset8b: db ESC,'e','C' ;fn keys send 8-bit mode
Zaltkp: db ESC,'=',NUL ;set alternate keypad
;
Zunshft:
znot8b: db ESC,'e','A' ;fn keys send ESC sequences
Zregkp: db ESC,'>',NUL ;reset alternate keypad
;
; this could perhaps be used for deinit.
; If so, include a delay loop to allow H19 rom to complete the
; operation without dropping following characters.
;
;Zdeini: db ESC,'Z',NUL ;restore to power-up config.
;
; what is this: ??
;zenab: db ESC,'x','7',NUL ;enable alternate keypad
;
;
Ashftq: db 0 ;A mode state
Bshftq: db 0 ;B mode state
Bfirst: db TRUE ;first-time flag , static TRUE
;
undata equ .
.ifg (undata - start - MAXCOD), [
.PRNTX "Code exceeds maximum!"
]
;
; Unitialized Data area.
;
; NONE.
;
.slist
.list
LENGTH equ . - START
.ifg (length - MAXLEN), [
.prntx "Overflow in Key Overlay module!"
]
.rlist
.END
rz
push h
mov c,a
call bios0c
pop h
inx h
jmp display
;
bios0c: lhld 1 ;bios conout
mvi l,0ch
pchl