Sherlock: annotated disassembly

Routines

Prev: E28D Up: Map Next: E2C6
E298: Can this hansom cab be hailed here?
The direct object must be one of the two hansom cabs (30 or 33); the room (A00A) must be one of the cab stands (9C07 with C = 0: any journey from here); the cab ($A013) must be off stage (room 0), i.e. not already on a job; and CFB9 must agree. Otherwise it refuses (DC15). The HAIL action (E2C7) runs it.
Input
$A034 The cab
Output
F NZ if the cab can be hailed here; otherwise refused ($DC15)
E298 LD A,($A034) Read $A034 in "Game variables" into A - Must be one of the two hansom cabs, 30 or 33
E29B CP $1E Compare A with $1E
E29D JR Z,$E2A4 If A equals $1E, skip ahead to E2A4
E29F CP $21 Compare A with $21
E2A1 JP NZ,$DC15 If A differs from $21, go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
E2A4 LD A,($A00A) Read the current actor's room (A00A) into A - Must be at a cab stand: any journey from here (9C07, C = 0)
E2A7 LD C,$00 Load C with $00
E2A9 CALL $9C07 Call the routine "Find the cab journey between two rooms" (9C07)
E2AC JP NZ,$DC15 If the zero flag is clear, go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
E2AF LD IX,($A013) Read $A013 in "Game variables" into IX - The cab must be in room 0 - free, not on a job
E2B3 LD A,(IX+$0F) Read byte +15 of the record at IX into A
E2B6 AND A Test A for zero (this leaves A as it was and clears carry)
E2B7 JP NZ,$DC15 If A is not zero, go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
E2BA LD A,($A034) Read $A034 in "Game variables" into A - And CFB9 must agree
E2BD CALL $CFB9 Call CFB9 (inside "Save a sub-script call frame")
E2C0 JP NZ,$DC15 If the zero flag is clear, go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
E2C3 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - NZ: it can be hailed
E2C5 RET Return to the caller
Prev: E28D Up: Map Next: E2C6