![]() |
Routines |
| Prev: 39807 | Up: Map | Next: 40001 |
|
Used by the routines at PlaceCharacterBesideMatch and TestCharacterAgainstRoom.
Walks the character-id list at 39807 and stops when the id matches either column, or when the list ends.
|
||||
| SearchPairTable | 39943 | LD IX,39807 | Use the location pairs (39807). | |
| 39947 | PUSH BC | |||
| 39948 | LD B,A | |||
| SearchPairTable_Loop | 39949 | LD A,(IX+0) | Jump to SearchPairTable_TestStepSucceedsScript if this pair's first byte is the end marker 255. | |
| 39952 | CP 255 | |||
| 39954 | JR Z,SearchPairTable_TestStepSucceedsScript | |||
| 39956 | LD A,B | Jump ahead to SearchPairTable_Next if this id matches the first room in this pair. | ||
| 39957 | CP (IX+0) | |||
| 39960 | JR Z,SearchPairTable_Next | |||
| 39962 | CP (IX+1) | Jump ahead to SearchPairTable_TestAdvanceCharacterPair if this id does not match the second room in this pair. | ||
| 39965 | JR NZ,SearchPairTable_TestAdvanceCharacterPair | |||
| 39967 | LD A,C | Jump ahead to SearchPairTable_PairMatchedCaller if C is zero. | ||
| 39968 | AND A | |||
| 39969 | JR Z,SearchPairTable_PairMatchedCaller | |||
| 39971 | CP (IX+0) | Jump ahead to SearchPairTable_TestAdvanceCharacterPair if C does not match the first room in this pair. | ||
| 39974 | JR NZ,SearchPairTable_TestAdvanceCharacterPair | |||
| 39976 | JR SearchPairTable_PairMatchedCaller | Both rooms in this pair match, so accept the pair at SearchPairTable_PairMatchedCaller. | ||
|
A zero in C, or a match in the second column, accepts the pair.
|
||||
| SearchPairTable_Next | 39978 | LD A,C | Jump ahead to SearchPairTable_PairMatchedCaller if C is zero. | |
| 39979 | AND A | |||
| 39980 | JR Z,SearchPairTable_PairMatchedCaller | |||
| 39982 | CP (IX+1) | Jump ahead to SearchPairTable_PairMatchedCaller if C matches the second room in this pair. | ||
| 39985 | JR Z,SearchPairTable_PairMatchedCaller | |||
| SearchPairTable_TestAdvanceCharacterPair | 39987 | INC IX | Advance to the next character pair and keep looking. | |
| 39989 | INC IX | |||
| 39991 | INC IX | |||
| 39993 | JR SearchPairTable_Loop | |||
|
The pair matched, so return the id the caller passed in.
|
||||
| SearchPairTable_PairMatchedCaller | 39995 | POP BC | Restore the id the caller passed in from the stack. | |
| 39996 | RET | Return. | ||
| SearchPairTable_TestStepSucceedsScript | 39997 | OR 1 | Reset the zero flag. | |
| 39999 | POP BC | Restore BC from the stack. | ||
| 40000 | RET | Return. | ||
| Prev: 39807 | Up: Map | Next: 40001 |