Prev: 687E Up: Map Next: 68DD
6880: Make a character write on a blackboard
The address of this interruptible subcommand routine is placed into bytes 0x09 and 0x0A of the character's buffer by the routines at 7EF1 and F100.
Input
H Character number (0xC9-0xCC, 0xCE)
6880 CALL $6755 Collect information about the board
6883 INC B Point BC at the second byte of the board's buffer
6884 LD C,B
6885 LD B,$7F
6887 LD A,(BC) Pick this up in A
6888 AND A Has the board been written on already?
6889 JP NZ,$6390 Terminate this interruptible subcommand if so
688C LD A,H A=character's number
688D LD (BC),A Signal: this character wrote on the board
688E DEC C Point BC at the first byte of the board's buffer (7F54, 7F5A, 7F60, 7F66 or 7F6C) and initialise the pixel column to 1
688F LD A,$01
6891 LD (BC),A
6892 LD L,$10 Make sure there are no (sub)submessage addresses lying around in bytes 0x0D-0x10 of the character's buffer
6894 LD (HL),$00
6896 LD L,$0E
6898 LD (HL),$00
689A LD A,H A=character's number (0xC9-0xCC, 0xCE)
689B CP $CE Set E as follows: 0x20=MR WITHIT, 0x26=MR ROCKITT, 0x2C=MR CREAK, 0x32=MISS TAKE, 0x38=BOY WANDER
689D ADC A,$3B
689F LD E,A
68A0 ADC A,A
68A1 ADD A,E
68A2 ADD A,A
68A3 LD E,A
68A4 CALL $6291 Collect a random number between 0 and 5 in A
68A7 AND $07
68A9 CP $06
68AB JR NC,$68A4
68AD ADD A,E Now E=blackboard message number
68AE LD E,A
68AF LD D,$FE Pick up the address of the message and place it into bytes 0x0B and 0x0C of the character's buffer
68B1 LD L,$0B
68B3 LD A,(DE)
68B4 LD (HL),A
68B5 INC D
68B6 INC L
68B7 LD A,(DE)
68B8 LD (HL),A
68B9 LD L,$09 Replace the address of this routine in bytes 0x09 and 0x0A of the character's buffer with 68BD (below)
68BB LD (HL),$BD
68BD CALL $6791 Write one letter on the board
68C0 JR NZ,$68CD Jump unless the character has finished writing
This entry point is used by the routine at 6D00.
68C2 CALL $61B4 Update the SRB for the character's current animatory state and location
68C5 AND $F8 A=base animatory state of the character (arm down)
68C7 CALL $6130 Update the character's animatory state and update the SRB
68CA JP $6390 Terminate this interruptible subcommand
The character hasn't finished writing yet. Figure out his next arm movement (up or down).
68CD CALL $61B4 Update the SRB for the character's current animatory state and location
68D0 RRCA Set the carry flag if the character's arm is raised
68D1 RLCA
68D2 JR C,$68D9 Jump if the character's arm is raised
68D4 OR $07 A=animatory state of the character with his arm up
68D6 JP $6130 Update the character's animatory state and location and update the SRB
68D9 AND $F8 A=base animatory state of character (arm down)
68DB JR $68D6 Jump back to update the SRB
Prev: 687E Up: Map Next: 68DD