Argus Press
1st January 1989Categories: Description: Utility
Author: Terry Blunt
Published in A&B Computing 6.01
Extended Graphics Generator
Compatible with:
- Master 128
- Master Compact
- Model B/B+ with GXR graphics ROM
As well as being a powerful drawing utility, this graphics generator is especially useful for those programmers who want to incorporate their pictures into BASIC programs. The program is menu driven with error trapping. Whilst in the menu mode OS (*) commands can be entered in the normal way. A return to the menu can be made at any time by pressing ESCAPE.
The generator stores all information in the form of lines of VDU codes, regardless of whether they were entered from a file, via the keyboard or drawn.
The menu options are:
1. Clear entries
This option clears out any previously generated screen ready for a fresh start. It is automatically performed when the program is first run or when a screen is loaded from file.
2. Save file
This option will only be available once a screen has been drawn with at least two lines. You are asked if a spooled file is to be saved. Spooled files cannot be re-loaded into the generator but can be EXECed at any time. A non-spooled file can be re-loaded, but not so easily used outside the generator.
3. Load file
Loads a previously saved file. The file has an identifier string which ensures that an invalid file can't be inadvertently loaded. (Note that a deliberate error is created.)
4. Keyboard entry
This has its own sub-menu and allows any VDU code chain of up to 34 bytes to be entered as one line. Lines can be inserted, deleted, exchanged or entered from scratch. The numbers are a continuous string of two-digit hexadecimal values.
e.g. 170C0700000707000007
This line would change ECF pattern number 1 to a fine black and white grating effect.
Line 0 must begin with the Mode definition and VDU 5. It is best not to put anything else on this line apart from VDU 19 definitions. If the final screen is wanted to be used in a program that uses the non-shadow Modes 0,1 and 2 it should be built up in the normal way and the Mode number changed here before it is finally spooled. Modes 4 and 5 can also be set. (There is little point in having them as shadow Modes.)
All trailing 0s for VDU codes must be entered. e.g.
VDU 19,2,5,0,0,0
becomes
130205000000
When entering VDU codes directly, remember that all two byte values go in low byte first.
Inserting a line creates an empty line at the current line number, after moving this and all later lines up to make space. If you save the screen with empty lines they will be ignored and only valid lines will actually be saved.
Deleting a line causes all later lines to be shunted down to fill the space.
Exchanging the current line with another will not affect any other lines, although if either of the swapped lines contain colour commands etc the results could be bizarre.
5. Draw screen
The drawing routine checks to see if a screen already exists, and if not offers Modes 0, 1 and 2. In fact the shadow RAM equivalents are used. If there is a valid screen it will be displayed up to the last line (or line set with M). Due to the calculations that are being made as it is drawn this is slower than the VDU drivers are actually capable of performing.
The arrow is the starting character and the cursor position indicated is just above the tip.
The number of the previously drawn line is continuously displayed in the bottom left-hand corner. This will be 0 (the Mode definition) when you first start.
Keys
Movement around the screen is with the cursor keys. If the SHIFT key is pressed at the same time much faster movement is possible. Keys 1, 2, 3 and 4 select whether the cursor keys move the whole shape around the screen or change its dimensions.
For all shapes I selects shape movement.
For most shapes 2 gives the second point, and where relevant 3 the third point, 4 the forth. All relative to the start.
For circles, arcs, sectors and segments the radius is set by the vertical cursors on 2.
For arcs, sectors and segments the horizontal cursors on 2 set the circular length and on 3 the angle.
For ellipses 2 sets the two radii and the horizontal cursors on 3 the angle.
The current shape is set using:
L | ... | line |
T | ... | triangle |
P | ... | parallelogram |
R | ... | rhombus/arc |
S | ... | sector/segment |
C | ... | circle |
E | ... | ellipse |
O | ... | is used to toggle between outline or filled shapes, or from one shape to the other in the cases R and S. |
Other keys are:
@ | ... | enables text character entry. The text is first displayed at the top of the screen. When RETURN is pressed the text line comes under normal cursor movement control. |
H | ... | increments the current foreground colour and embeds this in the next line that is fixed. If SHIFT is pressed the colour is decremented. |
X | ... | sets the current ECF pattern. This is also embedded in the next line. |
COPY fixes the current shape as a line in the screen stack.
COPY with F performs and fixes a flood fill. O determines whether the fill is to the current hue or until not the colour at the cursor. You can't flood fill until not an ECF background, although with care this can be done from the keyboard.
M permits display only to a given line. The line selected is not displayed and becomes the current line for overwriting. After making changes the line number can be reset to the last line so that the whole effect can be reviewed.
B provides the ability to skip over a group of lines in the drawing process. This is particularly useful where a fiddly bit of detail is being worked on at the end of a large screen stack and you don't want to keep waiting for the screen to re-draw.
D deletes the current (not last drawn) line. If you are already at the top of the stack nothing will happen otherwise all later lines will be shunted down to fill the space.
I displays all the above notes in brief, identifying the current hue, ECF pattern, line number, etc.
6. Print screen data
If there is a valid screen, lines are sent to the printer numbered and displayed in exactly the form required by option 4. This enables a hard copy to be made in a form that can be easily, albeit a little tediously, re-entered.
7. Editor keys
This is exactly the same as 1 in option 5.
8. Quit
Obvious! It gives you a chance to change your mind though.
As mentioned earlier the spooled file can be used from the keyboard simply with *EXEC (filename), although you may find that there are 'spare' characters hanging in the keyboard buffer afterwards. A better alternative is to use the program segment below:
1000 F%=OPENIN "picture"
1010 FORI%=1 TO EXT #F%
1020 N%=BGET #F%:VDUN%
1030 NEXT
1040 CLOSE #F%
If a quick screen draw is wanted without jerks, and memory permits, use something like the following:
1000 F%=OPENIN "picture"
1010 E%=EXT #F%-1
1020 CLOSE #F%
1030 HIMEM=HIMEM-E%
1040 OSCLI("LOAD picture "+STR$~HIMEM)
1050 FOR I%=0 TO E%
1060 VDU I%?HIMEM
1070 NEXT
All the above methods will draw the screen surprisingly fast, correctly setting the screen Mode first. File lengths are quite independent of the screen Mode, being governed only by the VDU commands themselves.
It is possible to use the character strings produced by the generator in the form displayed by option 4 or printed by option 6 for permanent use, in say, header programs. To do this use the routine below:
1000 FOR I%=0 TO [number of lines]
1010 READ a$
1020 REPEAT
1030 VDU EVAL("&"+LEFT$(a$,2))
1040 a$=MID$(a$,3)
1050 UNTIL a$=""
1060 NEXT
32000 DATA 168105 etc.
32010 DATA ?????? etc.
This may not take any less memory space than the usual MOVE/DRAW combinations. It will depend on the complexity of the drawing. It will however, be much easier to set up.
This article was converted to a web page from the following pages of A&B Computing 6.01.