home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 4 #2 / Commodore_Disk_User_Vol.4_2_1990_-.d64 / prob1a (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  2KB  |  60 lines

  1. 10 rem ********************************
  2. 20 rem * program to calculate values  *
  3. 30 rem * to be used in a sinus table  *
  4. 40 rem *                              *
  5. 50 rem *  written by jason finch for  *
  6. 60 rem * cdu techno info      dec1990 *
  7. 70 rem ********************************
  8. 80 :
  9. 90 :
  10. 100 rem ** set-up sprite for demo
  11. 110 :
  12. 120 poke53269,0:poke53271,0:poke53277,0:poke53287,1:poke53264,1:poke53248,54
  13. 130 poke2040,13:fori=0to63:poke832+i,255+255*(i>23):next
  14. 140 :
  15. 150 :
  16. 160 poke53280,5:poke53281,11:print"[147][158] [200]ow many values to create?",," :[153]";
  17. 170 open1,0:input#1,a$:close1:print
  18. 180 vl=val(a$)
  19. 190 print"[158] [210]ange of sinus sweep in pixels"," :[153]";
  20. 200 open1,0:input#1,a$:close1:print
  21. 210 pr=val(a$)
  22. 220 :
  23. 230 rem ** check inputs within range
  24. 240 :
  25. 250 if pr=0 or vl=0 or pr>192 then run160
  26. 260 :
  27. 270 print"[158] [208]ress any key to start calculations":poke198,0:wait198,1:poke198,0
  28. 280 print"[147] [212]he values are....[155]"
  29. 290 poke 53249,0: poke 53269,1: rem ** display sprite
  30. 300 :
  31. 310 rem *******************************
  32. 320 rem * main loop to calculate      *
  33. 330 rem * values for use in table     *
  34. 340 rem *                             *
  35. 350 rem * see magazine for a detailed *
  36. 360 rem * explanation of the          *
  37. 370 rem * algorithm that i have used  *
  38. 380 rem *******************************
  39. 390 :
  40. 400 :
  41. 410 for nm=0 to vl-1
  42. 420 :
  43. 430 rem ** next line calculates value
  44. 440 :
  45. 450 z=int(0.5*pr*sin(6.283185*nm/vl)+pr/2)
  46. 460 :
  47. 470 :
  48. 480 rem ** change line below to "poke"
  49. 490 rem ** the value of 'z' if you want
  50. 500 rem ** to store the values in mem'y
  51. 510 :
  52. 520 printz"[157],";:if pos(0)>30 then print""
  53. 530 poke 53249,50+z: rem ** move sprite
  54. 540 :
  55. 550 next
  56. 560 :
  57. 570 print:print"[158] [197][206][196] [207][198][160][204][201][211][212]: [208]ress any key to re-run"
  58. 580 poke 198,0: wait 198,1: poke 198,0
  59. 590 poke 53269,0: run160
  60.