Routines
| Prev: 9B7F | Up: Map | Next: 9C41 |
9C07: Find the cab journey between two rooms
|
Searches 9B7F for an entry joining room A and room C, in either order; C = 0 matches any entry with A at either end. Returns Z with IX on the entry, or NZ if there is none.
|
||||||||||||||||
| 9C07 | LD IX,$9B7F | Point IX at "Cab journeys: which cab stands a hansom cab runs..." (9B7F) | ||||||||||||||
| 9C0B | PUSH BC | Save BC on the stack | ||||||||||||||
| 9C0C | LD B,A | Copy A into B | ||||||||||||||
| 9C0D | LD A,(IX+$00) | Read the first byte of the record at IX into A - End of the table: NZ, not found | ||||||||||||||
| 9C10 | CP $FF | Compare A with $FF | ||||||||||||||
| 9C12 | JR Z,$9C3D | If A equals $FF, jump on to 9C3D | ||||||||||||||
| 9C14 | LD A,B | Copy B into A - Is A this entry's first stand? | ||||||||||||||
| 9C15 | CP (IX+$00) | Compare A with the first byte of the record at IX | ||||||||||||||
| 9C18 | JR Z,$9C2A | If A equals the first byte of the record at IX, skip ahead to 9C2A | ||||||||||||||
| 9C1A | CP (IX+$01) | Compare A with byte +1 of the record at IX - or its second? | ||||||||||||||
| 9C1D | JR NZ,$9C33 | If A differs from byte +1 of the record at IX, skip ahead to 9C33 | ||||||||||||||
| 9C1F | LD A,C | Copy C into A - A is the second stand: C = 0 matches anything, | ||||||||||||||
| 9C20 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||||
| 9C21 | JR Z,$9C3B | If A is zero, skip ahead to 9C3B | ||||||||||||||
| 9C23 | CP (IX+$00) | Compare A with the first byte of the record at IX - otherwise C must be the first | ||||||||||||||
| 9C26 | JR NZ,$9C33 | If A differs from the first byte of the record at IX, skip ahead to 9C33 | ||||||||||||||
| 9C28 | JR $9C3B | Skip ahead to 9C3B | ||||||||||||||
| 9C2A | LD A,C | Copy C into A - A is the first stand: C = 0 or C the second | ||||||||||||||
| 9C2B | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||||
| 9C2C | JR Z,$9C3B | If A is zero, skip ahead to 9C3B | ||||||||||||||
| 9C2E | CP (IX+$01) | Compare A with byte +1 of the record at IX | ||||||||||||||
| 9C31 | JR Z,$9C3B | If A equals byte +1 of the record at IX, skip ahead to 9C3B | ||||||||||||||
| 9C33 | INC IX | Step IX on to the next byte - Next entry | ||||||||||||||
| 9C35 | INC IX | Step IX on to the next byte | ||||||||||||||
| 9C37 | INC IX | Step IX on to the next byte | ||||||||||||||
| 9C39 | JR $9C0D | Go back to 9C0D | ||||||||||||||
| 9C3B | POP BC | Restore BC from the stack - Z: found, IX on the entry | ||||||||||||||
| 9C3C | RET | Return to the caller | ||||||||||||||
| 9C3D | OR $01 | Set bit 0 of A | ||||||||||||||
| 9C3F | POP BC | Restore BC from the stack | ||||||||||||||
| 9C40 | RET | Return to the caller | ||||||||||||||
| Prev: 9B7F | Up: Map | Next: 9C41 |