Advertisement
felixnardella

The Stepping-Feet Illusion

Jan 28th, 2024 (edited)
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. ; ***********************************************
  2. ; * *
  3. ; * The Stepping-Feet Illusion for Commodore 64 *
  4. ; * *
  5. ; * Assembly code by Kimono (Felice Nardella) *
  6. ; * *
  7. ; * Jan 2024 *
  8. ; * *
  9. ; ***********************************************
  10.  
  11. * = $c000
  12.  
  13. start
  14. jsr copySprite
  15. jsr setupSprite
  16. mainLoop
  17. jsr fillScreen
  18. jsr moveSprite
  19. jsr $e544 ; clear screen
  20. jsr moveSprite
  21. jmp mainLoop
  22.  
  23.  
  24. fillScreen
  25. ldx #0
  26. stx $d020 ; black border
  27. stx $d021 ; black screen
  28. loop_0
  29. lda #$a0 ; reverse space ascii code (160)
  30. sta $0400,x ; fills the first 255 screen locations
  31. sta $0401,x ;
  32. lda #1 ; first white
  33. sta $d800,x
  34. lda #0 ; second black
  35. sta $d801,x
  36. inx
  37. inx
  38. bne loop_0
  39. loop_1
  40. lda #$a0
  41. sta $0500,x
  42. sta $0501,x
  43. lda #1
  44. sta $d900,x
  45. lda #0
  46. sta $d901,x
  47. inx
  48. inx
  49. bne loop_1
  50. loop_2
  51. lda #$a0
  52. sta $0600,x
  53. sta $0601,x
  54. lda #1
  55. sta $da00,x
  56. lda #0
  57. sta $da01,x
  58. inx
  59. inx
  60. bne loop_2
  61. loop_3
  62. lda #$a0
  63. sta $0700,x
  64. sta $0701,x
  65. lda #1
  66. sta $db00,x
  67. lda #0
  68. sta $db01,x
  69. inx
  70. inx
  71. cpx #$e8
  72. bne loop_3
  73.  
  74. rts
  75.  
  76. setupSprite
  77. lda #$d ; 832/64 = 13
  78. sta $07f8 ; pointer sprite 0 (2040)
  79. lda #$e ; 896/64 = 14
  80. sta $07f9 ; pointer sprite 1 (2041)
  81.  
  82. lda #%00000011 ;
  83. sta $d015 ; activate both sprites (53269)
  84. sta $d01d ; x sprite expansion
  85.  
  86. lda #6 ; color blue (6)
  87. sta $d027 ; color sprite 0 (53287)
  88. lda #7 ; color yellow (7)
  89. sta $d028 ; color sprite 1 (53288)
  90.  
  91. lda #24
  92. sta $d000 ; pos x sprite 0
  93. lda #115
  94. sta $d001 ; pos y sprite 0
  95.  
  96. lda #24
  97. sta $d002 ; pos x sprite 1
  98. lda #165
  99. sta $d003 ; pos y sprite 1
  100.  
  101. rts
  102.  
  103. copySprite
  104. ldx #0
  105. lda #$ff
  106. c1
  107. sta $0340,x ; block 832
  108. sta $0380,x ; block 896
  109. inx
  110. cpx #$40
  111. bne c1
  112. rts
  113.  
  114. moveSprite
  115. ldx #24
  116. m1
  117. stx $d000
  118. stx $d002
  119. inx
  120. jsr delay
  121. cpx #$ff
  122. bne m1
  123.  
  124. jsr activateMSBx
  125. ldx #0
  126. m2
  127. stx $d000
  128. stx $d002
  129. inx
  130. jsr delay
  131. cpx #42
  132. bne m2
  133. m3
  134. stx $d000
  135. stx $d002
  136. jsr delay
  137. dex
  138. bne m3
  139.  
  140. jsr disableMSBx
  141. ldx #$ff
  142. m4
  143. stx $d000
  144. stx $d002
  145. dex
  146. jsr delay
  147. cpx #24
  148. bne m4
  149.  
  150. rts
  151.  
  152. delay
  153. txa
  154. pha
  155. ldx #0
  156. ldy #0
  157. p1
  158. iny
  159. bne p1
  160. inx
  161. cpx #$20
  162. bne p1
  163. pla
  164. tax
  165. rts
  166.  
  167. activateMSBx
  168. lda #%00000011 ;
  169. sta $d010 ; activate msb x for sprites
  170. rts
  171.  
  172. disableMSBx
  173. lda #%00000000 ;
  174. sta $d010 ; disable msb x for sprites
  175. rts
  176.  
  177.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement