Im Magazin „8000 PLUS" wurde im Juni 1989 der folgende Artikel abgedruckt.
Ein BASIC-Programm als Grundlage für das Plotten

PLOT, DRAW AND CIRCLE ROUTINE

by Lawrence Simons
Regular readers of these pages will remember Lawrence Simons' Plot routine published in issue 23 (August 88). Springing from those lines of DATA have come such popular programs as Spirographix and Mandelbrot. Other readers have had hours of enjoyment from a version of Mallard Basic, augmented by Plot, which can create some pretty stunning graphics. Unfortunately for newer readers that issue has now sold out.
However, new converts to Basic on the PCW should not fear, as the next few pages contain an updated, and far more versatile, version of this old favourite. Instead of just the plot routine, there are now built-in routines for line and circle drawing.
The Plot Routine is the brain of this listing. What it does is toggle on or off the pixels (if you look closely at your screen you can see the pixels that make up the letters). Draw and Circle enable you to create lines and circles using just two sets of coordinates. In order to achieve anything on the screen, you need to supply the routines with variables. All of these variables must be in integer form. A numeric variable is an integer when the % sign is at the end - for example circup%. The syntax and variables for each routine are explained below:

PLOT(X%,Y%,F%)
X% which must be between and 719.
Y% which must be between and 255.
These tell Plot where to begin on the screen. So X%=0 and Y%=0 would be at the bottom left of the screen.
The last one is F%: you can have one of three settings for this: 1 will Plot a pixel, 0 will Unplot (erase) a pixel. Any other integer will turn a green pixel black and vice versa (toggle).
Note the GOSUB 60000 in line 20. The rest of the section actually makes the bubbles. Lines 70 and 80 set up the integer variables and then calls the Circle routine.
The beginning of the Circle Routine itself. Line 60010 ensures that the routine is loaded directly beneath the operating system. You may like to delele this line in order to load the routine elsewhere.
The very guts of the routine. The data which must be typed in commas and all. Try setting the cursor keys to numerics by pressing ALT and RELAY
The same again and more. These are in fact the x$ which were read in lines 60051 and 60070.
Even more of the same again. Just keep typing, the results will be well worth the effort.
Last but not least...even more data.
[BASIC-Listing mit korrigierter Zeile 60080] und [Assembler-Listing]
DRAW (X%,Y%,F%)
Draw will create a straight line from the position of the last pixel plotted or drawn to the new coordinates. So in this case X% and Y% tell it where to finish the line. Their limits are the same as in Plot.
F% still has the same three settings as above. Draw, like the two other routines, will allow you to pass lines through anything else on screen and and will also 'undraw' itself. For example, you could create a pointer into some lextand then undraw it to give emphasis in a presentation.
CIRCLE(X%,Y%,R%,F%)
As you can see this has four variables, the R% being the odd one out. This stands for Radius and may be set at anything from 1 to 255. It cannot be zero for obvious reasons, you'd end up with an abstract circle and nothing on the screen to show off with!
Taken in combination, these routines will allow you to create some powerful visuals with which to impress and confound all those who doubt the PCW....and there are still a few lost souls!
In order to illustrate the Circle function, we have included lines 10 to 120 which create random 'bubbles' on the screen. When using any of the routines in your own programs you must first execute a GOSUB or GOTO to get to line 60000. This will invoke the routines and install them in high memory. In our Bubble example the code is installed by the CALL 60000; once all the numbers have been read and poked into memory the program returns from the installation subroutine and the bubbles are generated in lines 30 to 110. Line 120 ends the routine.
To use these new routines in your own programs you should delete lines 10-120 and save the remainder as DRAW.BAS or something similar. But don't forget any program you write using these routines must include the CALL 60000 as the first thing it does.
After all that, have fun and send us some examples!

HTML-Bearbeitung von Werner Cirsovius
Dezember 2014
© 8000 PLUS