Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 5 rem poligoni inscritti e circoscritti by felice nardella (2022)
- 10 poke53280,15:s=8192
- 15 poke53272,peek(53272)or8:poke53265,peek(53265)or32
- 20 gosub320
- 25 rem clear color ram
- 30 cb$="pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp"
- 35 cb$=cb$+cb$:cb$=cb$+left$(cb$,121)
- 40 print"{clear}"cb$cb$cb$cb$;:print"ppp";:poke2023,16
- 45 tw(0)=1:fori=1to7:tw(i)=tw(i-1)*2:next
- 50 fori=1024to2023:pokei,16*13:next
- 55 goto225
- 58 rem plot x,y
- 60 p=s+320*int(y/8)+8*int(x/8)+(yand7)
- 65 pokep,peek(p)ortw(7-(xand7))
- 70 return
- 75 rem calc lines pixels
- 80 dx=x1-x2:dy=y1-y2
- 85 ifdx=0goto130
- 90 m=dy/dx
- 95 ab=1:ifm>1orm<-1goto155
- 100 ifdx>0thenab=-1
- 105 forx=x1tox2stepab
- 110 y=m*(x-x1)+y1
- 115 gosub60
- 120 next:return
- 125 rem if dx=0
- 130 x=x1:ab=1:ifdy>0thenab=-1
- 135 fory=y1toy2stepab
- 140 gosub60
- 145 next:return
- 150 rem if m>1orm<-1
- 155 ab=1:ifdy>0thenab=-1
- 160 fory=y1toy2stepab
- 165 x=(y-y1)/m+x1
- 170 gosub60
- 175 next:return
- 180 rem plot polygons
- 185 fi=2*pi/n:s1=sin(fi):c1=cos(fi)
- 190 y1=0:x1=r
- 195 fork=1ton
- 200 x2=xc+x1*c1-y1*s1
- 205 y2=yc+x1*s1+y1*c1
- 210 x1=xc+x1:y1=yc+y1:gosub80
- 215 x1=x2-xc:y1=y2-yc
- 220 next:return
- 225 rem main
- 230 xc=160:yc=100
- 235 fori=0to2
- 240 r=25*2^i:n=r:gosub185
- 245 n=3*2^i:gosub185
- 248 ifn=3thenr=r*2:gosub185
- 250 ifn=6thenr=r*2/sqr(3):gosub185
- 255 ifn=12thenr=r*4/(sqr(6)+sqr(2)):gosub185
- 260 poke198,0:wait198,1
- 265 gosub320
- 270 next
- 280 printchr$(147)
- 295 rem turn graphics off
- 300 poke53265,peek(53265)and(223)
- 305 poke53272,21:poke53280,14
- 310 end
- 315 rem clear graphic ram
- 320 cb$=""
- 325 p1=peek(51):p2=peek(52)
- 330 poke51,64:poke52,63
- 335 forcn=1to125:cb$=cb$+chr$(0):next
- 340 poke51,p1:poke52,p2
- 345 return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement