Prev: 26637 Up: Map Next: 26750
26639: Make a teacher wipe a blackboard
The address of this interruptible subcommand routine is placed into bytes 9 and 10 of the teacher's buffer by the routine at 61696.
Input
H Teacher's character number (201-204)
26639 CALL 28658 Collect information about the board
26642 LD L,11 32 distinct actions are needed to wipe the board; store this counter in byte 11 of the teacher's buffer
26644 LD (HL),32
26646 INC L L=12
26647 LD A,E A=x-coordinate of the left edge of the board
26648 ADD A,7 A=x-coordinate of the right edge of the board
26650 LD (HL),A Store this in byte 12 of the teacher's buffer
26651 INC L Place the y-coordinate of the top line of the board into byte 13 of the teacher's buffer
26652 LD (HL),D
26653 INC L And the board identifier (LSB of 32596, 32602, 32608, 32614 or 32620) into byte 14
26654 LD (HL),B
26655 LD L,9 Change the routine address in bytes 9 and 10 of the teacher's buffer to 26659 (below)
26657 LD (HL),35
26659 LD L,11 Byte 11 holds the board-wiping action counter
26661 DEC (HL) Decrement the counter
26662 JP P,26678 Jump if the board has not yet been fully wiped
The teacher has finished wiping the board. Mark the board as clean, and move the teacher on to his next task.
26665 LD L,14 Collect the board identifier in L
26667 LD L,(HL)
26668 LD H,127 HL now points to the board's buffer
26670 LD (HL),0 Signal that the board has been wiped by zeroing the first two bytes of the blackboard's buffer
26672 INC L
26673 LD (HL),0
26675 JP 25488 Now the job's been done, terminate this interruptible subcommand
The board's not clean yet. Work out what the teacher has to do next: wipe, or move down the board to the next spot.
26678 CALL 25012 Update the SRB for the teacher's current animatory state and location
26681 AND 120 A=teacher's base animatory state
26683 LD L,11 Point HL at the board-wiping action counter
26685 BIT 0,(HL) Is the teacher midstride or wiping (arm up)?
26687 JR Z,26742 Jump if so
26689 BIT 1,(HL) Are we ready for a wipe action?
26691 JR Z,26697 Jump if so
26693 INC A A=animatory state of the teacher midstride
26694 JP 24880 Update the teacher's animatory state and update the SRB
The teacher's next action will be a wipe, so raise his arm.
26697 ADD A,7 A=animatory state of the teacher with his arm up
26699 CALL 24880 Update the teacher's animatory state and update the SRB
26702 LD L,12 Collect the x-coordinate of the part of the board to be wiped into E
26704 LD E,(HL)
26705 DEC (HL) Decrease this x-coordinate ready for the next wipe
26706 INC L Collect the y-coordinate of the top line of the blackboard into D
26707 LD D,(HL)
26708 CALL 26380 Update the SRB for the top line of the blackboard
26711 INC D D=y-coordinate of the bottom line of the blackboard
26712 CALL 26380 Update the SRB for the bottom line of the blackboard
26715 LD A,D Prepare H for picking up skool UDG base address LSBs later
26716 ADD A,160
26718 LD H,A
26719 LD D,181 Pick up the Q value (0<=Q<=143) for the lower blackboard tile being wiped from page 181 in L
26721 LD A,(DE)
26722 LD L,A
26723 LD A,(HL) Collect the LSB of the base address of the skool UDG for this blackboard tile in L
26724 LD L,A
26725 SUB 8 Set E to the LSB of the base address of the skool UDG for the upper blackboard tile
26727 LD E,A
26728 LD H,128 The base page for all blackboard tile UDGs is 128
26730 LD D,H
26731 LD B,8 8 lines per character square
26733 LD A,255 255=blank blackboard byte
26735 LD (HL),A Clear a pixel line in the skool UDG for the lower blackboard tile
26736 LD (DE),A Clear a pixel line in the skool UDG for the upper blackboard tile
26737 INC H Next pixel row of the lower blackboard tile UDG
26738 INC D Next pixel row of the upper blackboard tile UDG
26739 DJNZ 26735 Jump back until the two blackboard tile UDGs have been cleared
26741 RET
The teacher is either wiping or midstride while on his way to the next spot along the board. At this point, A holds the teacher's base animatory state.
26742 BIT 1,(HL) Is the teacher wiping?
26744 JR Z,26747 Jump if so
26746 DEC E The teacher is midstride, so now move him one space to the left
26747 JP 24880 Update the teacher's animatory state and location and update the SRB
Prev: 26637 Up: Map Next: 26750