.z80 pool equ 2000h ;---------------------------------------------------------------------- ; Search for a Function key (10_Jul_84) ;-------------------------------------- ; 1) This routine searches any table with the same structure as ; the Function Key Table. ; 2) The Function Key Table Structure starts with one byte giving ; the number of entries. Each entry consists of 1) a function Key ; Code followed by 2) the length of the Function Key Translation ; String followed by 3) the Fuction Key Translation String. ; 3) If the Key is found then the carry is returned Clear else it is Set ; 4) Register Usage: ; A -> Key to Search for ; B -> used as a Counter ; HL -> Pointer to the Base of the Table ; Scan: ld d,0 ;(set hi-order byte of DE to 0) ld b,(hl) ;B:= Number of Entries inc b ;(Make sure there's a count of .ge. 1) inc hl ;HL:= Start of First Entry jr ScSk1 ScLp1: cp (hl) ;Repeat If (Entry Matches Desired Key) inc hl ; (HL:= string.length) ret z ; Return (carry clear) ld e,(hl) ; E:= Length of Entry inc e ; adjust add hl,de ; HL:= Start of Next Entry ScSk1: djnz ScLp1 ;Until (Whole Table has been Checked) scf ;Set the NOT Found Flag ret ;Return ;---------------------------------------------------------------------- ; Get Pointers into the Free Space (1_Mar_84) ;-------------------------------------------- ; 1) This routine finds and records a) the Free Space Pointer, b) the ; Ims Buffer, and c) the Function Key Table starting address and ; Length ; 2) Register Usage: ; C -> holds the desired function key code ; DE -> holds length of desired data structure ; HL -> Enter pointing to the start of the free space pool. ; Get_Pointers: ; ld c,Id_FS call Find_a_Code ld (FS_Pointer),hl ;Save the Free Space Argument Pointer ld (FS_Length),de ; " " " " Length add hl,de ;HL:= Pointer to next entry ; ld c,Id_IMS call Find_a_Code ld (IMS_Pointer),hl ;Save the IMS Argument Pointer ld (IMS_Length),de ; " " " " Length add hl,de ;HL:= Pointer to next entry ; ld c,Id_FC call Find_a_Code ld (FC_Pointer),hl ;Save the Function Key Table Pointer ld (FC_Length),de ; " " " " " Length ret ; Find a Function Key Code ;------------------------- ; -This routine is only used by the Get_Pointers routine. ; Find_a_Code: ld a,(hl) ;Loop A:= Current function code inc hl ld e,(hl) inc hl ld d,(hl) ; DE:= Length of argument inc hl ; HL:= Pointer to Start argument cp c ; If (Current_FC eq Desired_FC) ret z ; Return add hl,de ; HL:= Pointer to next code jr Find_a_Code page ;---------------------------------------------------------------------- ; Lookup Key Name (28_Feb_84) ;---------------------------- ; 1) This routine searches the key dictionary for String matching ; the one in the dictionary buffer. ; 2) Register Usage: ; A -> Returned = 0 for NO Error ; B -> Counter for the length of the string ; HL -> Enter pointing to Start of Dictionary to search ; Lookup_Key_Name: ; ld a,(Dict_Length) ld c,a ;C:= current dictionary buffer length or a ;If (there's no name to look for) jr nz,SrcLp1 ; ld a,Missing_Key_Def ; Set Returned Error Status ret ; Return SrcLp1: ; ld (Save_Pointer),hl ;Loop Save the pointer to the arg inc hl inc hl inc hl ; HL:= pointer to length byte ld a,(hl) ; A:= Length of Name or a ; If (its the End of the Dict.) jr nz,SrcSk2 ; ld a,Bad_Key_Name ; Set Return Error Status ret ; Return SrcSk2: ld b,a ; B:= Length of dictionary string inc hl ; HL:= Pointer to Start of String cp c ; If (the Length Matches) jr nz,SrcNxt ; ld de,Dict_Buffer ; DE:= Start of Dict buf SrcLp2: ld a,(de) ; Repeat cp (hl) ; If (no match) jr nz,SrcNxt ; Break inc hl ; inc dict pointer inc de ; inc Temp pointer djnz SrcLp2 ; Until (Count eq 0) ; ld hl,(Save_Pointer) ; HL:= Pointer to arg. ; ld a,Status_Ok ; Flag:= Success ret ; Return SrcNxt: ld e,b ld d,0 ; DE:= Offset add hl,de ; HL:= Pointer to start next name jr SrcLp1 page ;====================================================================== ; Key Dictionary Macro Definitions (28_Feb_84) ;============================================= ; ; Generate a Function Key Dictionary Entry (28_Feb_84) ;----------------------------------------------------- ; 1) This macro generates an entry in the function key dictionary. ; 2) Each entry in the dictionary has the following form ; 1 byte Length of the name string ; 3 bytes Key definitions (normal, shifted and contol) ; n bytes Name of function key ; DfKey macro Name, K1, K2, K3 local L1, L2 db K1 ;Key Output for UnShifted db K2 ; " " " Shifted db K3 ; " " " Control db l2 - l1 ;length of Name string l1: db '&Name' ;Name of function key l2: endm ; Terminate the Key Dictionary (28_Feb_84) ;----------------------------------------- ; DfEnd macro ds 4,0 ;4 bytes of zero to end the table endm page ;---------------------------------------------------------------------- ; Key Dictionary (7_Aug_84) ;-------------------------- ; 1) This Dictionary contains all of the Function Key Codes ; Key_Dictionary: DfKey F1, 40h, 60h, 0h DfKey F2, 41h, 61h, 1h DfKey F3, 42h, 62h, 2h DfKey F4, 43h, 63h, 3h DfKey F5, 44h, 64h, 4h DfKey F6, 45h, 65h, 5h DfKey F7, 46h, 66h, 6h DfKey F8, 47h, 67h, 7h DfKey F9, 48h, 68h, 8h DfKey F10, 50h, 52h, 53h DfKey FA, 1Ch, 7Ch, 5Ch DfKey FB, 1Dh, 7Dh, 5Dh DfKey FC, 1Eh, 7Eh, 5Eh DfKey FD, 1Fh, 7Fh, 5Fh DfKey UP, 4Ah, 6Ah, 0Ah DfKey DOWN, 4Bh, 6Bh, 0Bh DfKey LEFT, 4Ch, 6Ch, 0Ch DfKey RIGHT, 4Dh, 6Dh, 0Dh DfKey HOME, 4Eh, 6Eh, 0Eh DfKey HELP, 4Fh, 6Fh, 0Fh DfKey ERASE, 49h, 69h, 09h DfKey SETUP, 0, 0, 0 DfKey TAB, Null, 1Ah, 1Bh DfKey 0, 30h, 20h, 10h DfKey 1, 31h, 21h, 11h DfKey 2, 32h, 22h, 12h DfKey 3, 33h, 23h, 13h DfKey 4, 34h, 24h, 14h DfKey 5, 35h, 25h, 15h DfKey 6, 36h, 26h, 16h DfKey 7, 37h, 27h, 17h DfKey 8, 38h, 28h, 18h DfKey 9, 39h, 29h, 19h DfKey <.>, 2Ah, 2Bh, 2Ch DfKey ENTER, 2Dh, 2Eh, 2Fh DfKey <->, 3Ah, 3Bh, 3Ch DfKey <,>, 3Dh, 3Eh, 3Fh DfEnd ;End of the table page ;---------------------------------------------------------------------- ; Non_Printing Key Dictionary (26_Apr_84) ;---------------------------------------- ; 1) This Dictionary contains all of the Special Key names for non- ; printing keys. These names only can appear on the right side of ; the definition. ; Non_Dictionary: DfKey _TAB, 9, 0, 0 ;Tab DfKey _ESC, 1Bh, 0, 0 ;Escape DfKey _DEL, 7Fh, 0, 0 ;Delete DfKey _RTN, 0Dh, 0, 0 ;Carriage Return DfKey _SLW, Slow, 0, 0 ;Slow - Return Char In Status False DfKey _FST, Fast, 0, 0 ;Fast - Return Char In Status True DfEnd ;End of the table ;Free Space Pointers and Lengths FS_Pointer: dw 0 ;Free space pointer FS_Length: dw 0 ; " " length IMS_Pointer: dw 0 ;Ims pointer IMS_Length: dw 0 ; " length FC_Pointer: dw 0 ;Function Key Table pointer FC_Length: dw 0 ; " " " length