![]() |
Routines |
| Prev: 28968 | Up: Map | Next: 29137 |
|
Used by the routine at 29284. Returns with the zero flag set if the end of the message has been reached.
|
||||||||
| 28994 | CALL 28882 | A=next character in the message being written | ||||||
| 28997 | LD B,A | Save this in B briefly | ||||||
| 28998 | CALL 28968 | A=identifier of the blackboard being written on | ||||||
| 29001 | LD C,A | Transfer this to C | ||||||
| 29002 | LD A,B | A=next character in the message being written | ||||||
| 29003 | LD B,127 | Point BC at the appropriate blackboard buffer | ||||||
| 29005 | AND A | Is the message finished? | ||||||
| 29006 | JR NZ,29012 | Jump if not | ||||||
| 29008 | DEC A | A=255 | ||||||
| 29009 | LD (BC),A | Store the pixel coordinates of the next character to be written on the board | ||||||
| 29010 | INC A | Set the zero flag if the message is finished | ||||||
| 29011 | RET | |||||||
|
The character has not finished writing on the blackboard. A holds the ASCII code of the next letter to be written.
|
||||||||
| 29012 | CP 2 | Is it newline? | ||||||
| 29014 | JR NZ,29023 | Jump if not | ||||||
| 29016 | LD A,(BC) | Pick up the contents of 32748 (Reading Room blackboard), 32750 (White Room blackboard) or 32752 (Exam Room blackboard) and set it to 0 (start of top line) or 64 (start of bottom line) | ||||||
| 29017 | AND 64 | |||||||
| 29019 | XOR 64 | |||||||
| 29021 | JR 29009 | |||||||
| 29023 | PUSH HL | |||||||
| 29024 | LD L,A | Point HL at the address holding the pixel width of the character to be written on the board | ||||||
| 29025 | LD H,217 | |||||||
| 29027 | LD A,(BC) | A=pixel coordinates (0-127) of the location at which the character will be written | ||||||
| 29028 | AND 63 | Discard bit 6 (the line indicator bit) | ||||||
| 29030 | ADD A,192 | Set the carry flag if there is not enough space at the end of the current line to print the character | ||||||
| 29032 | SCF | |||||||
| 29033 | ADC A,(HL) | |||||||
| 29034 | LD A,(BC) | A=pixel coordinates (0-127) | ||||||
| 29035 | JR NC,29042 | Jump if there is enough space to print the character on the current line | ||||||
| 29037 | AND 64 | Otherwise toggle which line (top or bottom) to write on and reset the pixel x-coordinate to 0 (start of the line) | ||||||
| 29039 | XOR 64 | |||||||
| 29041 | LD (BC),A | |||||||
| 29042 | RRCA | Compute the skool coordinates of the location of the character to be written and store them in DE | ||||||
| 29043 | RRCA | |||||||
| 29044 | RRCA | |||||||
| 29045 | AND 15 | |||||||
| 29047 | CP 8 | |||||||
| 29049 | JR C,29054 | |||||||
| 29051 | INC D | |||||||
| 29052 | AND 7 | |||||||
| 29054 | ADD A,E | |||||||
| 29055 | LD E,A | |||||||
| 29056 | CALL 28807 | Update the screen refresh buffer for these coordinates | ||||||
| 29059 | LD A,(BC) | Modify the RES n,(HL) instruction at 29102 below, which in effect draws a white pixel (of chalk) at the appropriate spot | ||||||
| 29060 | AND 7 | |||||||
| 29062 | ADD A,A | |||||||
| 29063 | ADD A,A | |||||||
| 29064 | ADD A,A | |||||||
| 29065 | CPL | |||||||
| 29066 | SUB 65 | |||||||
| 29068 | LD (29103),A | |||||||
| 29071 | 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 | ||||||
| 29072 | ADD A,(HL) | |||||||
| 29073 | INC A | |||||||
| 29074 | LD (BC),A | |||||||
| 29075 | LD C,(HL) | C=pixel width of the character to be written on the board | ||||||
| 29076 | 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 | ||||||
| 29077 | LD A,(HL) | |||||||
| 29078 | LD L,A | |||||||
|
Now we enter the loop that draws the pixel columns of the font character bitmap onto the blackboard.
|
||||||||
| 29079 | LD H,128 | Point HL at the graphic data for the skool UDG reference in A; the skool UDG references are 206-191 for the Reading Room board, 238-223 for the White Room board, and 222-207 for the Exam Room board, decreasing from left to right | ||||||
| 29081 | CP 233 | |||||||
| 29083 | JR NC,29095 | |||||||
| 29085 | CP 231 | |||||||
| 29087 | JR NC,29093 | |||||||
| 29089 | CP 225 | |||||||
| 29091 | JR NC,29095 | |||||||
| 29093 | LD H,136 | |||||||
| 29095 | INC D | A=next pixel column of the character to be written on the board | ||||||
| 29096 | LD A,(DE) | |||||||
| 29097 | LD B,8 | There are 8 pixels in a pixel column | ||||||
| 29099 | 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) | ||||||
| 29100 | JR NC,29104 | |||||||
| 29102 | RES 7,(HL) | |||||||
| 29104 | INC H | |||||||
| 29105 | DJNZ 29099 | |||||||
| 29107 | DEC C | Next pixel column | ||||||
| 29108 | JR Z,29134 | Jump if we've finished drawing the character on the board | ||||||
| 29110 | LD A,H | Point HL back at the top pixel row of the skool UDG data | ||||||
| 29111 | SUB 8 | |||||||
| 29113 | LD H,A | |||||||
| 29114 | LD A,(29103) | Modify the RES n,(HL) instruction at 29102 above to RES m,(HL) where m=n-1 (mod 8), effectively moving one pixel column to the right | ||||||
| 29117 | OR 64 | |||||||
| 29119 | SUB 8 | |||||||
| 29121 | AND 191 | |||||||
| 29123 | LD (29103),A | |||||||
| 29126 | CP 190 | Did we wrap round from bit 0 to bit 7? | ||||||
| 29128 | JR NZ,29095 | Continue drawing pixel columns in this character square if not | ||||||
| 29130 | DEC L | A=skool UDG reference of the next character square to the right on the blackboard | ||||||
| 29131 | LD A,L | |||||||
| 29132 | JR 29079 | Draw the next pixel column in the next character square | ||||||
| 29134 | INC C | Reset the zero flag to indicate that the message isn't finished | ||||||
| 29135 | POP HL | Restore the character number to H | ||||||
| 29136 | RET | |||||||
| Prev: 28968 | Up: Map | Next: 29137 |