Prev: $0D67 Up: Map Next: $0DD4
$0D91: Get the identifier for ERIC's location
Used by the routines at $0B3B, $0E35, $149F and $2745. Obtains the identifier for ERIC's current location, which has one of the following values:
ID Meaning
0 ERIC should never be here (head's study or staff room)
1 Reading Room
2 Map Room
3 White Room
4 Exam Room
5 Revision Library
6 Dinner hall
7 None of the above
Output
($C7) ERIC's location identifier (see above)
P Zero flag set if ERIC's in the classroom he should be in
$0D91 LDA $8C62 Pick up ERIC's y-coordinate from his character buffer.
$0D94 CMP #$07 Is ERIC closer to the top floor than any other?
$0D96 BCC $0DB2 Branch if so.
$0D98 CMP #$0E Is ERIC closer to the middle floor than any other?
$0D9A BCC $0DA7 Branch if so.
$0D9C LDA #$46 The skool region data table for the bottom floor is at $46B6. Store its address at $4E.
$0D9E STA $4F
$0DA0 LDA #$B6
$0DA2 STA $4E
$0DA4 JMP $0DBA Jump forward.
$0DA7 LDA #$46 The skool region data table for the middle floor is at $46AC. Store its address at $4E.
$0DA9 STA $4F
$0DAB LDA #$AC
$0DAD STA $4E
$0DAF JMP $0DBA Jump forward.
$0DB2 LDA #$46 The skool region data table for the top floor is at $46A0. Store its address at $4E.
$0DB4 STA $4F
$0DB6 LDA #$A0
$0DB8 STA $4E
$0DBA LDY #$00 Y is the index into the skool region data table.
$0DBC LDA ($4E),Y Pick up an x-coordinate from the data table.
$0DBE CMP $8C61 Is it less than ERIC's x-coordinate?
$0DC1 BCS $0DC8 Branch if not.
$0DC3 INY Point at the next entry in the skool region data table.
$0DC4 INY
$0DC5 JMP $0DBC Jump back to examine the next entry.
$0DC8 INY Pick up the region identifier from the skool region data table and store it at $C7.
$0DC9 LDA ($4E),Y
$0DCB STA $C7
$0DCD LDA $70 Pick up the current lesson descriptor from $70.
$0DCF AND #$07 Set the zero flag if ERIC's in the classroom he should be in.
$0DD1 CMP $C7
$0DD3 RTS
Prev: $0D67 Up: Map Next: $0DD4