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 >
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
60 lines
10 rem ********************************
20 rem * program to calculate values *
30 rem * to be used in a sinus table *
40 rem * *
50 rem * written by jason finch for *
60 rem * cdu techno info dec1990 *
70 rem ********************************
80 :
90 :
100 rem ** set-up sprite for demo
110 :
120 poke53269,0:poke53271,0:poke53277,0:poke53287,1:poke53264,1:poke53248,54
130 poke2040,13:fori=0to63:poke832+i,255+255*(i>23):next
140 :
150 :
160 poke53280,5:poke53281,11:print"[147][158] [200]ow many values to create?",," :[153]";
170 open1,0:input#1,a$:close1:print
180 vl=val(a$)
190 print"[158] [210]ange of sinus sweep in pixels"," :[153]";
200 open1,0:input#1,a$:close1:print
210 pr=val(a$)
220 :
230 rem ** check inputs within range
240 :
250 if pr=0 or vl=0 or pr>192 then run160
260 :
270 print"[158] [208]ress any key to start calculations":poke198,0:wait198,1:poke198,0
280 print"[147] [212]he values are....[155]"
290 poke 53249,0: poke 53269,1: rem ** display sprite
300 :
310 rem *******************************
320 rem * main loop to calculate *
330 rem * values for use in table *
340 rem * *
350 rem * see magazine for a detailed *
360 rem * explanation of the *
370 rem * algorithm that i have used *
380 rem *******************************
390 :
400 :
410 for nm=0 to vl-1
420 :
430 rem ** next line calculates value
440 :
450 z=int(0.5*pr*sin(6.283185*nm/vl)+pr/2)
460 :
470 :
480 rem ** change line below to "poke"
490 rem ** the value of 'z' if you want
500 rem ** to store the values in mem'y
510 :
520 printz"[157],";:if pos(0)>30 then print""
530 poke 53249,50+z: rem ** move sprite
540 :
550 next
560 :
570 print:print"[158] [197][206][196] [207][198][160][204][201][211][212]: [208]ress any key to re-run"
580 poke 198,0: wait 198,1: poke 198,0
590 poke 53269,0: run160