| Routines

61F8: Scroll the screen right 8 columns

Used by the routine at 6E00.
61F8 | LD B,$08 | 8 columns will be scrolled on
61FA | PUSH BC | Save the column counter
61FB | LD HL,$5A9E | First shift the attributes one place to the right
61FE | LD DE,$5A9F
6201 | LD BC,$029F
6204 | LDDR
6206 | CALL $F849 | Scroll the display file one character square to the right
6209 | DEC A | Adjust the leftmost column of the play area now on screen (held at 7FFF)
620A | LD ($7FFF),A
620D | LD HL,$1400 | H=20 (bottom row of the screen), L=0 (column at the far left)
6210 | PUSH HL |
6211 | CALL $606C | Print the play area character square at row H, column L=0
6214 | POP HL |
6215 | DEC H | Next row up
6216 | JP P,$6210 | Jump back until all 21 squares in the column have been printed
6219 | POP BC | Restore the column counter to B
621A | DJNZ $61FA | Jump back until 8 columns have been scrolled on
The screen has been scrolled right 8 columns. Check whether any of the minor characters may be teleported without us noticing.
621C | LD A,($7FFF) | A=leftmost column of the play area now on screen
621F | LD B,$04 | 4 little girls, starting with 0xBA=little girl no. 4
6221 | LD H,$BA
6223 | CP $70 | Was the skool gate in the middle of the screen before scrolling?
6225 | JR Z,$622E | Jump if so (to consider teleporting little girls 4-7)
6227 | CP $48 | Was the boys' skool door in the middle of the screen before scrolling?
6229 | RET NZ | Return if not
622A | LD H,$B7 | 0xB7=little girl no. 1
The next section of code moves certain off-screen minor characters straight to their destination. Sneaky! This entry point is used by the routine at 61C2 with H=0xBE (little boy no. 1).
622C | LD B,$03 |
This entry point is used by the routines at 61C2 (with H=0xC1, B=5) and F74D.
622E | LD L,$1D | Bit 3 of byte 0x1D is set if the character should be moved immediately to the next destination in his command list
6230 | BIT 3,(HL)
6232 | JR Z,$625E | Jump if this character should not be 'teleported'
6234 | RES 3,(HL) | Reset bit 3 now, so that this character is not considered for teleportation again during this lesson
6236 | DEC L | L=0x1C
6237 | LD D,(HL) | Collect the address reached in the command list into DE
6238 | DEC L
6239 | LD E,(HL)
623A | LD A,(DE) | A=LSB of this address
623B | SUB $64 | Is this the address of the routine at 6464?
623D | JR NZ,$625E | Jump if not
623F | DEC L | L=0x1A
6240 | INC DE | Point DE at the location coordinates (the parameters of 6464 in the command list)
6241 | INC DE
6242 | LD (HL),D | Store this address in bytes 0x19 and 0x1A of the character's buffer
6243 | DEC L
6244 | LD (HL),E
6245 | DEC L | L=0x18
6246 | LD (HL),A | Fill bytes 0x01-0x18 of the character's buffer with zeroes
6247 | DEC L
6248 | JR NZ,$6246
624A | LD A,(HL) | Set the character's animatory state to its base value (cancelling any midstride or knockout)
624B | AND $F8
624D | LD (HL),A
624E | INC L | L=0x01
624F | CALL $6264 | Bring the location coordinates from the command list into bytes 0x01 and 0x02 of the buffer, effecting the teleportation
6252 | LD E,(HL) | Collect the character's new coordinates into DE
6253 | INC L
6254 | LD D,(HL)
6255 | LD L,$05 | Copy these coordinates into bytes 0x05 and 0x06 of the buffer, which normally hold the character's destination; this is to let the routine at 6464 know it has nothing left to do
6257 | LD (HL),E
6258 | INC L
6259 | LD (HL),D
625A | LD L,$1D | Reset bit 0 of byte 0x1D, cancelling any pending request to restart the command list
625C | RES 0,(HL)
625E | INC H | Next character
625F | DJNZ $622E | Jump back until all characters have been done
6261 | RET |