Sherlock: annotated disassembly

Routines

Prev: D46C Up: Map Next: D4A7
D495: GET-ACTOR-ROOM: what room is actor A currently in?
Returns $FF for an invalid id, or if the resolved record isn't type 1.
Input
A An actor number
Output
A The actor's room, or $FF if it is not an actor
IX The actor's record
D495 CP $FF Invalid id ($FF)?
D497 RET Z ...then just say so
D498 CALL $D237 Resolve the id to its full record
D49B LD A,$01 Is this really an actor/character record (tag $01)?
D49D CP (IX+$00) Compare A with the first byte of the record at IX
D4A0 LD A,$FF ...no: fail
D4A2 RET NZ If A differs from the first byte of the record at IX, return
D4A3 LD A,(IX+$0F) Yes: the room number lives at offset +15
D4A6 RET Return to the caller
Prev: D46C Up: Map Next: D4A7