Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. import random
  2.  
  3. const word verareg=$9f20
  4.  
  5. byte verahi @verareg+0
  6. byte veramid @verareg+1
  7. byte veralo @verareg+2
  8.  
  9. byte veradat @verareg+3
  10. byte veradat2 @verareg+4
  11. byte veractl @verareg+5
  12. byte veraien @verareg+6
  13. byte veraisr @verareg+7
  14. #if 0
  15. lda #$14 ; $40040
  16. sta verahi
  17. lda #$40
  18. sta veralo
  19. lda #1
  20. sta veradat ; VGA output
  21. #endif
  22.  
  23.  
  24. const byte LAYER_ENABLE = 1
  25. const byte TM_BPP1_16=(0<<5)
  26. const byte TM_BPP1_256=(1<<5)
  27. const byte TM_BPP2=(2<<5)
  28. const byte TM_BPP4=(3<<5)
  29. const byte TM_BPP8=(4<<5)
  30. const byte BM_BPP2=(5<<5)
  31. const byte BM_BPP4=(6<<5)
  32. const byte BM_BPP8=(7<<5)
  33. const byte TILEW8=0
  34. const byte TILEW16=(1<<5)
  35. const byte TILEH8=0
  36. const byte TILEH16=(1<<4)
  37. const byte MAPW32=(0)
  38. const byte MAPW64=(1)
  39. const byte MAPW128=(2)
  40. const byte MAPW256=(3)
  41.  
  42. const byte MAPH32=(0<<2)
  43. const byte MAPH64=(1<<2)
  44. const byte MAPH128=(2<<2)
  45. const byte MAPH256=(3<<2)
  46.  
  47. void to_vera(pointer source,byte count) {
  48. byte c,x
  49. for c,0,until,count {
  50. for x,0,until,256 {
  51. veradat=source[x]
  52. }
  53. source.hi+=1
  54. }
  55. }
  56.  
  57. void to_veratm8(pointer source,byte count) {
  58. byte c,x
  59. for c,0,until,count {
  60. for x,0,until,256 {
  61. veradat=source[x]
  62. veradat=0
  63. }
  64. source.hi+=1
  65. }
  66. }
  67.  
  68. void set_vera8(byte count,byte value) {
  69. byte c,x
  70. for c,0,until,count {
  71. for x,0,until,256 {
  72. veradat=value
  73. }
  74. }
  75. }
  76.  
  77. void set_vera16(byte count,word value) {
  78. byte c,x
  79. for c,0,until,count {
  80. for x,0,until,256 {
  81. veradat=value.lo
  82. veradat=value.hi
  83. }
  84. }
  85. }
  86.  
  87. void inc_vera16(byte count,word value) {
  88. byte c,x
  89. for c,0,until,count {
  90. for x,0,until,256 {
  91. veradat=value.lo & $f
  92. veradat=value.hi
  93. value+=1
  94. }
  95. }
  96. }
  97.  
  98. void tilemode() {
  99. // actually $4000
  100. verahi = $10
  101. veramid = $40
  102. veralo = $00
  103. to_vera(tileset,14)
  104. // $0000
  105. verahi = $10
  106. veramid = $00
  107. to_vera(tilemap,8)
  108. // $40200
  109. verahi = $14
  110. veramid = $02
  111. to_vera(palette,2)
  112.  
  113. // layer 0 regs at $40000
  114. verahi = $14
  115. veramid = 0
  116. veradat = TM_BPP8 | LAYER_ENABLE
  117. veradat = TILEW16 | TILEH16
  118. veradat = 0
  119. veradat = 0
  120. veradat = $00 // tile_base
  121. veradat = $10 // tile_base
  122. }
  123.  
  124. void main() {
  125. word hscroll
  126. byte c,x
  127.  
  128. veractl = 0
  129. verahi = $14
  130. veramid = 0
  131. veralo = $40
  132. veradat = $1 // vga
  133.  
  134. // x & y scale
  135. veralo=$41
  136. veradat = 64
  137. veradat = 64
  138.  
  139. tilemode()
  140.  
  141. while true {
  142.  
  143. verahi = $14
  144. veramid = 0
  145. veralo = 6
  146. veradat = hscroll.lo
  147. veradat = hscroll.hi
  148.  
  149. hscroll+=1
  150.  
  151. for c,0,until,9 {
  152. for x,0,until,256 {
  153. asm {
  154. nop
  155. }
  156. }
  157. }
  158. }
  159. }
  160.  
  161. array tilemap=file("x16-demo-master/mode4-tilemap.bin")
  162. array tileset=file("x16-demo-master/mode4-tiles.bin")
  163. array palette=file("x16-demo-master/mode4-palette.bin")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement