Prev: 63055 Up: Map Next: 63146
63056: 'W' pressed - write on a blackboard
The address of this routine is found in the table of keypress handling routines at 26752. It is called from the main loop at 26471 when 'W' is pressed.
63056 LD HL,32763 32763 holds ERIC's status flags
63059 BIT 7,(HL) Is ERIC sitting or lying down?
63061 RET NZ Return if so
63062 CALL 26184 Is ERIC on a staircase?
63065 RET NZ Return if so
63066 CP 169 Is ERIC on the bottom floor?
63068 RET Z Return if so
63069 CP 155 Set the zero flag if ERIC's on the top floor
63071 LD BC,12332 C=44, B=48 (x-coordinates of the edges of the 'writing zone' for the Reading Room blackboard)
63074 LD A,E A=ERIC's x-coordinate
63075 JR Z,63087 Jump if ERIC's on the top floor
63077 LD BC,8220 C=28, B=32 (x-coordinates of the edges of the writing zone for the White Room blackboard)
63080 CP 40 Is ERIC to the left of the White Room wall?
63082 JR C,63087 Jump if so
63084 LD BC,12075 C=43, B=47 (x-coordinates of the edges of the writing zone for the Exam Room blackboard)
Now C and B hold the x-coordinates of the left and right edges of the writing zone for the blackboard closest to ERIC.
63087 CP C Return if ERIC is not standing close enough to the blackboard to write on it
63088 RET C
63089 CP B
63090 RET NC
63091 SET 5,(HL) Set bit 5 of ERIC's status flags at 32763: ERIC is writing on a blackboard
63093 LD H,172 172=ERIC
63095 CALL 28968 Get the blackboard identifier in A
63098 LD L,A HL=32749 (Reading Room), 32751 (White Room) or 32753 (Exam Room)
63099 LD H,127
63101 INC L
63102 SUB 180 B=56 (Reading Room), 58 (White Room) or 60 (Exam Room)
63104 LD B,A
63105 LD A,(HL) A=number of the character who last wrote on this board
63106 LD (HL),172 Signal that ERIC (172) wrote on this board
63108 XOR 128 C=128 (bit 7 set) if the board is clean, <128 (bit 7 reset) if not
63110 LD C,A
63111 LD A,B HL=32680 (Reading Room blackboard), 32686 (White Room blackboard), or 32692 (Exam Room blackboard)
63112 ADD A,A
63113 ADD A,B
63114 LD L,A
63115 LD B,4 Prepare the 4 slots in the blackboard buffer that will store the first 4 characters written on the board by ERIC; each slot will have bit 7 set if the board was clean before ERIC started writing
63117 LD (HL),C
63118 INC L
63119 DJNZ 63117
63121 LD (HL),1 ERIC will start writing at pixel column 1
This entry point is used by the routine at 63146.
63123 LD HL,44128 Point HL at byte 96 of ERIC's buffer
63126 LD B,(HL) Pick up ERIC's animatory state in B, and his coordinates in DE
63127 INC L
63128 LD D,(HL)
63129 INC L
63130 LD E,(HL)
63131 LD A,87 Set 32764 (which holds the ASCII code of the last keypress) to 'W' (upper case, so ERIC can write fast)
63133 LD (32764),A
63136 LD H,D Copy ERIC's coordinates to HL
63137 LD L,E
63138 LD A,B A=ERIC's current animatory state
63139 AND 128 A=13 or 141: ERIC with arm up, as if writing
63141 ADD A,13
63143 JP 25916 Raise ERIC's arm
Prev: 63055 Up: Map Next: 63146