No_Discussion_8051

DemoSNES

Jun 22nd, 2025
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | Source Code | 0 0
  1. arch 65816
  2. lorom
  3.  
  4. ; Variables
  5. org $000000
  6. !PlayerX = $00
  7. !PlayerY = $00
  8.  
  9. org $808000
  10. Reset:
  11. sei
  12. clc
  13. xce
  14.  
  15. sep #$20
  16. rep #$10
  17.  
  18. lda #$80
  19. sta $2100
  20.  
  21. lda #%00000000
  22. sta $2133
  23.  
  24. lda #$00
  25. sta $2101
  26.  
  27. lda #$00
  28. sta $2102
  29. sta $2103
  30.  
  31. lda #%00000000
  32. sta $2105
  33.  
  34. lda #%00000100
  35. sta $2115
  36.  
  37. ldx #$0000
  38. lda #$00
  39. CleanRAM:
  40. sta $7E0000, x
  41. sta $7F0000, x
  42. inx
  43. cpx #$FFFF
  44. bne CleanRAM
  45.  
  46. jmp Main
  47.  
  48. Main:
  49. jsr WaitVBlank
  50. jsr LoadCHR
  51. jsr LoadPalette
  52. jsr UpdatePlayer
  53. jsr DrawPlayer
  54. jmp Main
  55.  
  56. WaitVBlank:
  57. lda $4210
  58. and #$80
  59. bne WaitVBlank
  60. .Exit:
  61. rts
  62.  
  63. LoadCHR:
  64. lda #$00
  65. sta $2116
  66. sta $2117
  67.  
  68. ldx #$0000
  69. .LoadCHRLoop:
  70. lda playertile, x
  71. sta $2118
  72. inx
  73. cpx #$20 ; Only loading 1 tile is intentional
  74. bne .LoadCHRLoop
  75. .Exit:
  76. rts
  77.  
  78. LoadPalette:
  79. lda #$00
  80. sta $2121
  81.  
  82. ldx #$0000
  83. .LoadPalLoop:
  84. lda playerpal, x
  85. sta $2122
  86. inx
  87. cpx #$20
  88. bne .LoadPalLoop
  89. .Exit:
  90. rts
  91.  
  92. UpdatePlayer:
  93. lda #$80
  94. sta !PlayerX
  95. lda #$70
  96. sta !PlayerY
  97. .Exit:
  98. rts
  99.  
  100. DrawPlayer:
  101. lda #$10
  102. sta $212C
  103.  
  104. lda !PlayerX
  105. sta $2104
  106. lda !PlayerY
  107. sta $2104
  108. lda #$00
  109. sta $2104
  110. lda #$00
  111. sta $2104
  112. .Exit:
  113. rts
  114.  
  115. playertile:
  116. incbin "DemoPlayer.chr"
  117. playerpal:
  118. incbin "DemoPlayer_palette.bin"
  119.  
  120. NMI:
  121. rti
  122.  
  123. IRQ:
  124. rti
  125.  
  126. org $00FFC0
  127. db "DEMO "
  128. db %00110000
  129. db $00
  130. db $00
  131. db $02
  132. db $00
  133. db $01
  134. db $00
  135. dw $0000
  136. dw $0000
  137.  
  138. ; Native Vectors
  139. org $00FFE4
  140. dw $0000
  141. org $00FFE6
  142. dw $0000
  143. org $00FFE8
  144. dw $0000
  145. org $00FFEA
  146. dw NMI
  147. org $00FFEE
  148. dw IRQ
  149.  
  150. ; Emulation Vectors
  151. org $00FFF4
  152. dw $0000
  153. org $00FFF8
  154. dw $0000
  155. org $00FFFA
  156. dw NMI
  157. org $00FFFC
  158. dw Reset
  159. org $00FFFE
  160. dw IRQ
Advertisement
Add Comment
Please, Sign In to add comment