Advertisement
Guest User

BouncingBall

a guest
Dec 4th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. CON
  2.  
  3. _clkmode = xtal1 + pll16x
  4. _xinfreq = 5_000_000
  5.  
  6. OBJ
  7.  
  8. text : "vga_text"
  9.  
  10. VAR
  11.  
  12. Long PaintSpace[32]
  13. Byte xPos, yPos, xMod, yMod
  14.  
  15. Pub Main
  16.  
  17. cognew(Paint, @PaintSpace)
  18.  
  19. xPos := 12
  20. yPos := 12
  21. xMod := 1
  22. yMod := 1
  23.  
  24. repeat
  25. if xPos < 1 or xPos > 30
  26. xMod := xMod * -1
  27. if yPos < 1 or yPos > 13
  28. yMod := yMod * -1
  29.  
  30. xPos := xPos + xMod
  31. yPos := yPos + yMod
  32.  
  33. waitcnt((clkfreq / 40) + cnt)
  34.  
  35. Pub Paint
  36.  
  37. text.start(8)
  38.  
  39. repeat
  40. text.out(0)
  41. text.out(10)
  42. text.out(xPos)
  43. text.out(11)
  44. text.out(yPos)
  45. text.out(15)
  46.  
  47. waitcnt((clkfreq / 100) + cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement