![]() |
Routines |
| Prev: 44283 | Up: Map | Next: 44633 |
|
Used by the routines at CopyDisplayIfNeeded and HandleClassAWord.
Grammar handler for word class 176. It matches the word in D against the earlier clause records, which are kept in a linked list.
|
||||
| MatchWordAgainstEarlierClause | 44375 | LD A,(40986) | Read the parser count, count down one and point HL at 40978. | |
| 44378 | DEC A | |||
| 44379 | LD HL,40978 | |||
| 44382 | DEC A | Jump ahead to MatchWordAgainstEarlierClause_AdvanceCount unless the parser count was 2. | ||
| 44383 | LD A,D | |||
| 44384 | JR NZ,MatchWordAgainstEarlierClause_AdvanceCount | |||
| 44386 | CP 160 | Jump to MatchWordAgainstEarlierClause_0 when the token is 160. | ||
| 44388 | JR Z,MatchWordAgainstEarlierClause_0 | |||
| MatchWordAgainstEarlierClause_AdvanceCount | 44390 | INC (HL) | Count one more at 40978. | |
| MatchWordAgainstEarlierClause_0 | 44391 | CP 160 | Jump back to 43709 if the token is 160. | |
| 44393 | JP Z,43709 | |||
| 44396 | LD A,(40987) | Jump to MatchWordAgainstEarlierClause_CountClauses if the initialised flag is zero. | ||
| 44399 | AND A | |||
| 44400 | JR Z,MatchWordAgainstEarlierClause_CountClauses | |||
| 44402 | LD IY,(40944) | Point IY at the clause list at 40944. | ||
| 44406 | CALL FollowCharacterLink | Call FollowCharacterLink to follow the clause link. | ||
| 44409 | LD A,(IY+1) | Read the clause marker. | ||
| 44412 | AND 127 | Go to MatchWordAgainstEarlierClause_LaterList if this clause word is not zero. | ||
| 44414 | OR (IY+0) | |||
| 44417 | JR NZ,MatchWordAgainstEarlierClause_LaterList | |||
| 44419 | LD A,(40987) | Read the initialised flag into DE. | ||
| 44422 | LD E,A | |||
| 44423 | LD D,0 | |||
| 44425 | LD HL,(40944) | Point HL at the clause list at 40944. | ||
| 44428 | LD A,(IY+1) | Keep bit 7 of the clause marker and merge it into the second byte of the record at the pointer in 40944. | ||
| 44431 | AND 128 | |||
| 44433 | INC HL | |||
| 44434 | OR (HL) | |||
| 44435 | LD (HL),A | |||
| 44436 | DEC HL | Step HL back, add the offset, and move IY on eight bytes. | ||
| 44437 | ADD HL,DE | |||
| 44438 | LD DE,8 | |||
| 44441 | ADD IY,DE | |||
| 44443 | PUSH IY | Call CopyDisplayDataIfZero to copy this pair when it is still clear. | ||
| 44445 | POP DE | |||
| 44446 | CALL CopyDisplayDataIfZero | |||
| 44449 | CALL CopyDisplayDataIfZero | Call CopyDisplayDataIfZero again and go to MatchWordAgainstEarlierClause_1 when the source low byte is zero. | ||
| 44452 | JR Z,MatchWordAgainstEarlierClause_1 | |||
| 44454 | PUSH DE | Call CopyDisplayDataIfZero to copy the pair two bytes back. | ||
| 44455 | PUSH HL | |||
| 44456 | DEC DE | |||
| 44457 | DEC DE | |||
| 44458 | CALL CopyDisplayDataIfZero | |||
| 44461 | POP HL | |||
| 44462 | POP DE | Restore the saved source from the stack. | ||
| MatchWordAgainstEarlierClause_1 | 44463 | CALL CopyDisplayDataIfZero | Call CopyDisplayDataIfZero. | |
| 44466 | LD IY,(40944) | Point IY at the clause list at 40944 and jump to MatchWordAgainstEarlierClause_Next. | ||
| 44470 | JR MatchWordAgainstEarlierClause_Next | |||
|
Starts this walk at the saved clause list.
|
||||
| MatchWordAgainstEarlierClause_LaterList | 44472 | LD IY,40946 | Point IY at 40944+2. | |
| MatchWordAgainstEarlierClause_Next | 44476 | LD L,(IY-2) | Read this clause record's link. | |
| 44479 | LD H,(IY-1) | |||
| 44482 | PUSH HL | Copy the clause link from HL into IX. | ||
| 44483 | POP IX | |||
| 44485 | LD L,(IX-2) | Read the link of the previous record. | ||
| 44488 | LD H,(IX-1) | |||
| 44491 | LD (IY-2),L | Store the low byte of that link. | ||
| 44494 | LD (IY-1),H | Store the high byte and call ProcessMemoryEntry. | ||
| 44497 | CALL ProcessMemoryEntry | |||
| MatchWordAgainstEarlierClause_CountClauses | 44500 | LD IY,40946 | Point IY at 40944+2 and take the count at 40978. | |
| 44504 | LD A,(40978) | |||
| 44507 | LD B,A | |||
| 44508 | PUSH BC | Call StepToNextClauseRecord to step to the next clause record. | ||
| 44509 | CALL StepToNextClauseRecord | |||
| MatchWordAgainstEarlierClause_Loop | 44512 | LD A,B | Jump ahead to MatchWordAgainstEarlierClause_MatchClause if the count is zero. | |
| 44513 | AND A | |||
| 44514 | JR Z,MatchWordAgainstEarlierClause_MatchClause | |||
|
Steps to the next clause record.
|
||||
| 44516 | CALL StepToNextClauseRecord | Call StepToNextClauseRecord to step to the next clause record. | ||
| 44519 | LD A,(40996) | Jump to MatchWordAgainstEarlierClause_ClauseMarker if the command mode at 40996 is not 2. | ||
| 44522 | CP 2 | |||
| 44524 | JR NZ,MatchWordAgainstEarlierClause_ClauseMarker | |||
| 44526 | PUSH IY | Point HL at byte 24 of the record (IY+24) and save it. | ||
| 44528 | POP HL | |||
| 44529 | LD DE,24 | |||
| 44532 | ADD HL,DE | |||
| 44533 | PUSH HL | |||
| 44534 | LD D,6 | Take a length of 6 and clear the merge. | ||
| 44536 | XOR A | |||
| MatchWordAgainstEarlierClause_TestCountFinished | 44537 | OR (HL) | Jump back to MatchWordAgainstEarlierClause_TestCountFinished while the count is not finished. | |
| 44538 | INC HL | |||
| 44539 | DEC D | |||
| 44540 | JR NZ,MatchWordAgainstEarlierClause_TestCountFinished | |||
| 44542 | POP HL | Restore the saved pointer from the stack. | ||
| 44543 | AND A | Go to MatchWordAgainstEarlierClause_ClauseMarker when any of the six bytes just merged is set. | ||
| 44544 | JR NZ,MatchWordAgainstEarlierClause_ClauseMarker | |||
| 44546 | EX DE,HL | Swap the pointers and point HL at IX, with 0024 ready to add. | ||
| 44547 | PUSH IX | |||
| 44549 | POP HL | |||
| 44550 | PUSH BC | |||
| 44551 | LD BC,24 | |||
| 44554 | ADD HL,BC | Point HL at byte 24 of the record (IX+24) and copy 6 bytes. | ||
| 44555 | LD BC,6 | |||
| 44558 | LDIR | |||
| 44560 | POP BC | |||
| MatchWordAgainstEarlierClause_ClauseMarker | 44561 | LD A,(IY+1) | Read the byte at IY+1. | |
| 44564 | AND 127 | Call MergeCharacterFlags if the link word is zero. | ||
| 44566 | OR (IY+0) | |||
| 44569 | CALL Z,MergeCharacterFlags | |||
| 44572 | JR MatchWordAgainstEarlierClause_Loop | Jump back to MatchWordAgainstEarlierClause_Loop for the next clause record. | ||
|
Matches the word against the saved clause list, and returns zero when none match.
|
||||
| MatchWordAgainstEarlierClause_MatchClause | 44574 | POP BC | Call InitialiseCharacterSearch to initialise character search. | |
| 44575 | CALL InitialiseCharacterSearch | |||
| 44578 | CALL StepThroughSavedClauseList | Call StepThroughSavedClauseList to step through the saved clause list. | ||
| MatchWordAgainstEarlierClause_2 | 44581 | LD A,B | Jump ahead to MatchWordAgainstEarlierClause_SignalStepFailed if the count is zero. | |
| 44582 | AND A | |||
| 44583 | JP Z,MatchWordAgainstEarlierClause_SignalStepFailed | |||
|
Steps to the next saved clause record.
|
||||
| 44586 | CALL StepThroughSavedClauseList | Call StepThroughSavedClauseList to step through the saved clause list. | ||
| 44589 | LD A,(IY+18) | Go back to MatchWordAgainstEarlierClause_2 if the next link is set. | ||
| 44592 | OR (IY+19) | |||
| 44595 | JR NZ,MatchWordAgainstEarlierClause_2 | |||
| 44597 | LD A,(IY+0) | Jump back to MatchWordAgainstEarlierClause_2 while this id does not match the record's flag byte. | ||
| 44600 | CP (IX+0) | |||
| 44603 | JR NZ,MatchWordAgainstEarlierClause_2 | |||
| 44605 | LD A,(IY+1) | Jump back to MatchWordAgainstEarlierClause_2 while this id does not match the moved marker. | ||
| 44608 | CP (IX+1) | |||
| 44611 | JR NZ,MatchWordAgainstEarlierClause_2 | |||
| 44613 | LD A,(IX+14) | Go back to MatchWordAgainstEarlierClause_2 if the attribute word is zero. | ||
| 44616 | OR (IX+15) | |||
| 44619 | JR Z,MatchWordAgainstEarlierClause_2 | |||
| 44621 | EXX | Call 44839 to read the schedule field. | ||
| 44622 | LD DE,14 | |||
| 44625 | CALL 44839 | |||
| 44628 | JP MatchWordAgainstEarlierClause_2 | Jump back to MatchWordAgainstEarlierClause_2 for the next clause record. | ||
| MatchWordAgainstEarlierClause_SignalStepFailed | 44631 | XOR A | Clear A. | |
| 44632 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 44283 | Up: Map | Next: 44633 |