![]() |
Routines |
| Prev: $3279 | Up: Map | Next: $33BF |
|
||||||||||
| $3326 | JSR $2EE6 | Compute the screen bitmap and colour information addresses for the play area tile and place them at $5A and $5C. | ||||||||
|
This entry point is used by the routine at $2F8C.
|
||||||||||
| $3329 | LDA $27 | Copy the play area x-coordinate to $52. This is the LSB of the base address from which the play area tile reference and colour information can be found. | ||||||||
| $332B | STA $52 | |||||||||
| $332D | AND #$60 | Keep only bits 5 and 6, shift them into bits 3 and 4, add $67 and store the result ($67, $6F or $77) at $55. This is the MSB of the address of the eighth byte in the skool tile at the given play area coordinates. | ||||||||
| $332F | LSR A | |||||||||
| $3330 | LSR A | |||||||||
| $3331 | CLC | |||||||||
| $3332 | ADC #$67 | |||||||||
| $3334 | STA $55 | |||||||||
| $3336 | LDA $28 | Pick up the play area y-coordinate, add $78 and store the result at $53. This is the MSB of the address at which the play area tile reference and colour information can be found. | ||||||||
| $3338 | CLC | |||||||||
| $3339 | ADC #$78 | |||||||||
| $333B | STA $53 | |||||||||
| $333D | LDY #$80 | Copy the colour information byte to the screen. | ||||||||
| $333F | LDA ($52),Y | |||||||||
| $3341 | LDY #$00 | |||||||||
| $3343 | STA ($5C),Y | |||||||||
| $3345 | LDA ($52),Y | Pick up the skool tile reference and store it at $54. This is the LSB of the address of the skool tile graphic data. | ||||||||
| $3347 | STA $54 | |||||||||
| $3349 | LDX #$07 | Copy the skool tile graphic bytes into the buffer at $4000. | ||||||||
| $334B | LDA ($54),Y | |||||||||
| $334D | STA $4000,X | |||||||||
| $3350 | DEC $55 | |||||||||
| $3352 | DEX | |||||||||
| $3353 | BPL $334B | |||||||||
|
The back buffer at $4000 now contains a copy of the skool tile at the given coordinates. Time to superimpose the tiles of any character sprites at the same location.
|
||||||||||
| $3355 | STY $50 | The vector at $50 will be used to address sprite tile graphic data. Set the LSB to 0 now. | ||||||||
| $3357 | LDA #$60 | Prepare to address the character buffers, starting with little boy no. 1's at $7860. | ||||||||
| $3359 | STA $52 | |||||||||
| $335B | LDA #$78 | |||||||||
| $335D | STA $53 | |||||||||
| $335F | LDX #$EB | X will count the characters. | ||||||||
| $3361 | LDY #$01 | Y=1, pointing at the character's x-coordinate. | ||||||||
| $3363 | LDA $27 | Pick up the play area x-coordinate from $27. | ||||||||
| $3365 | SEC | Subtract the character's x-coordinate. | ||||||||
| $3366 | SBC ($52),Y | |||||||||
| $3368 | CMP #$03 | Is the result less than 3? | ||||||||
| $336A | BCS $33B0 | Branch if not. | ||||||||
| $336C | ASL A | Multiply by 4 and store the result (0, 4, 8) at $55. This indicates the column (left, middle, right) of the character's sprite that aligns with the play area x-coordinate. | ||||||||
| $336D | ASL A | |||||||||
| $336E | STA $55 | |||||||||
| $3370 | LDA $28 | Pick up the play area y-coordinate from $28. | ||||||||
| $3372 | INY | Y=2, pointing at the character's y-coordinate. | ||||||||
| $3373 | SEC | Subtract the character's y-coordinate from the play area y-coordinate. | ||||||||
| $3374 | SBC ($52),Y | |||||||||
| $3376 | CMP #$04 | Is the result less than 4? | ||||||||
| $3378 | BCS $33B0 | Branch if not. | ||||||||
| $337A | ADC $55 | Add this y-coordinate difference (0, 1, 2, 3) and $8D to $55 to get the MSB of the relevant animatory state tile reference. | ||||||||
| $337C | ADC #$8D | |||||||||
| $337E | STA $55 | |||||||||
| $3380 | LDY #$00 | Y=0, pointing at the character's animatory state. | ||||||||
| $3382 | LDA ($52),Y | Pick up the character's animatory state and store it at $54. This is the LSB of the address of the animatory state tile reference. | ||||||||
| $3384 | STA $54 | |||||||||
| $3386 | LDA ($54),Y | Pick up a tile reference for the character's animatory state. | ||||||||
| $3388 | BEQ $33B0 | Branch if it's zero (the blank tile). | ||||||||
| $338A | TAY | Transfer the tile reference to Y. | ||||||||
| $338B | TXA | Save the character counter temporarily. | ||||||||
| $338C | PHA | |||||||||
| $338D | LDA #$A8 | The sprite graphic data for the boys and the catapult pellet is in pages $99-$A8. | ||||||||
| $338F | CPX #$F6 | Are we still dealing with little boys 1-11? | ||||||||
| $3391 | BCC $3399 | Branch if so. | ||||||||
| $3393 | CPX #$FA | Are we dealing with a teacher? | ||||||||
| $3395 | BCS $3399 | Branch if not. | ||||||||
| $3397 | LDA #$B8 | The sprite graphic data for the teachers is in pages $A9-$B8. | ||||||||
| $3399 | STA $51 | Set the MSB of the sprite tile graphic data address at $51. | ||||||||
| $339B | LDX #$07 | X will count the bytes in sprite tile. | ||||||||
| $339D | LDA ($50),Y | Modify a byte of the tile in the back buffer at $4000 by superimposing a sprite tile byte (using a mask). | ||||||||
| $339F | AND $4000,X | |||||||||
| $33A2 | DEC $51 | |||||||||
| $33A4 | ORA ($50),Y | |||||||||
| $33A6 | STA $4000,X | |||||||||
| $33A9 | DEC $51 | Point at the next sprite tile mask byte. | ||||||||
| $33AB | DEX | Have we superimposed the entire sprite tile yet? | ||||||||
| $33AC | BPL $339D | Branch back if not. | ||||||||
| $33AE | PLA | Restore the character counter to X. | ||||||||
| $33AF | TAX | |||||||||
| $33B0 | INC $53 | Next character buffer. | ||||||||
| $33B2 | INX | Have we checked every character yet? | ||||||||
| $33B3 | BNE $3361 | Branch back if not. | ||||||||
|
The tile in the back buffer at $4000 now consists of the skool tile with all relevant sprite tiles superimposed.
|
||||||||||
| $33B5 | LDY #$07 | Copy the tile from the back buffer to the screen. | ||||||||
| $33B7 | LDA ($5E),Y | |||||||||
| $33B9 | STA ($5A),Y | |||||||||
| $33BB | DEY | |||||||||
| $33BC | BPL $33B7 | |||||||||
| $33BE | RTS | |||||||||
| Prev: $3279 | Up: Map | Next: $33BF |