![]() |
Routines |
| Prev: 7128 | Up: Map | Next: 71D1 |
|
Used by the routine at 7264. Returns with the zero flag set if the end of the message has been reached.
|
||||||||
| 7142 | CALL $70D2 | A=next character in the message being written | ||||||
| 7145 | LD B,A | Save this in B briefly | ||||||
| 7146 | CALL $7128 | A=identifier of the blackboard being written on | ||||||
| 7149 | LD C,A | Transfer this to C | ||||||
| 714A | LD A,B | A=next character in the message being written | ||||||
| 714B | LD B,$7F | Point BC at the appropriate blackboard buffer | ||||||
| 714D | AND A | Is the message finished? | ||||||
| 714E | JR NZ,$7154 | Jump if not | ||||||
| 7150 | DEC A | A=0xFF | ||||||
| 7151 | LD (BC),A | Store the pixel coordinates of the next character to be written on the board | ||||||
| 7152 | INC A | Set the zero flag if the message is finished | ||||||
| 7153 | RET | |||||||
|
The character has not finished writing on the blackboard. A holds the ASCII code of the next letter to be written.
|
||||||||
| 7154 | CP $02 | Is it newline? | ||||||
| 7156 | JR NZ,$715F | Jump if not | ||||||
| 7158 | LD A,(BC) | Pick up the contents of 7FEC (Reading Room blackboard), 7FEE (White Room blackboard) or 7FF0 (Exam Room blackboard) and set it to 0 (start of top line) or 64 (start of bottom line) | ||||||
| 7159 | AND $40 | |||||||
| 715B | XOR $40 | |||||||
| 715D | JR $7151 | |||||||
| 715F | PUSH HL | |||||||
| 7160 | LD L,A | Point HL at the address holding the pixel width of the character to be written on the board | ||||||
| 7161 | LD H,$D9 | |||||||
| 7163 | LD A,(BC) | A=pixel coordinates (0-127) of the location at which the character will be written | ||||||
| 7164 | AND $3F | Discard bit 6 (the line indicator bit) | ||||||
| 7166 | ADD A,$C0 | Set the carry flag if there is not enough space at the end of the current line to print the character | ||||||
| 7168 | SCF | |||||||
| 7169 | ADC A,(HL) | |||||||
| 716A | LD A,(BC) | A=pixel coordinates (0-127) | ||||||
| 716B | JR NC,$7172 | Jump if there is enough space to print the character on the current line | ||||||
| 716D | AND $40 | Otherwise toggle which line (top or bottom) to write on and reset the pixel x-coordinate to 0 (start of the line) | ||||||
| 716F | XOR $40 | |||||||
| 7171 | LD (BC),A | |||||||
| 7172 | RRCA | Compute the skool coordinates of the location of the character to be written and store them in DE | ||||||
| 7173 | RRCA | |||||||
| 7174 | RRCA | |||||||
| 7175 | AND $0F | |||||||
| 7177 | CP $08 | |||||||
| 7179 | JR C,$717E | |||||||
| 717B | INC D | |||||||
| 717C | AND $07 | |||||||
| 717E | ADD A,E | |||||||
| 717F | LD E,A | |||||||
| 7180 | CALL $7087 | Update the screen refresh buffer for these coordinates | ||||||
| 7183 | LD A,(BC) | Modify the RES n,(HL) instruction at 71AE below, which in effect draws a white pixel (of chalk) at the appropriate spot | ||||||
| 7184 | AND $07 | |||||||
| 7186 | ADD A,A | |||||||
| 7187 | ADD A,A | |||||||
| 7188 | ADD A,A | |||||||
| 7189 | CPL | |||||||
| 718A | SUB $41 | |||||||
| 718C | LD ($71AF),A | |||||||
| 718F | LD A,(BC) | Compute the pixel x-coordinate (0-63) of the rightmost pixel column of the character to be written on the board, and store it in the blackboard buffer | ||||||
| 7190 | ADD A,(HL) | |||||||
| 7191 | INC A | |||||||
| 7192 | LD (BC),A | |||||||
| 7193 | LD C,(HL) | C=pixel width of the character to be written on the board | ||||||
| 7194 | EX DE,HL | Point HL at the skool UDG reference of the character square of the blackboard that will be written on and pick it up in L | ||||||
| 7195 | LD A,(HL) | |||||||
| 7196 | LD L,A | |||||||
|
Now we enter the loop that draws the pixel columns of the font character bitmap onto the blackboard.
|
||||||||
| 7197 | LD H,$80 | Point HL at the graphic data for the skool UDG reference in A; the skool UDG references are 0xCE-0xBF for the Reading Room board, 0xEE-0xDF for the White Room board, and 0xDE-0xCF for the Exam Room board, decreasing from left to right | ||||||
| 7199 | CP $E9 | |||||||
| 719B | JR NC,$71A7 | |||||||
| 719D | CP $E7 | |||||||
| 719F | JR NC,$71A5 | |||||||
| 71A1 | CP $E1 | |||||||
| 71A3 | JR NC,$71A7 | |||||||
| 71A5 | LD H,$88 | |||||||
| 71A7 | INC D | A=next pixel column of the character to be written on the board | ||||||
| 71A8 | LD A,(DE) | |||||||
| 71A9 | LD B,$08 | There are 8 pixels in a pixel column | ||||||
| 71AB | RLCA | Draw the pixel column on the blackboard by directly resetting bits in the skool graphic data; any bits already reset by previous writing remain reset (the 'RES n,(HL)' instruction is modified earlier in this routine to reset the required bit) | ||||||
| 71AC | JR NC,$71B0 | |||||||
| 71AE | RES 7,(HL) | |||||||
| 71B0 | INC H | |||||||
| 71B1 | DJNZ $71AB | |||||||
| 71B3 | DEC C | Next pixel column | ||||||
| 71B4 | JR Z,$71CE | Jump if we've finished drawing the character on the board | ||||||
| 71B6 | LD A,H | Point HL back at the top pixel row of the skool UDG data | ||||||
| 71B7 | SUB $08 | |||||||
| 71B9 | LD H,A | |||||||
| 71BA | LD A,($71AF) | Modify the RES n,(HL) instruction at 71AE above to RES m,(HL) where m=n-1 (mod 8), effectively moving one pixel column to the right | ||||||
| 71BD | OR $40 | |||||||
| 71BF | SUB $08 | |||||||
| 71C1 | AND $BF | |||||||
| 71C3 | LD ($71AF),A | |||||||
| 71C6 | CP $BE | Did we wrap round from bit 0 to bit 7? | ||||||
| 71C8 | JR NZ,$71A7 | Continue drawing pixel columns in this character square if not | ||||||
| 71CA | DEC L | A=skool UDG reference of the next character square to the right on the blackboard | ||||||
| 71CB | LD A,L | |||||||
| 71CC | JR $7197 | Draw the next pixel column in the next character square | ||||||
| 71CE | INC C | Reset the zero flag to indicate that the message isn't finished | ||||||
| 71CF | POP HL | Restore the character number to H | ||||||
| 71D0 | RET | |||||||
| Prev: 7128 | Up: Map | Next: 71D1 |