Routines

26639: Wipe blackboard


Used by routine at 61696

H Character number of teacher (201-204)

26639 CDF26F CALL 28658 Collect information about board
26642 2E0B LD L,11
26644 3620 LD (HL),32 32 distinct actions needed to wipe board
26646 2C INC L
26647 7B LD A,E A=x-coordinate of left-hand end of board
26648 C607 ADD A,7 A=x-coordinate of right-hand end of board
26650 77 LD (HL),A Store this in byte 12 of the teacher's buffer
26651 2C INC L
26652 72 LD (HL),D Place y-coordinate of top line of board in byte 13
26653 2C INC L
26654 70 LD (HL),B And the board identifier (84, 90, 96, 102, 108) in byte 14
26655 2E09 LD L,9 Change the address in byte 9 and 10 of the buffer to 26659 (below)
26657 3623 LD (HL),35
26659 2E0B LD L,11
26661 35 DEC (HL)
26662 F23668 JP P,26678 Jump if board has not yet been fully wiped
26665 2E0E LD L,14
26667 6E LD L,(HL) L=board identifier (84, 90, 96, 102, 108)
26668 267F LD H,127 HL now points to the board's buffer
26670 3600 LD (HL),0 Signal that the board has been wiped
26672 2C INC L
26673 3600 LD (HL),0
26675 C39063 JP 25488 Now the job's been done, blank out the routine address at bytes 9 and 10 of the teacher's buffer

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 CDB461 CALL 25012 Update SRB for teacher's current animatory state and location
26681 E678 AND 120 Keep bits 3-6 of the teacher's animatory state
26683 2E0B LD L,11 Point HL at the board-wiping action counter
26685 CB46 BIT 0,(HL) Is the teacher midstride or wiping (arm up)?
26687 2835 JR Z,26742 Jump if so
26689 CB4E BIT 1,(HL) Are we ready for a wipe action?
26691 2804 JR Z,26697 Jump if so
26693 3C INC A A=animatory state of teacher midstride
26694 C33061 JP 24880 Update SRB for teacher's new animatory state
26697 C607 ADD A,7 A=animatory state of teacher with arm up
26699 CD3061 CALL 24880 Update SRB for teacher's new animatory state
26702 2E0C LD L,12
26704 5E LD E,(HL) E=x-coordinate of next part of board to be wiped
26705 35 DEC (HL)
26706 2C INC L
26707 56 LD D,(HL) D=y-coordinate of top line of blackboardboard
26708 CD0C67 CALL 26380 Update SRB for the top line of the blackboard
26711 14 INC D D=y-coordinate of bottom line of blackboard
26712 CD0C67 CALL 26380 Update SRB for the bottom line of the blackboard
26715 7A LD A,D
26716 C6A0 ADD A,160
26718 67 LD H,A
26719 16B5 LD D,181
26721 1A LD A,(DE)
26722 6F LD L,A
26723 7E LD A,(HL)
26724 6F LD L,A
26725 D608 SUB 8
26727 5F LD E,A
26728 2680 LD H,128
26730 54 LD D,H
26731 0608 LD B,8 8 lines per character square
26733 3EFF LD A,255 255=blank blackboard byte
26735 77 LD (HL),A Clear a pixel line on the bottom row of the board
26736 12 LD (DE),A Clear a pixel line on the top row of the board
26737 24 INC H
26738 14 INC D
26739 10FA DJNZ 26735 Next pixel line
26741 C9 RET

The teacher is either wiping or on his way to the next spot along the board.
26742 CB4E BIT 1,(HL) Is the teacher wiping?
26744 2801 JR Z,26747 Jump if so
26746 1D DEC E Teacher is midstride, so now move him one space to the left
26747 C33061 JP 24880 Update SRB for teacher's new location