home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 120
/
120.d81
/
trigon
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
18KB
|
514 lines
30 poke53280,0:poke53281,0:gosub60000:poke 198,0
40 clr:poke 788,52
42 dim cr(1,2),cr$(1,2),cu$(4),fr(1,1,2),fr$(1,1,2),k(1),ms$(20),rt(2)
50 dim a,a0,a1,a2,ad,a$,b,b0,b1,b2,b$
60 dim c,c0,c1,c2,cp,cs,cu,cv,c0$,c1$,c2$,c3$,c4$,c5$,cu$
70 dim d,db,dp,ds,dv,em,ex,fe,fq,ft,h,h0,h1,h2,h$
80 dim j,k,kc$,l,m,mc,mc$,ms,n,ns,pr,pw,r0,r1,r2,rs
90 dim s,so,sc$,sr$,t0,t1,ta,tb,tc,uc,v0,v1,v2,wd$,x,xp,xs,y,yp,ys
110 dv=peek(186):if dv<8 then dv=8
130 sys57812"trigfont",dv,0:poke780,0:poke781,0:poke782,232:sys65493
140 sys57812"trig.obj",dv,0:poke780,0:poke781,0:poke782,192:sys65493
150 ad=49152:sysad+15,0:sysad+21,1:poke53265,peek(53265)and191
152 print"[147]"chr$(142)
153 poke53280,6:poke53281,14:poke53282,0:poke53283,1:poke53284,6
160 gosub 4720:sr$=chr$(20)+"1234567890.[145][157][133][147][134]q[209]h[200]p[208]"+chr$(13)
170 cu$(1)="( [196][196] )":cu$(2)="([196][205][211] )":cu$(3)="([210][193][196] )":cu$(4)="([199][210][193][196])"
180 wd$="":x=0:y=0:sc$=" [157][157][157][157][157][157][157][157][157][157][157][157][157][157]":cu=1
190 kc$=" [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]":poke53269,0:poke650,128:db=0
200 c0$="[158]":c1$="[129]":c2$="[156]":c3$="":c4$=""
210 forj=0to1:fork=0to2:poke214,2*k+13:poke211,18*j+5:sys58732:printc0$sc$
220 next:next:gosub 1980:poke214,13:poke211,5:sys58732:sysad+9,0
240 rem *** main input loop ***
250 printchr$(142);: gosub 3930:ms=10:gosub 3880
260 ft=1
270 on ft gosub 550,530
280 for j=1 to 50
290 get a$:if a$="" then next:ft=1-(ft=1):goto 270
300 j=50:next
310 for j=1tolen(sr$):ifmid$(sr$,j,1)=a$then uc=j:j=len(sr$):next:goto 330
320 next:mc=1:ms=13:gosub3880:goto260
330 gosub 530:ifmcthenms=0:gosub3880:mc=0
340 on uc goto 420,370,370,370,370,370,370,370,370,370,370,380
350 on uc-12 goto 390,390,390,390,400,400,400,400,400,400,410,410,440,440,430
360 goto 270
370 gosub 860:goto 260:rem numbers
380 gosub 890:goto 260:rem dec point
390 gosub 960:goto 260:rem cursors
400 gosub 1890:goto 260:rem fkeys
410 gosub 4270:goto 260:rem help
420 gosub 920:goto 260:rem delete
430 gosub 1050:goto 260:rem return
440 gosub 1390:goto 260:rem printer
450 rem *** end program ***
460 poke 788,49:sysad+18,12,1,8
470 goto40000
520 sysad+18,12,1,8:print"[147]";:end
530 a=40*peek(214)+peek(211)+256*peek(648)
540 poke a,peek(a)and127:return
550 a=40*peek(214)+peek(211)+256*peek(648)
560 poke a,peek(a)or128:return
570 if len(wd$) then return
580 printc0$sc$;:return
590 rem *** fe sound ***
600 s=54272:sysad+24
610 pokes+1,08:pokes+4,32:pokes+6,240:pokes+24,15:poke s+4,33
620 for j=1 to 1000:next:pokes+4,16
630 sysad+24:return
640 s=54272:sysad+24
650 pokes+1,fq:pokes+3,pw:pokes+4,64:pokes+5,11:pokes+24,15:pokes+4,65:return
660 rem *** title screen ***
670 gosub60000:poke53280,6:poke53281,14:poke53282,0:poke53283,1:poke53284,6
680 poke 53265,peek(53265)or 64
690 tb=7
850 return
860 rem *** numerals ***
870 if (len(wd$)-dp)>=9 then return
880 gosub 570:printa$;:wd$=wd$+a$:return
890 rem *** decimal point ***
900 if dp then return
910 gosub 570:dp=1:printa$;:wd$=wd$+a$:return
920 rem *** delete ***
930 if len(wd$)=0 then return
940 if right$(wd$,1)="." then dp=0
950 wd$=left$(wd$,len(wd$)-1):print" [157][157] [157]";:return
960 rem *** cursors ***
970 poke214,2*y+13:poke211,18*x+5:sys58732:printc0$sc$cr$(x,y);
980 if a$="" and y<2 then y=y+1:goto 1020
990 if a$="[145]" and y>0 then y=y-1:goto 1020
1000 if a$="" and x=0 then x=1:goto 1020
1010 if a$="[157]" and x=1 then x=0
1020 poke 214,2*y+13:poke 211,18*x+5:sys 58732:
1030 wd$="":dp=0:return
1040 rem *** return ***
1050 gosub 530:if wd$="" then return
1060 if val(wd$)=0 then cr$(x,y)="":goto 1130
1070 if val(cr$(x,y)) then 1120
1080 a=sgn(val(cr$(1,0)))+sgn(val(cr$(1,1)))+sgn(val(cr$(1,2)))
1090 if x=1 and a>=2 then 1130
1100 b=sgn(val(cr$(0,0)))+sgn(val(cr$(0,1)))+sgn(val(cr$(0,2)))
1110 if a+b>=3 then 1130
1120 cr$(x,y)=wd$
1130 poke 214,2*y+13:poke211,18*x+5:sys58732:wd$="":dp=0
1140 printsc$cr$(x,y):poke 214,2*y+13:poke211,18*x+5:sys58732:return
1150 rem *** f(a0,b0,c0)=a1 ***
1160 if b0*c0=0 then em=15:goto 3290
1170 a1=b0*b0+c0*c0-a0*a0
1180 a1=a1/(2*b0*c0)
1190 if a1=0 then a1=(NULL)/2:return
1200 if a1>=1 then a1=0:return
1210 if a1<=-1 then a1=(NULL):return
1220 a1=atn(sqr(1-a1*a1)/a1)
1230 if a1<0 then a1=(NULL)+a1
1240 return
1250 rem *** f(a1,b0,c0)=a0 ***
1260 a0=b0*b0+c0*c0-2*b0*c0*cos(a1)
1270 if a0<0 then em=16:goto 3290
1280 a0=sqr(a0):return
1290 rem *** f(a1,b1,b0)=a0
1300 if sin(b1)=0 then em=15:goto 3290
1310 a0=b0*sin(a1)/sin(b1)
1320 return
1330 rem *** f(b0,b1,a0)=a1
1340 if b0=0 then em=15:goto 3290
1350 a1=a0*sin(b1)/b0
1360 if a1>=1 then a1=(NULL)/2:return
1370 if a1<0 then a1=0:return
1380 a1=atn(a1/sqr(1-a1*a1)):return
1390 rem *** print ***
1400 if so=0 then return
1410 ms=14:gosub 3880:mc=1
1420 sysad+9,3:xp=peek(211):yp=peek(214):cp=peek(646)
1430 poke214,11:poke211,0:sys58732:tb=11
1440 printtab(tb)"[158] [146]"
1450 printtab(tb)" [195][200][207][207][211][197] [196][197][214][201][195][197] "
1460 printtab(tb)" [146]"
1470 printtab(tb)" [146][159] [208]rinter#4 [158] "
1480 printtab(tb)" [146][159] [208]rinter#5 [158] "
1490 printtab(tb)" [146][159] [208]rinter#6 [158] "
1500 printtab(tb)" [146][159] [208]rinter#7 [158] "
1510 printtab(tb)" [146]"
1520 printtab(tb)" [195][210][211][210]/[210][197][212][213][210][206]/[211][212][207][208] "
1530 printtab(tb)" [146]"
1540 poke 198,0:sysad+27,12,14,16,4:pr=peek(780)
1550 pr=pr+3:if pr=3 then 1880
1560 sysad+3:sysad+30,0,39,0,7,160,12,0:poke53272,(peek(53272)and240)or10
1570 sysad+18,0,1,0:sysad+30,1,38,11,23,32,6,0:poke214,12:poke211,0:sys58732
1580 ms=14:gosub 3880
1590 printc3$"[211]et-up printer#"pr"and press any key,"
1600 print"or [209][146] to quit.":poke 198,0
1610 get a$:if a$="" then 1610
1620 if a$="q" or a$="[209]" then 1880
1630 open 15,pr,15:close 15:if st=0 then 1660
1640 printc1$"[208]rinter not detected!":sysad+33,32768
1650 ms=17:gosub 3880:forj=1to2000:next:goto1570
1660 print"[208]rinting...":ta=18:tb=40:sysad+36
1670 open pr,pr,7:cmd pr
1680 print" [211][201][196][197][211] [193][206][199][204][197][211] "cu$(cv);:sysad+42,40
1690 if so=2 then print" [211][201][196][197][211] [193][206][199][204][197][211] "cu$(cv);
1700 a=0:b=0:print:print"a= "fr$(a,0,b);:sysad+42,ta:print"[193]= ";:gosub 5060:a=1
1710 sysad+42,tb
1720 if so=2 then print"a= "fr$(a,0,b);:sysad+42,ta+tb:print"[193]= ";:gosub 5060
1730 a=0:b=1:print:print"b= "fr$(a,0,b);:sysad+42,ta:print"[194]= ";:gosub 5060:a=1
1740 sysad+42,tb
1750 if so=2 then print"b= "fr$(a,0,b);:sysad+42,ta+tb:print"[194]= ";:gosub 5060
1760 a=0:b=2:print:print"c= "fr$(a,0,b);:sysad+42,ta:print"[195]= ";:gosub 5060:a=1
1770 sysad+42,tb
1780 if so=2 then print"c= "fr$(a,0,b);:sysad+42,ta+tb:print"[195]= ";:gosub 5060
1790 a=0:print:print" [193]rea=";:gosub 5130:sysad+42,tb:a=1
1800 if so=2 then print" [193]rea=";:gosub 5130
1810 a=0:b=0:print:print"ha=";:gosub5150:sysad+42,tb:a=1
1820 if so=2 then print"ha=";:gosub 5150
1830 a=0:b=1:print:print"hb=";:gosub5150:sysad+42,tb:a=1
1840 if so=2 then print"hb=";:gosub 5150
1850 a=0:b=2:print:print"hc=";:gosub5150:sysad+42,tb:a=1
1860 if so=2 then print"hc=";:gosub 5150
1870 print#pr:close pr
1880 sysad+39:sysad:sysad+12,3:poke214,yp:poke211,xp:sys58732:poke646,cp:return
1890 rem *** function keys ***
1900 on uc-16 goto 1920,1930,1960,2010,2010,2010
1910 return
1920 gosub 2100:return
1930 for n=0to2:for m=0to1
1940 cr$(m,n)="":next:next:sysad+12,0:wd$="":dp=0
1950 poke214,13:poke211,5:sys58732:x=0:y=0:ms=0:gosub 1980:goto 3880
1960 rem *** circular units ***
1970 cu=cu+1:if cu=5 then cu=1
1980 j=peek(214):k=peek(211)
1990 poke214,11:poke 211,30:sys58732:printc2$cu$(cu)c0$
2000 poke214,j:poke211,k:sys58732:return
2010 rem *** end program ***
2020 ms=5:t0=150:t1=50:gosub3970
2030 if a$<>"y" and a$<>"[217]" then 2090
2040 sysad+3:poke56578,peek(56578)or3
2050 poke 56576,(peek(56576)and252)or3
2060 poke53272,(peek(53272)and15)or16
2070 poke53272,(peek(53272)and240)or4
2080 poke 648,4:sysad+