Prev: $1468 Up: Map Next: $15B3
$149F: Make any nearby teacher give ERIC lines if necessary
This corresponds to $77AC in the ZX Spectrum version.
Called from the main loop at $0800.
$149F LDA $60 Pick up the current character number from $60.
$14A1 PHA Save it temporarily.
$14A2 LDA #$14 Set the current character number at $60 to $14 (ERIC).
$14A4 STA $60
$14A6 JSR $3279 Copy ERIC's character buffer into page 0.
$14A9 DEC $C6 Decrement the lines-giving delay counter at $C6.
$14AB LDA $C6 Pick up the lines-giving delay counter from $C6.
$14AD AND #$0F Is the low nibble zero?
$14AF BEQ $14B4 Branch if so.
$14B1 JMP $15AC Otherwise there's nothing to do.
$14B4 LDA $C6 Pick up the lines-giving delay counter from $C6.
$14B6 AND #$F0 Clear bits 0-3.
$14B8 CMP #$51 Is the high nibble 5 or less?
$14BA BCC $14BF Branch if so.
$14BC JMP $15AC Otherwise there's nothing to do.
$14BF LDA $C6 Pick up the lines-giving delay counter from $C6.
$14C1 AND #$F0 Is the high nibble zero?
$14C3 BNE $14C7 Branch if not.
$14C5 LDA #$10 Prepare to reset the lines-giving delay counter to $10.
$14C7 STA $C6 Update the lines-giving delay counter at $C6 (the low nibble is now zero).
$14C9 JSR $1EC2 Get ERIC's coordinates in X and Y.
$14CC CPY #$03 Is ERIC on the top floor?
$14CE BEQ $14E1 Branch if so.
$14D0 CPY #$0A Is ERIC on the middle floor?
$14D2 BEQ $14E1 Branch if so.
$14D4 CPY #$11 Is ERIC on the bottom floor?
$14D6 BEQ $14E1 Branch if so.
$14D8 LDA $14 Pick up ERIC's posture indicator from $14.
$14DA BNE $14E1 Branch unless ERIC is sitting on a staircase.
$14DC LDA #$00 Lines reprimand $00: DON'T SIT ON THE STAIRS.
$14DE JMP $1538 Make any nearby teacher give lines to ERIC.
$14E1 JSR $0D91 Is ERIC in the classroom he should be in?
$14E4 BNE $14EB Branch if not.
$14E6 LDA #$00 A=$00: ERIC's where he should be.
$14E8 JMP $14ED Jump forward.
$14EB LDA #$FF A=$FF: ERIC's not where he should be.
$14ED STA $EC Store this indicator at $EC.
$14EF LDA $C7 Pick up the region identifier (0-7) for ERIC's location.
$14F1 BNE $14F8 Branch unless ERIC's in the head's study or the staff room.
$14F3 LDA #$01 Lines reprimand $01: THE ROOM IS PRIVATE.
$14F5 JMP $1538 Make any nearby teacher give lines to ERIC.
$14F8 LDA #$01 Event $01: ERIC should be in class or the dinner hall now.
$14FA JSR $31D2 Has the signal for this event been raised?
$14FD BCS $151F Branch if so.
$14FF LDA $C7 Pick up the region identifier (0-7) for ERIC's location.
$1501 CMP #$05 Is ERIC in a classroom?
$1503 BCC $1519 Branch if so.
$1505 LDA $26 Pick up ERIC's animatory state from $26.
$1507 AND #$07 Keep only bits 0-2.
$1509 CMP #$06 Is ERIC sitting on the floor?
$150B BEQ $1514 Branch if so.
$150D CMP #$07 Is ERIC lying on his back?
$150F BEQ $1514 Branch if so.
$1511 JMP $15AC Otherwise jump forward.
$1514 LDA #$04 Lines reprimand $04: GET OFF THE FLOOR.
$1516 JMP $1538 Make any nearby teacher give lines to ERIC.
$1519 LDA $40 Pick up the MSB of the lesson clock from $40.
$151B CMP #$08 Is it 8 or more?
$151D BCS $1505 Branch if so.
$151F LDA $EC Is ERIC where he should be?
$1521 BEQ $1528 Branch if so.
$1523 LDA #$02 Lines reprimand $02: GET TO WHERE YOU SHOULD BE.
$1525 JMP $1538 Make any nearby teacher give lines to ERIC.
$1528 LDA #$02 Event $02: ERIC's lesson has started.
$152A JSR $31D2 Has the signal for this event been raised?
$152D BCC $1505 Branch if not.
$152F LDA $14 Pick up ERIC's posture indicator from $14.
$1531 BNE $1536 Branch if ERIC is standing up.
$1533 JMP $15AC Otherwise jump forward.
$1536 LDA #$03 Lines reprimand $03: NOW FIND A SEAT.
$1538 STA $D8 Store the lines reprimand identifier at $D8.
$153A LDA $C6 Pick up the lines giving delay counter from $C6.
$153C CMP #$10 Is the high nibble equal to 1?
$153E BEQ $1548 Branch if so.
$1540 LDA $71 Pick up the character number of the teacher who last gave ERIC lines from $71.
$1542 JSR $0E5B Check whether ERIC can be seen by any other teacher.
$1545 JMP $154B Jump forward.
$1548 JSR $0E59 Can ERIC be seen by a teacher?
$154B BCS $1550 Branch if so.
$154D JMP $15AC Otherwise jump forward.
ERIC has been spotted by a teacher doing something he shouldn't be doing.
$1550 STA $71 Store the character number of the teacher who can see ERIC at $71.
$1552 LDA #$A0 Reset the high and low nibbles of the lines-giving delay counter at $C6 to 10 and 0 respectively.
$1554 STA $C6
$1556 LDA $D8 Pick up the lines reprimand identifier from $D8.
$1558 CMP #$02 Is it $02 (GET TO WHERE YOU SHOULD BE)?
$155A BNE $159E Branch if not.
$155C LDA $70 Pick up the current lesson descriptor from $70.
$155E AND #$F0 Keep only the teacher bits (4-7).
$1560 TAY Transfer them to Y.
$1561 CPY #$00 Is ERIC's teacher for this lesson MR WACKER?
$1563 BNE $156A Branch if not.
$1565 LDA #$0B $0B is MR WACKER's character number.
$1567 JMP $1587 Jump forward.
$156A CPY #$10 Is ERIC's teacher for this lesson MR ROCKITT?
$156C BNE $1573 Branch if not.
$156E LDA #$0C $0C is MR ROCKITT's character number.
$1570 JMP $1587 Jump forward.
$1573 CPY #$20 Is ERIC's teacher for this lesson MR WITHIT?
$1575 BNE $157C Branch if not.
$1577 LDA #$0D $0D is MR WITHIT's character number.
$1579 JMP $1587 Jump forward.
$157C CPY #$30 Is ERIC's teacher for this lesson MR CREAK?
$157E BNE $1585 Branch if not.
$1580 LDA #$0E $0E is MR CREAK's character number.
$1582 JMP $1587 Jump forward.
$1585 LDA #$FF Set A to $FF, indicating that ERIC has no teacher for this period.
$1587 CMP $71 Was ERIC seen by his teacher for this lesson?
$1589 BNE $159E Branch if not.
The truant ERIC has been spotted by his teacher for this period.
$158B LDA #$05 Lines reprimand $05: COME ALONG WITH ME BOY.
$158D STA $D8 Store this lines reprimand identifier at $D8.
$158F INC $C8 Increment the identifier of the lines reprimand message at $C8 and pick up its new value.
$1591 LDA $C8
$1593 CMP #$01 Has the teacher just found ERIC?
$1595 BEQ $159E Branch if so.
$1597 AND #$01 Now A is either $06 (HURRY UP YOU HORROR) or $07 (DON'T TRY MY PATIENCE BOY).
$1599 CLC
$159A ADC #$06
$159C STA $D8 Store this lines reprimand identifier at $D8.
$159E LDA #$14 Character number $14 is ERIC.
$15A0 STA $72 Store this lines recipient identifier at $72.
$15A2 LDA $71 Pick up the character number of the teacher who saw ERIC.
$15A4 STA $60 Update the current character number at $60.
$15A6 JSR $3279 Copy this teacher's buffer to page 0.
$15A9 JSR $1DB7 Make the teacher give lines to ERIC.
$15AC PLA Restore the current character number to $60.
$15AD STA $60
$15AF JSR $3279 Copy the current character's buffer to page 0.
$15B2 RTS
Prev: $1468 Up: Map Next: $15B3