![]() |
Routines |
| Page(s) | Bytes | Contents | 128-135 | 0-255 | Skool UDGs | 136-143 | 0-255 | Skool UDGs | 144-151 | 0-255 | Skool UDGs (except bytes 1, 11, 21, 30) | 152-159 | 0-249 | Skool UDGs (except bytes 224-239) | 160-180 | 0-143 | LSBs of skool UDG base addresses | 144-179 | Skool UDB MSB indicator bit-pairs (see below) | 180-251 | Skool UDG BRIGHT/PAPER attribute nibbles | 181 | 0-191 | Q (0<=Q<=143; see below) |
|---|
| Data | Look at... | BRIGHT/PAPER | Nibble Q of bytes 180-251 in page Y+160 (or Y+161 if nibble Q in page Y+160 is 0) | INK | 0 if nibble Q in page Y+160 is not 0; 1, 2 or 3 as explained above otherwise | UDG LSB | Byte Q in page Y+160 | UDG MSB | Bit-pair Q of bytes 144-179 in page Y+160 |
|---|
| H | Screen row number (0-20) |
| L | Screen column number (0-31) |
| 24684 | PUSH HL | |
| 24685 | LD A,H | Compute the appropriate attribute file address in BC and the appropriate display file address in DE |
| 24686 | AND 24 | |
| 24688 | LD D,A | |
| 24689 | LD A,H | |
| 24690 | RRCA | |
| 24691 | RRCA | |
| 24692 | RRCA | |
| 24693 | LD H,A | |
| 24694 | AND 224 | |
| 24696 | ADD A,L | |
| 24697 | LD E,A | |
| 24698 | LD C,A | |
| 24699 | LD A,H | |
| 24700 | AND 3 | |
| 24702 | ADD A,88 | |
| 24704 | LD B,A | |
| 24705 | SET 6,D | |
| 24707 | EX DE,HL | Place the display file address on the stack and get (row,col) back in HL |
| 24708 | EX (SP),HL | |
| 24709 | LD A,(32767) | A=leftmost column of play area on screen (0-160) |
| 24712 | ADD A,L | L=X: column of play area corresponding to the character square under consideration (0-191) |
| 24713 | LD L,A | |
| 24714 | PUSH HL | Push the skool coordinates (X,Y) onto the stack |
| 24715 | LD A,H | A=Y (0-20) |
| 24716 | LD H,181 | HL=46336+X |
| 24718 | LD L,(HL) | L=Q (0<=Q<=143) |
| 24719 | ADD A,160 | H=Y+160 |
| 24721 | LD H,A | |
| 24722 | LD E,L | E=Q (0<=Q<=143) |
| 24723 | LD A,L | A=Q |
| 24724 | RRA | Is Q odd? |
| 24725 | JR C,24754 | Jump if so |
| 24727 | ADD A,180 | 180<=A<=251 |
| 24729 | LD L,A | Point HL at the attribute byte |
| 24730 | LD A,(HL) | Pick up the attribute byte in A |
| 24731 | AND 240 | The PAPER colour and BRIGHT status are in bits 4-7 |
| 24733 | RR A | Shift them into bits 3-6 |
| 24735 | JR NZ,24774 | Jump if this character square has INK 0 |
| 24737 | INC H | Point HL at the attribute byte in page Y+161 |
| 24738 | LD A,(HL) | Pick up the attribute byte in A |
| 24739 | AND 240 | The PAPER colour and BRIGHT status are in bits 4-7 |
| 24741 | RRA | Shift them into bits 3-6 |
| 24742 | LD L,A | L holds the PAPER colour and BRIGHT status |
| 24743 | LD A,E | A=Q (0<=Q<=143) |
| 24744 | AND 3 | A=0, 1, 2 or 3 |
| 24746 | JR NZ,24750 | Jump if the INK is blue, red, or magenta |
| 24748 | ADD A,2 | A=2: INK 2 (red) |
| 24750 | OR L | OR on the PAPER colour and BRIGHT status |
| 24751 | DEC H | H=Y+160 |
| 24752 | JR 24774 | Jump forward to transfer the attribute byte in A onto the screen |
| 24754 | ADD A,180 | 180<=A<=251 |
| 24756 | LD L,A | Point HL at the attribute byte |
| 24757 | LD A,(HL) | Pick up the attribute byte in A |
| 24758 | AND 15 | The PAPER colour and BRIGHT status are in bits 0-3 |
| 24760 | JR NZ,24771 | Jump if this character square has INK 0 |
| 24762 | INC H | Point HL at the attribute byte in page Y+161 |
| 24763 | LD A,(HL) | Pick up the attribute byte in A |
| 24764 | AND 15 | The PAPER colour and BRIGHT status are in bits 0-3 |
| 24766 | ADD A,A | Shift the PAPER and BRIGHT bits from bits 0-3 to bits 3-6 |
| 24767 | ADD A,A | |
| 24768 | ADD A,A | |
| 24769 | JR 24742 | Jump back to fill in the INK bits |
| 24771 | ADD A,A | Shift the PAPER and BRIGHT bits from bits 0-3 to bits 3-6, and set the INK to 0 |
| 24772 | ADD A,A | |
| 24773 | ADD A,A | |
| 24774 | LD (BC),A | Poke the attribute byte onto the screen (during startup this instruction is NOP; see 21408) |
| 24775 | LD L,E | L=Q (0<=Q<=143), H=Y+160 |
| 24776 | LD E,(HL) | E=LSB of skool UDG base address |
| 24777 | LD A,136 | A=10001000 |
| 24779 | SRL L | Shift A right (Q AND 3) times |
| 24781 | JR NC,24784 | |
| 24783 | RRCA | |
| 24784 | SRL L | |
| 24786 | JR NC,24790 | |
| 24788 | RRCA | |
| 24789 | RRCA | |
| 24790 | LD C,A | C=10001000, 01000100, 00100010 or 00010001 |
| 24791 | LD A,L | Point HL at the byte containing the MSB indicator bit-pair: H=Y+160, 144<=L=144+INT(Q/4)<=179 |
| 24792 | ADD A,144 | |
| 24794 | LD L,A | |
| 24795 | LD A,C | A=10001000, 01000100, 00100010 or 00010001 |
| 24796 | AND (HL) | Keep only the bits of the bit-pair |
| 24797 | LD D,128 | |
| 24799 | CP 16 | Are any of bits 4-7 in A set? |
| 24801 | JR C,24805 | Jump if not |
| 24803 | LD D,144 | |
| 24805 | AND 15 | Are any of bits 0-3 in A set? |
| 24807 | JR Z,24811 | Jump if not |
| 24809 | SET 3,D |
| 24811 | LD HL,57712 | We're going to copy the skool UDG into the 8-byte back buffer at 57712 |
| 24814 | LD B,8 | |
| 24816 | LD A,(DE) | A=skool UDG byte (during startup this instruction is XOR A; see 21408) |
| 24817 | INC D | Point DE at the next byte of the skool UDG |
| 24818 | LD (HL),A | Copy the skool UDG byte into the back buffer |
| 24819 | INC L | Move to the next slot in the back buffer |
| 24820 | DJNZ 24816 | Jump back until the entire skool UDG has been copied |
| 24822 | LD H,183 | 183=character number of little girl no. 1 |
| 24824 | POP DE | D=Y (0-20), E=X (0-191) |
| 24825 | LD A,(32767) | A=leftmost column of play area on screen (0-160) |
| 24828 | CP 120 | 120=roughly halfway between the tree and the gate |
| 24830 | JR C,24843 | Jump if columns 144 onwards (girls' skool + half the girls' playground) are off-screen |
| 24832 | LD B,7 | 7 little girls |
| 24834 | CALL 24576 | Superimpose graphic bytes for the little girls if necessary |
| 24837 | LD H,198 | 198=character number of little boy no. 9 |
| 24839 | LD B,17 | 2 little boys, 11 main characters, plus 211-214 |
| 24841 | JR 24862 | |
| 24843 | CP 80 | 80=assembly hall stage (or thereabouts) |
| 24845 | JR C,24858 | Jump if columns 104 onwards (everything to the right of the tree, roughly) are off-screen |
| 24847 | LD B,3 | 3 little girls (183-185) |
| 24849 | CALL 24576 | Superimpose graphic bytes for these little girls if necessary |
| 24852 | LD H,193 | 193=character number of little boy no. 4 |
| 24854 | LD B,22 | 7 little boys, 11 main characters, plus bike, frog and pellets |
| 24856 | JR 24862 | |
| 24858 | LD H,190 | 190=character number of little boy no. 1 |
| 24860 | LD B,25 | All 10 little boys, 11 main characters, plus bike, frog and pellets |
| 24862 | CALL 24576 | Superimpose graphic bytes for these characters if necessary |
| 24865 | LD HL,57712 | The 8-byte back buffer at 57712 now contains the UDG to be copied to the screen |
| 24868 | POP DE | Retrieve the appropriate display file address in DE |
| 24869 | LD B,8 | There are 8 bytes per character square |
| 24871 | LD A,(HL) | Transfer the graphic bytes to the screen |
| 24872 | LD (DE),A | |
| 24873 | INC L | |
| 24874 | INC D | |
| 24875 | DJNZ 24871 | |
| 24877 | RET |