Prev: $3072 Up: Map Next: $31B6
$3113: Shift the play area window right
Used by the routines at $3012 and $35EF.
$3113 SEI Disable interrupts.
$3114 LDA $59 Pick up the x-coordinate of the leftmost column of the skool off screen.
$3116 CMP #$59 Is it less than 89?
$3118 BCC $311D Branch if so.
$311A JMP $31B4 Otherwise return now.
$311D LDA #$08 Set the source colour information index at $54 to 8.
$311F STA $54
$3121 LDA #$00 Set the destination colour information index at $55 to 0.
$3123 STA $55
$3125 LDA #$00 Store $E000 at $5A. This screen bitmap address corresponds to the tile at the top left of the screen.
$3127 STA $5A
$3129 LDA #$E0
$312B STA $5B
$312D LDA #$00 Store $CC00 at $5C. This colour information address corresponds to the tile at the top left of the screen.
$312F STA $5C
$3131 LDA #$CC
$3133 STA $5D
$3135 LDX #$00 Initialise the column counter in X.
$3137 INX Increment the column counter in X.
$3138 TXA Save the column counter on the stack temporarily.
$3139 PHA
$313A LDA $5A Copy the screen bitmap address from $5A to $52. This will be the destination address.
$313C STA $52
$313E LDA $5B
$3140 STA $53
$3142 LDA $5C Copy the colour information address from $5C to $50. This will be the source address.
$3144 STA $50
$3146 LDA $5D
$3148 STA $51
$314A LDA $52 Copy the screen bitmap address from $52 to $4E.
$314C STA $4E
$314E LDA $53
$3150 STA $4F
$3152 LDA $4E Add 64 to the screen bitmap address at $4E. This corresponds to the tile that is 8 cells to the right in the same row, and will be the source address.
$3154 CLC
$3155 ADC #$40
$3157 BCC $315B
$3159 INC $4F
$315B STA $4E
$315D JSR $2FB6 Move a column of screen tiles left.
$3160 LDA $5A Add 8 to the destination screen bitmap address at $5A. This corresponds to the next tile to the right in the top row of the screen.
$3162 CLC
$3163 ADC #$08
$3165 BNE $3169
$3167 INC $5B
$3169 STA $5A
$316B INC $5C Increment the colour information address at $5C. This corresponds to the next tile to the right in the top row of the screen.
$316D PLA Restore the column counter to X.
$316E TAX
$316F CPX #$20 Have we moved 32 columns of screen tiles yet?
$3171 BNE $3137 Branch back if not.
The 32 rightmost columns of the skool on screen have been shifted left. Time to draw the rightmost 8 columns of the skool.
$3173 LDA #$00 Store $E100 at $5A. This screen bitmap address corresponds to the 33rd tile from the left in the top row.
$3175 STA $5A
$3177 LDA #$E1
$3179 STA $5B
$317B LDA #$20 Store $CC20 at $5C. This colour information address corresponds to the 33rd tile from the left in the top row.
$317D STA $5C
$317F NOP
$3180 JSR $98E8 Move sprites #0-#6 left by 64 pixels.
$3183 LDX #$08 There are 8 new play area columns to draw in the gap left by the shifting window.
$3185 TXA Save this column counter temporarily.
$3186 PHA
$3187 INC $58 Increment the x-coordinates of the leftmost column of the skool on screen and off.
$3189 INC $59
$318B LDY $59 Pick up the x-coordinate of the leftmost column of the skool off screen.
$318D DEY Now Y holds the x-coordinate of the rightmost column of the skool on screen.
$318E LDA $5A Save the screen bitmap address on the stack.
$3190 PHA
$3191 LDA $5B
$3193 PHA
$3194 LDA $5C Save the colour information address on the stack.
$3196 PHA
$3197 LDA $5D
$3199 PHA
$319A JSR $2F8C Print the play area tiles in a single column of the screen.
$319D PLA Restore the saved colour information address to $5C.
$319E STA $5D
$31A0 PLA
$31A1 STA $5C
$31A3 PLA Restore the saved screen bitmap address to $5A and add 8 to it. This points at the next tile to the right in the top row of the screen.
$31A4 STA $5B
$31A6 PLA
$31A7 DEX
$31A8 CLC
$31A9 ADC #$08
$31AB STA $5A
$31AD INC $5C Add 1 to the colour information address at $5C. This points at the next tile to the right in the top row of the screen.
$31AF PLA Restore the column counter to X.
$31B0 TAX
$31B1 DEX Decrement the column counter.
$31B2 BNE $3185 Branch back to deal with the remaining columns.
$31B4 CLI Re-enable interrupts.
$31B5 RTS
Prev: $3072 Up: Map Next: $31B6