Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;===============
- ;Graphics Routine
- ;===============
- TimedPlatDispX: db $00,$10,$0C ; X displacement offset.
- TimedPlatDispY: db $00,$00,$04 ; Y displacement offset.
- TimedPlatTiles: db $C4,$C4,$00 ; Tilemaps.
- TimedPlatGfxProp: db $0B,$4B,$0B ; Property bytes.
- TimedPlatTileSize: db $02,$02,$00 ; Tile size. Last one is 8x8 4321 tile #.
- TimedPlatNumTiles: db $B6,$B5,$B4,$B3,$A3,$A4,$A5,$A6,$A7 ; 123456789 tiles
- TimedPlatformGfx: JSR GET_DRAW_INFO ; Get the X/Y pos relative to screen boarder.
- LDA $1626,x ; custom timer
- BEQ .NormalRoutine ; If custom timer is 0, use regular routine
- LDA $1570,x ;\ Push X then $1570,x
- PHX ;| to match regular routine
- PHA ;/ (feels inefficient, but works)
- LDA $1626,x ;
- CLC ;
- ADC #$03 ; Adjust tile number to correspond to table
- BRA CODE_038E20 ; Branch to the TAX and continue from there
- .NormalRoutine
- CODE_038E15: LDA.w $1570,X
- CODE_038E18: PHX ; Push sprite index.
- CODE_038E19: PHA ; And timer for lift.
- CODE_038E1A: LSR
- CODE_038E1B: LSR ; LSR #6 ..
- CODE_038E1C: LSR
- CODE_038E1D: LSR
- CODE_038E1E: LSR
- CODE_038E1F: LSR
- CODE_038E20: TAX
- CODE_038E21: LDA.w TimedPlatNumTiles,X
- CODE_038E24: STA $02 ; Store the numbers into $02 to not mess up the X register.
- CODE_038E26: LDX.b #$02
- CODE_038E28: PLA
- CODE_038E29: CMP.b #$08 ; If timer for lift > 08, branch.
- CODE_038E2B: BCS CODE_038E2E
- CODE_038E2D: DEX ; We don't write the tile number if it's about to fall, so cut off the last tile.
- CODE_038E2E: LDA $00
- CODE_038E30: CLC
- CODE_038E31: ADC.w TimedPlatDispX,X ; Load X pos and apply x displacement ..
- CODE_038E34: STA.w $0300,Y ; To not overwrite them.
- CODE_038E37: LDA $01
- CODE_038E39: CLC
- CODE_038E3A: ADC.w TimedPlatDispY,X ; Apply Y displacement.
- CODE_038E3D: STA.w $0301,Y
- CODE_038E40: LDA.w TimedPlatTiles,X
- CODE_038E43: CPX.b #$02
- CODE_038E45: BNE CODE_038E49
- CODE_038E47: LDA $02 ;\
- CODE_038E49: STA.w $0302,Y ;/ Add in the "time" 4321 tiles.
- CODE_038E4C: LDA.w TimedPlatGfxProp,X
- CODE_038E4F: ORA $64 ; Add in property byte along with sprite properties.
- CODE_038E51: STA.w $0303,Y
- CODE_038E54: PHY
- CODE_038E55: TYA
- CODE_038E56: LSR
- CODE_038E57: LSR
- CODE_038E58: TAY
- CODE_038E59: LDA.w TimedPlatTileSize,X
- CODE_038E5C: STA.w $0460,Y ; Store the tile sizes to $0460..
- CODE_038E5F: PLY
- CODE_038E60: INY
- CODE_038E61: INY ; OAM is 8x8, so write 4 times..
- CODE_038E62: INY
- CODE_038E63: INY
- CODE_038E64: DEX ; Pull X and loop so all tiles are drawn.
- CODE_038E65: BPL CODE_038E2E
- CODE_038E67: PLX
- CODE_038E68: LDY.b #$FF
- CODE_038E6A: LDA.b #$02 ; 3 tiles drawn.
- CODE_038E6C: JSL.l $01B7B3
- Return038E70: RTS ; Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement