Advertisement
felixnardella

XC=Basic Demo

Feb 27th, 2020
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. const SCREEN = 1024
  2. const RASTER = 53266
  3. const BALL = 81
  4. const SPACE = 32
  5. const BACK = 53280
  6. const COLLOC = 54272
  7.  
  8. x = 1
  9. y = 1
  10. dx = 1
  11. dy = 1
  12. m = 0
  13. posy=12
  14. posx=0
  15. dposy=1
  16. dposx=1
  17. colorch=0
  18. xx=0
  19. dxx=1
  20.  
  21. goto start
  22.  
  23. origin $1000
  24. incbin "Nightshift1.sid"
  25.  
  26. proc start_music
  27. asm " sei"
  28. doke $314, @irq_routine
  29. poke $d011, $1b
  30. poke $d012, $e4
  31. poke $dc0d, %01111111
  32. poke $d01a, %00000001
  33. poke $d019, %00000001
  34. asm "
  35. lda #$00
  36. jsr $1000
  37. cli"
  38. return
  39.  
  40. irq_routine:
  41. asm "
  42. lda #$01
  43. sta $d019
  44. jsr $1003
  45. asl $d019
  46. jmp $ea31"
  47. endproc
  48.  
  49.  
  50. start:
  51. print "{CLR}"
  52.  
  53. call start_music
  54.  
  55. for colorch=0to1000:pokecolorch+SCREEN+COLLOC,7:nextcolorch
  56.  
  57. main:
  58.  
  59. charat x, y, BALL
  60. gosub wait_frame
  61. charat x, y, SPACE
  62.  
  63. textat xx,posy, "xc=basic demo"
  64. textat xx,posy-1," "
  65. textat xx,posy+1," "
  66. posy=posy+dposy
  67. ifposy>12thendposy=-1
  68. ifposy<1 thendposy=1
  69. textat posx,24," by felix "
  70. i=1
  71. repeat
  72. pokeSCREEN+24*40+posx+i,peek(SCREEN+24*40+posx+i)+128
  73. inci
  74. untili=9
  75. posx=posx+dposx
  76. ifposx+5>x thendposx=-1
  77. ifposx+4<x thendposx=1
  78. ifposx<-1thenposx=-1
  79. ifposx>31thenposx=31
  80.  
  81. if x = 0 then dx = 1 : poke BACK, m:xx=xx+dxx
  82. if x = 39 then dx = -1 : poke BACK, m:xx=xx+dxx
  83. if y = 0 then dy = 1 : poke BACK, m:xx=xx+dxx
  84. if y = 23 then dy = -1:poke BACK, m:xx=xx+dxx
  85. inc m
  86. if m > 255 then m=0
  87.  
  88.  
  89. x = x + dx
  90. y = y + dy
  91.  
  92. if peek(SCREEN+x+40*y+1)<> SPACE then dx =-1
  93. if peek(SCREEN+x+40*y-1)<> SPACE then dx =1
  94. if peek(SCREEN+x+40*y+40)<> SPACE then dy =-1
  95. if peek(SCREEN+x+40*y-40)<> SPACE then dy =1
  96.  
  97. ifxx>26thendxx=-1
  98. ifxx<1thendxx=1
  99.  
  100. goto main
  101.  
  102. wait_frame:
  103. if peek(RASTER) < 250 then goto wait_frame
  104. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement