10 REM (c) Copyright 2003 - Michael John Lake + http://www.nicemike.com
20 REM
30 REM Free for student use. This was a project while at
the
40 REM University of Toledo - Toledo, Ohio, USA.
100 REM ***********************************************************************
110 REM
Mandel.bas (compiled to Mandel.exe)
120 REM ***********************************************************************
130 REM
developed by:
140 REM
Michael J. Lake
150 REM ***********************************************************************
160 REM
Dec. 1, 1994 - Updated march 30, 2003
170 REM ***********************************************************************
180 REM This program
displays the Mandelbrot set, allowing the user
200 REM note the cool
speedup to reduce calculation and display time.
210 REM It will use
vga with qbasic, and is limited to ega otherwise.
220 REM This is the
16th iteration of what started as a simple
230 REM program...
400 REM ***********************************************************************
410 REM
variables used
420 REM -----------------------------------------------------------------------
430 REM x = current
x-screen location
440 REM y = current
y-screen location
450 REM xb = current
x-screen 'box' being calculated
460 REM yb = current
y-screen 'box' being calculated
470 REM n = number
of iterations completed at a point
480 REM nt = used to
test if a box is 'solid'
490 REM nc = a checksum
for the number of differences in the box edge
500 REM nl = used to
loop around box edge
510 REM ick = 'icky'
color representing n (varies with pal.max)
520 REM skip = used
to skip pause during Mandel display in directions
530 REM a = temporary
variable
540 REM a$ = temporary
string variable
550 REM l = current
level being generated within box
580 REM -----------------------------------------------------------------------
600 REM default variable
settings:
610 REM -----------------------------------------------------------------------
620 DEFINT D, I, N
630 LET xmax = 1: REM right edge of area displayed
640 LET xmin = -2: REM left edge
650 LET ymax = 1.125: REM top edge
660 LET ymin = -1.125: REM bottom edge
670 LET max.iter = 99: REM maximum number of iterations
680 LET box = 0: REM for speedup - 1=use all edges 0=use 2 edge
700 LET scree% = 12: REM screen mode
710 LET sq.window$ = "n": REM use square window
730 LET pal.max = 3: REM one less than total # of colors
740 DIM zr(2000), zj(2000): REM real and imaginary number array
750 DIM nrow(128, 12), ncol(96, 16): REM row and col. At start of speedup
760 DIM ne(8, 8, 1): REM array map of current box
770 DIM ix(8), iy(8): REM level pointer within current box
780 DIM d(9, 7)
GOSUB 20000
1000 REM ***********************************************************************
1010 REM
1020 REM
main programming block
1090 REM -----------------------------------------------------------------------
1100 SCREEN 2
1110 REM:gosub 2000
1120 CLS
1130 PRINT "Mandel.exe from NiceMike.com - (c) 2003 by
Michael John Lake +"
1131 PRINT
1132 PRINT
1133 PRINT
1134 PRINT
1138 PRINT "Current range:"
1140 PRINT
1150 PRINT "Top = "; -ymin
1160 PRINT "Bottom = "; -ymax
1170 PRINT , " Left = "; xmin, " Right
= "; xmax
1180 PRINT
1190 PRINT
1200 PRINT "Select from the following:"
1210 PRINT
1220 PRINT , "1) Read directions"
1230 PRINT , "2) Change or look at program settings"
1240 PRINT , "3) Display using no speedups (slow, but 100% correct)"
1250 PRINT , "4) Display using speedups (much faster than no speedup)"
1255 PRINT , "5) Display using numbers"
1260 PRINT , "6) Exit program"
1270 PRINT
1280 INPUT "What is your choice"; choice
1300 IF choice = 1 THEN GOSUB 2000: REM explain program
1310 IF choice = 2 THEN GOSUB 3000: REM get plotting values from user
1320 GOSUB 4000: REM calculate secondary variables
1330 IF choice = 3 THEN GOSUB 5000: REM display with no speedup
1340 IF choice = 4 THEN GOSUB 6000: REM display with speedup
1345 IF choice = 5 THEN GOSUB 7000
1350 IF choice <> 6 THEN 1120
1360 CLS
1370 INPUT "Are you sure you wish to exit (y or n)"; a$
1380 IF a$ = "y" OR a$ = "y" THEN 1999
1390 GOTO 1110
1999 END
2000 REM ***********************************************************************
2010 REM
2020 REM explain program
2090 REM -----------------------------------------------------------------------
2100 SCREEN 2
2110 CLS
2120 PRINT , "Mandel.exe - a Mandelbrot viewing program"
2130 PRINT
2140 PRINT
2150 PRINT
2160 REM
2170 GOSUB 14000
2180 PRINT
2190 PRINT "This program will allow you to view the Mandelbrot set."
2200 PRINT
2210 PRINT "The Mandelbrot set is a set of mathematical points resulting
from a"
2220 PRINT "simple mathematical process that is repeated at every point.
How"
2230 PRINT "it works is:"
2240 PRINT
2250 PRINT " 1. Make a graph representing a complex
plane where the"
2260 PRINT " horizontal or x axis
represents real numbers, and the"
2270 PRINT " vertical or y axis
represents imaginary numbers."
2280 PRINT " 2. At every point on the graph, take
the value of the complex"
2290 PRINT " number representing
that point, square it, and add the"
2300 PRINT " starting value.
Keep repeating this step until the total"
2310 PRINT " value exceeds 4 or
a given number of loops, otherwise known"
2320 PRINT " as iterations, have
been done."
2330 PRINT " 3. Display a color representing the
total number of iterations"
2340 PRINT " calculated at the
point."
2350 PRINT
2360 PRINT
2370 INPUT "Press <Enter> to continue"; a$
2380 CLS
2390 PRINT "The formula iterated at each point:"
2400 PRINT
2410 PRINT "
z(n+1) = z(n)^2 + c"
2420 PRINT
2430 PRINT "Where z(n) is the complex number from the last iteration,"
2440 PRINT "z(n+1) will be the new complex number, and c was the original"
2450 PRINT "complex number for the current point."
2460 PRINT
2470 PRINT
2480 PRINT "If you do not understand the above process, don't worry!
What is"
2490 PRINT "interesting about the Mandelbrot set, or most fractals,
is that the"
2500 PRINT "simple process using the above formula creates a pattern
of"
2510 PRINT "unlimited detail. Or, would if you had a computer
with unlimited"
2520 PRINT "precision and size."
2530 PRINT
2540 PRINT
2550 PRINT "Disregarding the math, the end result is a 'map' of the
Mandelbrot"
2560 PRINT "set which is fun to look at. I have spent many hours
looking at"
2570 PRINT "different parts of the Mandelbrot set! (it is addicting...)"
2580 PRINT
2590 PRINT
2600 INPUT "Press <Enter> to continue"; a$
2610 CLS
2620 PRINT "How to use this program:"
2630 PRINT
2640 PRINT "The program starts with default settings that show the
entire"
2650 PRINT "Mandelbrot set. You can change these settings to
allow you to"
2660 PRINT "look at a smaller area of the set in more detail.
There is also"
2670 PRINT "two display options, one that goes through calculating
every point"
2680 PRINT "which takes a long time, and one that speeds up the process
by"
2690 PRINT "bypassing areas without detail. The speed up works
because one"
2700 PRINT "property of the set is that all points that took a given
number of"
2710 PRINT "iterations to calculate are 'connected'. If you drew
a box in a"
2720 PRINT "given area, and all points on the edge were the same number
of"
2730 PRINT "iterations, then everything inside must be the same."
2740 PRINT
2750 PRINT "The Mandelbrot set 'exists' within a range of -2 to 1,
so there is"
2760 PRINT "no point in going outside this range."
2770 PRINT : PRINT
2780 PRINT "Note: You can print out this and other screens by setting
up your"
2790 PRINT "printer and pressing the <print screen> key"
2800 PRINT : PRINT
2810 INPUT "Press <Enter> to continue"; a$
2820 CLS
2830 PRINT "Settings:": PRINT
2840 PRINT "Top, Bottom, Left, Right are the edges for the area you
wish to"
2850 PRINT "display. To keep the image proportional, use the
same range"
2860 PRINT "difference from top to bottom as from left to right."
2870 PRINT : PRINT
2880 PRINT "Advanced settings:": PRINT
2890 PRINT "The max number of iterations is the maximum times each
point is"
2900 PRINT "calculated. More is better.": PRINT
2910 PRINT "Guessing uses all four edges of a box for speedup, or just
the top"
2920 PRINT "and bottom edges - quicker but sometimes it 'goofs'.":
PRINT
2930 PRINT "You may select different quality of displays by setting
the screen"
2940 PRINT "mode. Note: modes 12 & 13 look real good, but
may not work.": PRINT
2950 PRINT "Selecting a square window will display the ranges over
a square"
2955 PRINT "area. If not, full screen will be used - a 4x3 ratio
horz/vert."
2958 PRINT : PRINT
2960 INPUT "Press <Enter> to continue"; a$
2962 CLS
2964 PRINT "After an image is displayed, the program will wait for
you to press"
2966 PRINT "a key when you are done looking. You may quit the
display while"
2968 PRINT "the image is calculating by hitting the <Esc> key.
It may take a"
2970 PRINT "moment to resister.": PRINT : PRINT
2972 PRINT "Start by displaying with defaults, then try the following
using"
2974 PRINT "48 for the max number of iterations:": PRINT
2976 PRINT " top, bottom, left, right - remarks"
2978 PRINT " .25, -.25, -2, -1.5
- closer look at left cEnter"
2980 PRINT " .05, -.05, -1.8, -1.7 -
the set seems to repeat in miniature"
2982 PRINT " .5, 0,
0, .5 - closer look at top right"
2984 PRINT ".305, .3, .4,
.405 - one of many spirals in the set": PRINT
2986 PRINT "Note that features seem to repeat themselves at smaller
scales."
2987 PRINT : PRINT
2988 INPUT "(You might want to use <Print Screen>) - Press <Enter>
to continue"; a$
2990 RETURN
3000 REM ***********************************************************************
3010 REM
3020 REM get plotting values
from user
3090 REM -----------------------------------------------------------------------
3100 CLS
3110 PRINT "current x-y ranges:
(press <Enter> to keep a current value)"
3120 PRINT
3130 PRINT "Top =", -ymin,
3140
GOSUB 13000
3150
IF a <> 9 THEN ymin = -a
3160 PRINT "Bottom =", -ymax,
3170
GOSUB 13000
3180
IF a <> 9 THEN ymax = -a
3190 PRINT "Left =", xmin,
3200
GOSUB 13000
3210
IF a <> 9 THEN xmin = a
3220 PRINT "Right =", xmax,
3230
GOSUB 13000
3240
IF a <> 9 THEN xmax = a
3250 PRINT : PRINT
3260 PRINT "Enter:"
3270 PRINT " a) for advanced settings"
3280 PRINT " c) to correct x-y
ranges"
3290 INPUT "or press <Enter> for main menu"; a$
3300 IF a$ = "c" OR a$ = "c" THEN 3100
3310 IF a$ = "" THEN 3990
3320 IF a$ = "a" OR a$ = "a" THEN 3500
3330 PRINT "not a valid selection!"
3340 GOTO 3250
3500 CLS
3510 PRINT "Advanced settings:
(press <Enter> to keep a current value)"
3520 PRINT
3530 PRINT "max # of iterations ="; max.iter,
3540
INPUT "new value"; a
3550
IF a >= 0 AND a < 2001 THEN 3580
3560
PRINT "must be between 1 to 2000!"
3570
GOTO 3520
3580
IF a <> 0 THEN max.iter = a
3590 PRINT
3600 PRINT "Guessing-"
3610 PRINT
3630 PRINT " 0)line or 1)box ="; box,
3640
INPUT "new value"; a$
3650
IF a$ = "" THEN 3700
3660
IF a$ = "0" THEN box = 0: GOTO 3700
3670
IF a$ = "1" THEN box = 1: GOTO 3700
3680 PRINT "
z(n+1) = z(n)^2 + c"
3690
GOTO 3630
3700 PRINT
3710 PRINT "Screen mode setting-
mode 1 = 320 x 200, 4 color cga"
3720 PRINT "
mode 2 = 640 x 200, b & w ega"
3722 PRINT "
mode 12 = 640 x 480, 16 color vga"
3724 PRINT "
mode 13 = 320 x 200, 256 color vga"
3730 PRINT
3740 PRINT " screen mode
="; scree%,
3750
INPUT "mode"; a
3760
IF a = 1 OR a = 2 OR a = 0 THEN 3850
3770 PRINT "You may be limited to mode 1 & 2,
others may crash the program!"
3780 PRINT "Would you like to try mode"; a; " (y
or n)"; : INPUT a$
3790
IF a$ = "n" OR a$ = "n" THEN 3700
3800
IF a$ = "y" OR a$ = "y" THEN 3812
3810
GOTO 3780
3812 IF a = 12 OR a = 13 THEN 3850
3814 PRINT
3820 INPUT "x resolution for mode"; xlimit
3830 INPUT "y resolution for mode"; ylimit
3840 INPUT "no.of colors for mode"; pal.max
3842 LET pal.max = pal.max - 1
3850 IF a <> 0 THEN scree% = a
3860 PRINT
3870 PRINT "Square window = ";
sq.window$,
3880
INPUT " (y or n)"; a$
3890
IF a$ = "" THEN 3990
3900
IF a$ = "y" THEN a$ = "y"
3910
IF a$ = "n" THEN a$ = "n"
3920
IF a$ <> "y" AND a$ <> "n" THEN 3870
3930
LET sq.window$ = a$
3990 RETURN
4000 REM ***********************************************************************
4010 REM
4020 REM compute values needed
for display and iterizer
4090 REM -----------------------------------------------------------------------
4100 IF scree% = 1 THEN xlimit = 320: ylimit = 200: pal.max = 3
4110 IF scree% = 2 THEN xlimit = 640: ylimit = 200: pal.max = 1
4112 IF scree% = 12 THEN xlimit = 640: ylimit = 480: pal.max = 15
4114 IF scree% = 13 THEN xlimit = 320: ylimit = 200: pal.max = 255
4120 LET ltest = (max.iter / 10) + 6
4130 LET frame = 1 / max.iter ^ 3
4140 IF guess = 1 THEN parts = 4
4150 IF guess = 0 THEN parts = (box + 1) * 2
4152 LET xrange = xlimit
4154 LET yrange = ylimit
4156 IF sq.window$ = "y" THEN LET xrange = ylimit
4158 IF sq.window$ = "y" AND scree% = 2 THEN xrange = yrange * 2
4160 LET xfactor = (xmax - xmin) / xrange
4170 LET yfactor = (ymax - ymin) / yrange
4490 RETURN
5000 REM ***********************************************************************
5010 REM
5020 REM display Mandel with
no speedup
5090 REM -----------------------------------------------------------------------
5100 SCREEN scree%
5110 IF scree% = 1 THEN COLOR 0, 0: REM if cga then change colors
5120 start$ = TIME$
5130 nx = ltest
5140 LET ltest = max.iter
5190 CLS
5200 FOR y = 0 TO yrange
5210 FOR x = 0 TO xrange
5220 GOSUB 10000: REM iterizer
5230 PSET (x, y), ink
5240 NEXT x
5250 NEXT y
5920 IF skip = 1 THEN 5990
5930 LET ltest = nx
5940 LET finish$ = TIME$
5950 a$ = INKEY$: IF a$ = "" THEN 5950: REM pause till hit key
5960 PRINT "it took from "; start$; " to "; finish$;
5970 a$ = INKEY$: IF a$ = "" THEN 5970
5980 SCREEN 2
5990 RETURN
6000 REM ***********************************************************************
6010 REM
6020 REM display Mandel
using divide and conquer
6090 REM -----------------------------------------------------------------------
6100 SCREEN scree%
6110 IF scree% = 1 THEN COLOR 0, 0: REM if cga set color
6120 start$ = TIME$
6190 CLS
6200 FOR yb = 0 TO yrange STEP 40: REM for each xy-box...
6210 LET y = yb
6220 FOR xb = 0 TO xrange STEP 5
6230 LET x = xb
6240 GOSUB 10000: REM iterizer
6250 PSET (x, y), ink
6260 LET nt = n
6270 LET nc = 0
6280 FOR x = xb + 1 TO xb
+ 4
6290
GOSUB 10000: REM iterizer
6300
PSET (x, y), ink
6310
IF nt <> n THEN nc = nc + 1
6320 NEXT x
6330 IF nc = 0 THEN nrow(xb / 5,
yb / 40) = nt
6340 IF nc > 0 THEN nrow(xb / 5,
yb / 40) = -1
6350 NEXT xb
6360 NEXT yb
6365 IF box = 0 THEN 6600
6400 FOR xb = 0 TO xrange STEP 40: REM for each xy-box...
6410 LET x = xb
6420 FOR yb = 0 TO yrange STEP 5
6430 LET y = yb
6440 GOSUB 10000: REM iterizer
6450 PSET (x, y), ink
6460 LET nt = n
6470 LET nc = 0
6480 FOR y = yb + 1 TO yb
+ 4
6490
GOSUB 10000: REM iterizer
6500
PSET (x, y), ink
6510
IF nt <> n THEN nc = nc + 1
6520 NEXT y
6530 IF nc = 0 THEN ncol(yb / 5,
xb / 40) = nt
6540 IF nc > 0 THEN ncol(yb / 5,
xb / 40) = -1
6550 NEXT yb
6560 NEXT xb
6600 FOR yb = 0 TO yrange - 1 STEP 40
6610 FOR xb = 0 TO xrange - 1 STEP 40: REM transfer data to box
array
6620 FOR nl = 0 TO 7
6630
ne(nl, 0, 0) = nrow(xb / 5 + nl, yb / 40)
6640
ne(nl, 8, 0) = nrow(xb / 5 + nl, yb / 40 + 1)
6650
ne(0, nl, 1) = ncol(yb / 5 + nl, xb / 40)
6660
ne(8, nl, 1) = ncol(yb / 5 + nl, xb / 40 + 1)
6670 NEXT nl
6680 LET l = 8
6690 FOR nl = 0 TO 3
6700
LET ix(2 ^ nl) = 0
6710
LET iy(2 ^ nl) = 0
6720 NEXT nl
6730 GOSUB 11000: REM do box edge
check & detail
6740 NEXT xb
6750 NEXT yb
6850 IF skip = 1 THEN 6990
6860 LET finish$ = TIME$
6870 a$ = INKEY$: IF a$ = "" THEN 6870: REM pause till hit key
6880 PRINT "it took from "; start$; " to "; finish$;
6890 a$ = INKEY$: IF a$ = "" THEN 6890
6980 SCREEN 2
6990 RETURN
7000 REM
7100 SCREEN scree%
7200 FOR y = 0 TO yrange STEP 8
7210 FOR x = 0 TO xrange STEP 8
7220 GOSUB 10000: IF n = 100 THEN 7350
7300 in = INT(n / 10)
7310 i = in: nl = 0: IF i = 0 THEN 7330
7320 GOSUB 15000
7330 i = n - in * 10: nl = 4
7340 GOSUB 15000
7350 NEXT x
7360 NEXT y
7970 a$ = INKEY$: IF a$ = "" THEN 7970
7980 SCREEN 2
7990 RETURN
10000 REM **********************************************************************
10010 REM
10020 REM iterizer
10090 REM ----------------------------------------------------------------------
10100 LET n = 0: REM reset iteration #
10110 LET zr(n) = x * xfactor + xmin: REM convert screen x,y to real
10120 LET zj(n) = y * yfactor + ymin
10130 LET cr = zr(n): REM make complex c=z at start
10140 LET cj = zj(n)
10200 LET zr(n + 1) = zr(n) ^ 2 - zj(n) ^ 2 + cr
10210 LET zj(n + 1) = zr(n) * zj(n) * 2 + cj
10220 LET n = n + 1
10230 IF n < ltest
THEN 10300
10240 LET l6 = zr(n - 6): REM check for
'lake' loop
10250 IF l6 < zr(n)
- frame OR l6 > zr(n) + frame THEN 10300
10270 n = max.iter + 1: GOTO 10400
10300 IF zr(n) ^ 2 + zj(n) ^ 2 > 4 THEN
10400
10310 IF n < max.iter THEN 10200
10320 n = n + 1: REM finished last iteration
10400 LET ink = n AND pal.max
10410 a$ = INKEY$
10420 IF a$ = CHR$(27) THEN xrange = 0
10490 RETURN
11000 REM **********************************************************************
11010 REM
11020 REM box edge check
11090 REM ----------------------------------------------------------------------
11100 LET nx = (ix(4) * 4 + ix(2) * 2 + ix(1))
11110 LET ny = (iy(4) * 4 + iy(2) * 2 + iy(1))
11120 LET l5 = l * 5
11125 LET i1 = yb + ny * 5 + 1: LET i2 = yb + ny * 5 + l5
11130 LET nt = ne(nx, ny, 0)
11140 IF nt < 0 THEN 11270
11150 LET nl = 0
11160 IF ne(nx + nl, ny, 0) <>
nt THEN 11270
11170 IF ne(nx + nl, ny + l, 0)
<> nt THEN 11270
11175 IF box = 0 THEN 11200
11180 IF ne(nx, ny + nl, 1) <>
nt THEN 11270
11190 IF ne(nx + l, ny + nl, 1)
<> nt THEN 11270
11200 LET nl = nl + 1
11210 IF nl < l THEN 11160
11220 REM
if testing got to here then no detail, so fill box...
11230 FOR y = i1 TO i2
11240 LINE (xb + nx * 5, y)-(xb
+ nx * 5 + l5 - 1, y), nt AND pal.max
11250 NEXT y
11260 GOTO 11990
11270 IF l = 1 THEN 11400: REM true=smallest block size
11280 LET l = l / 2
11290 GOSUB 12000: REM devide block & fill
11300 LET l = l * 2
11310 GOTO 11990
11400 REM do a detailed
fill of 5x5 lowest level box
11420 FOR y = i1 TO i2: REM detail fill 5x5 box
11430 FOR x = xb + nx * 5 + 1 * box TO xb + nx * 5 + 4
11440 GOSUB 10000
11450 PSET (x, y), ink
11460 NEXT x
11470 NEXT y
11480 GOTO 11990
11990 RETURN
12000 REM **********************************************************************
12010 REM
12020 REM devide and conquer
12090 REM ----------------------------------------------------------------------
12100 LET y = yb + ny * 5 + l * 5
12110 FOR nl = 0 TO l * 2 - 1
12115 LET i1 = xb + nx * 5 + nl * 5 + 1: LET i2 = xb + nx * 5 + nl
* 5 + 4
12120 LET x = xb + nx * 5 + nl
* 5
12130 GOSUB 10000
12140 PSET (x, y), ink
12150 LET nt = n
12160 LET nc = 0
12170 FOR x = i1 TO i2
12180
GOSUB 10000
12190
PSET (x, y), ink
12200
IF nt <> n THEN nc = nc + 1
12210 NEXT x
12220 IF nc = 0 THEN ne(nx + nl,
ny + l, 0) = nt
12230 IF nc > 0 THEN ne(nx + nl,
ny + l, 0) = -1
12240 NEXT nl
12245 IF box = 0 THEN 12450
12300 LET x = xb + nx * 5 + l * 5
12310 FOR nl = 0 TO l * 2 - 1
12315 LET i1 = yb + ny * 5 + nl * 5 + 1: LET i2 = yb + ny * 5 + nl
* 5 + 4
12320 LET y = yb + ny * 5 + nl
* 5
12330 GOSUB 10000
12340 PSET (x, y), ink
12350 LET nt = n
12360 LET nc = 0
12370 FOR y = i1 TO i2
12380
GOSUB 10000
12390
PSET (x, y), ink
12400
IF nt <> n THEN nc = nc + 1
12410 NEXT y
12420 IF nc = 0 THEN ne(nx + l,
ny + nl, 1) = nt
12430 IF nc > 0 THEN ne(nx + l,
ny + nl, 1) = -1
12440 NEXT nl
12450 REM
12500 LET iy(l) = 0
12510 LET ix(l) = 0
12520 GOSUB 11000
12530 LET ix(l) = ix(l) + 1
12540 IF ix(l) = 1 THEN 12520
12550 LET iy(l) = iy(l) + 1
12560 IF iy(l) = 1 THEN 12510
12570 LET ix(l) = 0
12580 LET iy(l) = 0
12990 RETURN
13000 REM **********************************************************************
13010 REM
13020 REM allow 0 to be input
with default saving settings
13090 REM ----------------------------------------------------------------------
13100 INPUT "new value"; a$
13110 LET a = VAL(a$)
13120 IF a$ = "" THEN a = 9
13990 RETURN
14000 REM **********************************************************************
14010 REM
14020 REM Mandel display
at start of directions
14090 REM ----------------------------------------------------------------------
14100 LET skip = 1
14110 LET scree% = 2
14120 LET ylimit = 20
14130 LET sq.window$ = "y"
14140 GOSUB 4120
14150 GOSUB 5200
14160 LET skip = 0
14170 LET scree% = 1
14180 LET max.iter = 16
14990 RETURN
15000 REM ***************** display a video character ***********************
15100 FOR yb = 0 TO 7
15110 FOR xb = 0 TO 3
15120 nt = d(i, yb) AND 2 ^ (3 - xb)
15130 IF nt = 0 THEN 15150
15140 PSET (x + xb + nl, y + yb), pal.max
15150 NEXT xb
15160 NEXT yb
15990 RETURN
20000 REM ************** read data
*************************************
20100 FOR x = 0 TO 9
20110 FOR y = 0 TO 6
20120 READ
n
20130 d(x,
y) = n
20140 NEXT y
20150 NEXT x
20160 RETURN
DATA 6,15,15,15,15,15,6 : REM 0
DATA 0,2,2,2,2,0,0 : REM 1
DATA 2,5,1,1,2,4,7 : REM 2
DATA 7,7,1,7,1,7,7 : REM 3
DATA 0,1,5,7,1,1,0 : REM 4
DATA 7,4,4,6,1,1,6 : REM 5
DATA 7,4,7,7,5,7,7 : REM 6
DATA 0,7,1,1,2,2,0 : REM 7
DATA 2,5,5,2,5,5,2 : REM 8
DATA 7,7,5,7,7,1,1 : REM 9