Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lda #6
  2. sta $0 ;xpos
  3. lda #6
  4. sta $1 ;ypos
  5. lda #0
  6. sta $5 ;previous address
  7. lda #0
  8. sta $6
  9.  
  10. ;$2 and $3 are the two addresses of the dot.
  11. jmp lewp
  12.  
  13. duplicateBallAddress:
  14. lda $2
  15. sta $4
  16. lda $3
  17. sta $5
  18. rts
  19.  
  20. drawBall:
  21. lda #0
  22. sta ($4), y   ;erase previous ball
  23.  
  24. lda $1        ;y position
  25. adc $1        ;double to get memory location
  26. tax
  27. lda ypos, x
  28. sta $2        ;lsb
  29. inx
  30. lda ypos, x   ;msb
  31. sta $3
  32. lda $0        ;load x position
  33. clc
  34. adc $2        ;add x position
  35. sta $2
  36. lda #1
  37. sta ($2),y    ;draw pixel
  38. rts
  39.  
  40. lewp:
  41.   jsr drawBall
  42.   jsr duplicateBallAddress
  43.   inc $0
  44.   inc $1
  45.   jmp lewp
  46.  
  47. ypos:
  48.  dcb $00,$02,$20,$02,$40,$02,$60,$02
  49.  dcb $80,$02,$a0,$02,$c0,$02,$e0,$02
  50.  dcb $00,$03,$20,$03,$40,$03,$60,$03
  51.  dcb $80,$03,$a0,$03,$c0,$03,$e0,$03
  52.  dcb $00,$04,$20,$04,$40,$04,$60,$04
  53.  dcb $80,$04,$a0,$04,$c0,$04,$e0,$04
  54.  dcb $00,$05,$20,$05,$40,$05,$60,$05
  55.  dcb $80,$05,$a0,$05,$c0,$05,$e0,$05
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement