Routines |
Prev: F5B7 | Up: Map | Next: F6B4 |
Used by the routine at F6D5. First of all, wipe the blackboards clean.
|
||||
F5BE | LD H,$87 | The blackboards use UDGs 0x00-0x4F (0x00-0x0F for the Blue Room board, 0x10-0x1F for the Yellow Room, 0x20-0x2F for the top-floor room in the girls' skool, 0x30-0x3F for the Science Lab, and 0x40-0x4F for the middle-floor room in the girls' skool) with base page 0x80; wipe them clean by setting every byte of graphic data for these UDGs to 0xFF | ||
F5C0 | LD C,$08 | |||
F5C2 | XOR A | |||
F5C3 | LD L,A | |||
F5C4 | LD B,$50 | |||
F5C6 | LD (HL),$FF | |||
F5C8 | INC L | |||
F5C9 | DJNZ $F5C6 | |||
F5CB | DEC H | |||
F5CC | DEC C | |||
F5CD | JR NZ,$F5C3 | |||
Next, clean up the game status buffer.
|
||||
F5CF | LD L,$00 | Clear the first 222 bytes of the game status buffer | ||
F5D1 | LD B,$DE | |||
F5D3 | LD (HL),A | |||
F5D4 | INC L | |||
F5D5 | DJNZ $F5D3 | |||
Reset various counters, flags and identifiers.
|
||||
F5D7 | LD L,$E0 | Set the lesson descriptor at 7FE0 to 0 (for no good reason: it will be set again by the routine at F74D when demo mode or a new game starts) | ||
F5D9 | LD (HL),A | |||
F5DA | INC L | Reset the number of mice caught at 7FE1 | ||
F5DB | LD (HL),A | |||
F5DC | INC L | Reset the number of kisses available from HAYLEY at 7FE2 | ||
F5DD | LD (HL),$28 | |||
F5DF | INC L | Set the lesson clock at 7FE3 to 1 (so the bell will ring straight away) | ||
F5E0 | LD (HL),$01 | |||
F5E2 | INC L | |||
F5E3 | LD (HL),A | |||
F5E4 | LD L,$EB | Reset the inventory flags at 7FEB | ||
F5E6 | LD (HL),A | |||
F5E7 | LD L,$ED | Clear the game status buffer from 7FED to 7FFB | ||
F5E9 | LD B,$0F | |||
F5EB | LD (HL),A | |||
F5EC | INC L | |||
F5ED | DJNZ $F5EB | |||
F5EF | LD (HL),$D6 | 7FFC holds the number of the last character moved; set this to 0xD6 so it immediately rewinds to 0xB7 (little boy no. 1) | ||
F5F1 | LD L,$FF | HL=7FFF (leftmost column of the play area on screen) | ||
F5F3 | LD (HL),A | Set this to 0 | ||
F5F4 | LD L,$DF | HL=7FDF (current lesson number) | ||
F5F6 | LD A,(HL) | Pick this up in A (0xC0-0xFF) | ||
F5F7 | OR $07 | Make sure the first lesson of the new game will be PLAYTIME | ||
F5F9 | LD (HL),A | |||
F5FA | CALL $6CD4 | Prepare the doors, windows, cups and bike | ||
F5FD | LD L,$F3 | HL=7FF3 (ERIC's main action timer) | ||
F5FF | LD (HL),$01 | Initialise this to 1 | ||
Set up the bike and storeroom combinations.
|
||||
F601 | LD C,$08 | 4 numbers in each of the 2 combinations | ||
F603 | LD L,$9C | HL=7F9C (combinations) | ||
F605 | CALL $6291 | Generate new bike and Science Lab storeroom combinations | ||
F608 | LD B,A | |||
F609 | CALL $6291 | |||
F60C | DJNZ $F609 | |||
F60E | LD (HL),A | |||
F60F | INC L | |||
F610 | DEC C | |||
F611 | JR NZ,$F605 | |||
F613 | LD L,$9C | HL=7F9C (combinations) | ||
F615 | LD B,$04 | There are 4 digits in the bike combination | ||
F617 | LD C,$2F | 0x2F+0x01=0x30 (ASCII code for '0') | ||
F619 | LD A,(HL) | A=random number collected earlier | ||
F61A | INC C | C=ASCII code of the number INT(A/0x1A) | ||
F61B | SUB $1A | |||
F61D | JR NC,$F61A | |||
F61F | LD (HL),C | Put the bike combination digit in place | ||
F620 | INC L | Point HL at the next digit slot | ||
F621 | DJNZ $F617 | Jump back until all four digits are done | ||
F623 | LD B,$04 | There are 4 letters in the storeroom combination | ||
F625 | LD C,$40 | 0x40+0x01=0x41 (ASCII code for 'A') | ||
F627 | LD A,(HL) | A=random number collected earlier | ||
F628 | INC C | C=ASCII code of the Nth letter of the alphabet (where N=1+INT(A/0x0A)) | ||
F629 | SUB $0A | |||
F62B | JR NC,$F628 | |||
F62D | LD (HL),C | Put the storeroom combination letter in place | ||
F62E | INC L | Point HL at the next letter slot | ||
F62F | DJNZ $F625 | Jump back until all four letters are done | ||
F631 | LD DE,$7F9C | Set HL to 7F9C and DE to 7FA4 | ||
F634 | EX DE,HL | |||
F635 | LD C,$08 | Copy the bike combination to 7FA4 and the storeroom combination to 7FA8 | ||
F637 | LDIR | |||
Place the game characters in their initial positions.
|
||||
F639 | LD B,$20 | There are 32 game characters (0xB7-0xD6) | ||
F63B | LD H,$B7 | 0xB7=little girl no. 1 | ||
F63D | LD D,H | |||
F63E | PUSH BC | |||
F63F | LD L,$20 | Collect the initial animatory state and location of the character from bytes 0x20-0x22 of the character's buffer and copy them into bytes 0x00-0x02 | ||
F641 | XOR A | |||
F642 | LD E,A | |||
F643 | LD BC,$0003 | |||
F646 | LDIR | |||
F648 | EX DE,HL | |||
F649 | LD (HL),$24 | Place the address of the routine at D224 (RET) into bytes 0x03 and 0x04 of the character's buffer (thus making it the character's primary command; this is useful only for the non-human characters, which do not use command lists and therefore need a default primary command) | ||
F64B | INC L | |||
F64C | LD (HL),$D2 | |||
F64E | INC L | L=0x05 | ||
F64F | EX DE,HL | |||
F650 | LD B,$18 | Zero out bytes 0x05-0x1C of the character's buffer | ||
F652 | LD (DE),A | |||
F653 | INC E | |||
F654 | DJNZ $F652 | |||
F656 | LDI | Copy byte 0x23 into byte 0x1D | ||
F658 | LD A,H | A=character number (0xB7-0xD6) | ||
F659 | AND $0F | Initialise the walking speed change delay counter at byte 0x1E of the character's buffer | ||
F65B | LD (DE),A | |||
F65C | POP BC | |||
F65D | INC H | Next character | ||
F65E | DJNZ $F63D | Jump back until all the characters have been initialised | ||
Set up a free mouse.
|
||||
F660 | LD HL,$7A16 | Routine at 7A16: control mouse | ||
F663 | LD ($D411),HL | Place this uninterruptible subcommand routine address into bytes 0x11 and 0x12 of the mouse's buffer | ||
F666 | LD HL,$0101 | Set bytes 0x14 and 0x15 of the mouse's buffer to 1; this has the effect of making the mouse hide initially | ||
F669 | LD ($D414),HL | |||
Clear the screen.
|
||||
F66C | LD HL,$4000 | Clear the display file | ||
F66F | LD (HL),L | |||
F670 | LD DE,$4001 | |||
F673 | LD BC,$1800 | |||
F676 | LDIR | |||
F678 | LD (HL),$07 | PAPER 0: INK 7 | ||
F67A | LD B,$03 | |||
F67C | LDIR | |||
Prepare the bottom three lines of the screen.
|
||||
F67E | LD HL,$E728 | The graphic data for the BTS logo is at E728 | ||
F681 | LD DE,$5AB8 | Point DE at the appropriate attribute file address | ||
F684 | CALL $6AE4 | Print the BTS logo | ||
F687 | LD HL,$E628 | The graphic data for the score box is at E628 | ||
F68A | LD DE,$5AA0 | Point DE at the appropriate attribute file address | ||
F68D | CALL $6AE4 | Print the Score/Lines/Hi-score box | ||
F690 | LD HL,($7FE9) | Collect the hi-score from 7FE9 into DE | ||
F693 | EX DE,HL | |||
F694 | LD HL,$51E4 | Point HL at the appropriate display file address | ||
F697 | CALL $73AD | Print the hi-score | ||
F69A | XOR A | Print the score (0) | ||
F69B | CALL $73B5 | |||
F69E | XOR A | Print the lines total (0) | ||
F69F | CALL $73CB | |||
F6A2 | LD A,$58 | When the game begins, the leftmost column of the play area on screen will be 88+32=120 | ||
F6A4 | LD ($7FFF),A | |||
Scroll the play area onto the screen and play the theme tune.
|
||||
F6A7 | LD B,$04 | There are 4 quarters to scroll on | ||
F6A9 | PUSH BC | |||
F6AA | CALL $61C2 | Scroll on a quarter | ||
F6AD | POP BC | |||
F6AE | DJNZ $F6A9 | Jump back until all 4 quarters have been scrolled on | ||
F6B0 | CALL $5F9D | Play the theme tune | ||
F6B3 | RET |
Prev: F5B7 | Up: Map | Next: F6B4 |