Skip to content

Instantly share code, notes, and snippets.

@scruss scruss/plotpourri_bbc.bas
Last active Jul 9, 2019

Embed
What would you like to do?
PLOTPOURRI - Apple II BASIC graphics demo ported to BBC BASIC
1000 REM ******************
1010 REM * *
1020 REM * PLOTPOURRI *
1030 REM * S COTTRELL *
1040 REM * SEPT 1979 *
1050 REM * *
1060 REM ******************
1070 REM Washington Apple Pi Journal October 1979
1080 REM bbc basic / matrix brandy port - scruss, 2019-07
1090 MODE 1
1100 INPUT "WHICH PLOT FIRST (1-10)?";PN
1110 ON PN GOTO 1120,1240,1350,1470,1590,1710,1830,1950,2070,2190
1120 X1=-4
1130 X2=4
1140 Y1=-4
1150 Y2=4
1160 ZS=45
1170 RZ=1
1180 PN=1
1190 ZN=0:ZM=1.9992
1200 PC=5:REM magenta
1210 BC=0:REM black
1220 F$="(COS(X*X+Y*Y)+1)*EXP(-(X*X+Y*Y)/6)"
1230 GOSUB 2330
1240 X1=-4
1250 X2=4
1260 Y1=-4
1270 Y2=4
1280 ZS=12.5
1290 RZ=1
1300 PN=2
1310 ZN=0:ZM=2
1320 PC=2:REM blue, now green
1330 BC=0:REM black
1340 F$="1+COS(X*Y)"
1350 GOSUB 2330
1360 X1=-6
1370 X2=2
1380 Y1=-5
1390 Y2=1
1400 ZS=25
1410 RZ=2
1420 PN=3
1430 ZN=-1:ZM=0.9999
1440 PC=0:REM black
1450 BC=7:REM white?
1460 F$="(-COS(X*X+Y*Y)-1)*EXP(-(X*X+Y*Y)/16)+1"
1470 GOSUB 2330
1480 X1=-200
1490 X2=200
1500 Y1=-100
1510 Y2=200
1520 ZS=12.5
1530 RZ=2
1540 PN=4
1550 ZN=0:ZM=2
1560 PC=0:REM black
1570 BC=7:REM white?
1580 F$="1+COS((X+Y)/(LOG(X*X+Y^4)))"
1590 GOSUB 2330
1600 X1=-20
1610 X2=20
1620 Y1=-20
1630 Y2=20
1640 ZS=40
1650 RZ=2
1660 PN=5
1670 ZN=-1.4955:ZM=-0.0001
1680 PC=0:REM black
1690 BC=7:REM white?
1700 F$="(COS(X*Y/SQR(X*X+Y*Y))-1)*EXP(-(X*X+Y*Y)/120)"
1710 GOSUB 2330
1720 X1=-5
1730 X2=5
1740 Y1=-5
1750 Y2=5
1760 ZS=12.5
1770 RZ=2
1780 PN=6
1790 ZN=0:ZM=1.9999
1800 PC=0:REM black
1810 BC=7:REM white?
1820 F$="1+COS((X+Y)/(LOG(ABS(X*Y+0.5))))"
1830 GOSUB 2330
1840 X1=-7
1850 X2=7
1860 Y1=-17.4
1870 Y2=17.4
1880 ZS=50
1890 RZ=2
1900 PN=7
1910 ZN=-0.1:ZM=0.8999
1920 PC=0:REM black
1930 BC=7:REM white?
1940 F$="Y*X*X/(Y*Y+X*X*X*X)+0.4"
1950 GOSUB 2330
1960 X1=-3
1970 X2=3
1980 Y1=-3
1990 Y2=3
2000 ZS=10
2010 RZ=1
2020 PN=8
2030 ZN=-0.7022:ZM=4.7021
2040 PC=6:REM magenta
2050 BC=0:REM black
2060 F$="Y*X*(X*X-Y*Y)/(X*X+Y*Y)+2"
2070 GOSUB 2330
2080 X1=-4
2090 X2=6
2100 Y1=-3
2110 Y2=5.7
2120 ZS=32
2130 RZ=2
2140 PN=9
2150 ZN=-0.0985:ZM=3.0999
2160 PC=7:REM white?
2170 BC=0:REM black
2180 F$="3*EXP(-(SQR(X*X+Y*Y)))+0.1*COS(X*Y)"
2190 GOSUB 2330
2200 X1=-2
2210 X2=3
2220 Y1=-3
2230 Y2=5.7
2240 ZS=80
2250 RZ=1
2260 PN=10
2270 ZN=-0.5217:ZM=0.9216
2280 PC=6:REM blue
2290 BC=0:REM black
2300 F$="SIN(X*Y)*EXP(-(X*X+Y*Y)/9)+0.2"
2310 GOSUB 2330
2320 GOTO 1120
2330 NY=RZ*87
2340 NX=RZ*50
2350 MODE 1
2360 VDU 23,1,0,0,0,0,0,0,0,0
2370 VDU 19,3,PC,0,0,0
2380 VDU 19,2,BC,0,0,0
2390 DX=(X2-X1)/NX
2400 DY=(Y2-Y1)/NY
2410 H0=0
2420 K1=58
2430 K2=Y2-Y1
2440 K3=90
2450 K4=174
2460 K5=191
2470 K6=X2-X1
2480 FOR X=X1 TO X2 STEP DX
2490 H0=100*(X-X1)/K6
2500 NH=-1
2510 FOR Y=Y1 TO Y2 STEP DY
2520 ZZ=EVAL(F$)
2530 V=-ZZ*ZS-(Y-Y1)/K2*K1+K3+H0
2540 NH=NH+1
2550 H=H0+NH*K4/NY
2560 IF V<0 OR V>K5 THEN GOTO 2620
2570 GCOL 0,3:REM HCOLOR=PC
2580 PLOT 69,4*H,1024-4*V
2590 PLOT 0,0,-4
2600 GCOL 0,2:REM HCOLOR=BC
2610 PLOT 5,4*H,0
2620 NEXT Y
2630 NEXT X
2640 G=GET
2650 RETURN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.