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