Prev: $31EA Up: Map Next: $3279
$322E: Update the SRB for a character's current animatory state and location
This corresponds to $6214 in the ZX Spectrum version.
$322E LDY $26 Pick up the character's animatory state from $26.
$3230 LDA #$00 Prepare to address the animatory state tile references at $8D00 onwards.
$3232 STA $50
$3234 LDA #$8D
$3236 STA $51
$3238 LDA $FC Pick up the character's x-coordinate from $FC and store it at $57. This is the initial play area x-coordinate.
$323A STA $57
Here we enter a loop to consider each tile of the character's sprite that is currently on screen, working column by column from left to right.
$323C LDA $FB Pick up the character's y-coordinate from $FB and store it at $4A. This is the initial play area y-coordinate.
$323E STA $4A
$3240 LDA $57 Pick up the play area x-coordinate from $57.
$3242 CMP $58 Is it less than the x-coordinate of the leftmost column of the skool on screen?
$3244 BCS $3249 Branch if not.
$3246 JMP $3269 Otherwise jump forward to consider the next column of tiles in the character's sprite.
$3249 CMP $59 Is the play area x-coordinate less than the x-coordinate of the leftmost column of the skool off screen?
$324B BCS $3269 Branch if not to consider the next column of tiles in the character's sprite (which will also be off screen).
$324D LDX #$04 There are four rows of tiles in a character's sprite.
$324F LDY $26 Pick up the character's animatory state from $26.
$3251 LDA ($50),Y Pick up an animatory state tile reference.
$3253 BEQ $325F Branch if it's zero (i.e. the blank tile).
$3255 LDA $57 Pick up the play area x-coordinate from $57.
$3257 SEC Subtract the x-coordinate of the leftmost column of the skool on screen to obtain the screen x-coordinate, and store it at $49.
$3258 SBC $58
$325A STA $49
$325C JSR $36E3 Update the SRB for the character cell containing this sprite tile.
$325F INC $51 Point at the animatory state tile references for the next row of tiles in the character's sprite.
$3261 INC $4A Increment the play area y-coordinate at $4A.
$3263 DEX Decrement the tile row counter.
$3264 BNE $324F Branch back until all four tiles in this column have been checked.
$3266 JMP $3270 Jump forward.
$3269 LDA $51 Add 4 to the MSB of the animatory state tile reference address at $51. This now points at the first tile in the next column to the right.
$326B CLC
$326C ADC #$04
$326E STA $51
$3270 INC $57 Increment the play area x-coordinate at $57. This now corresponds to the tiles in the next column to the right.
$3272 LDA $51 Pick up the animatory state tile reference address MSB.
$3274 CMP #$99 Have we done every tile in the sprite yet?
$3276 BCC $323C Branch back if not.
$3278 RTS
Prev: $31EA Up: Map Next: $3279