;---------------------------------------------------------------------- ; 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