Advertisement
Zeldara109

4321lift graphics routine

Mar 14th, 2016
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. ;===============
  2. ;Graphics Routine
  3. ;===============
  4.  
  5. TimedPlatDispX: db $00,$10,$0C ; X displacement offset.
  6.  
  7. TimedPlatDispY: db $00,$00,$04 ; Y displacement offset.
  8.  
  9. TimedPlatTiles: db $C4,$C4,$00 ; Tilemaps.
  10.  
  11. TimedPlatGfxProp: db $0B,$4B,$0B ; Property bytes.
  12.  
  13. TimedPlatTileSize: db $02,$02,$00 ; Tile size. Last one is 8x8 4321 tile #.
  14.  
  15. TimedPlatNumTiles: db $B6,$B5,$B4,$B3,$A3,$A4,$A5,$A6,$A7 ; 123456789 tiles
  16.  
  17. TimedPlatformGfx: JSR GET_DRAW_INFO ; Get the X/Y pos relative to screen boarder.
  18. LDA $1626,x ; custom timer
  19. BEQ .NormalRoutine ; If custom timer is 0, use regular routine
  20. LDA $1570,x ;\ Push X then $1570,x
  21. PHX ;| to match regular routine
  22. PHA ;/ (feels inefficient, but works)
  23. LDA $1626,x ;
  24. CLC ;
  25. ADC #$03 ; Adjust tile number to correspond to table
  26. BRA CODE_038E20 ; Branch to the TAX and continue from there
  27. .NormalRoutine
  28. CODE_038E15: LDA.w $1570,X
  29. CODE_038E18: PHX ; Push sprite index.
  30. CODE_038E19: PHA ; And timer for lift.
  31. CODE_038E1A: LSR
  32. CODE_038E1B: LSR ; LSR #6 ..
  33. CODE_038E1C: LSR
  34. CODE_038E1D: LSR
  35. CODE_038E1E: LSR
  36. CODE_038E1F: LSR
  37. CODE_038E20: TAX
  38. CODE_038E21: LDA.w TimedPlatNumTiles,X
  39. CODE_038E24: STA $02 ; Store the numbers into $02 to not mess up the X register.
  40. CODE_038E26: LDX.b #$02
  41. CODE_038E28: PLA
  42. CODE_038E29: CMP.b #$08 ; If timer for lift > 08, branch.
  43. CODE_038E2B: BCS CODE_038E2E
  44. CODE_038E2D: DEX ; We don't write the tile number if it's about to fall, so cut off the last tile.
  45. CODE_038E2E: LDA $00
  46. CODE_038E30: CLC
  47. CODE_038E31: ADC.w TimedPlatDispX,X ; Load X pos and apply x displacement ..
  48. CODE_038E34: STA.w $0300,Y ; To not overwrite them.
  49. CODE_038E37: LDA $01
  50. CODE_038E39: CLC
  51. CODE_038E3A: ADC.w TimedPlatDispY,X ; Apply Y displacement.
  52. CODE_038E3D: STA.w $0301,Y
  53. CODE_038E40: LDA.w TimedPlatTiles,X
  54. CODE_038E43: CPX.b #$02
  55. CODE_038E45: BNE CODE_038E49
  56. CODE_038E47: LDA $02 ;\
  57. CODE_038E49: STA.w $0302,Y ;/ Add in the "time" 4321 tiles.
  58. CODE_038E4C: LDA.w TimedPlatGfxProp,X
  59. CODE_038E4F: ORA $64 ; Add in property byte along with sprite properties.
  60. CODE_038E51: STA.w $0303,Y
  61. CODE_038E54: PHY
  62. CODE_038E55: TYA
  63. CODE_038E56: LSR
  64. CODE_038E57: LSR
  65. CODE_038E58: TAY
  66. CODE_038E59: LDA.w TimedPlatTileSize,X
  67. CODE_038E5C: STA.w $0460,Y ; Store the tile sizes to $0460..
  68. CODE_038E5F: PLY
  69. CODE_038E60: INY
  70. CODE_038E61: INY ; OAM is 8x8, so write 4 times..
  71. CODE_038E62: INY
  72. CODE_038E63: INY
  73. CODE_038E64: DEX ; Pull X and loop so all tiles are drawn.
  74. CODE_038E65: BPL CODE_038E2E
  75. CODE_038E67: PLX
  76. CODE_038E68: LDY.b #$FF
  77. CODE_038E6A: LDA.b #$02 ; 3 tiles drawn.
  78. CODE_038E6C: JSL.l $01B7B3
  79. Return038E70: RTS ; Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement