                         Drawer



        Paul Rhodes and an advanced draw program.



This is a complex draw program for the ZX Spectrum with

many advanced facilities usually found only on expensive

commercial packages. These include a fill routine that can

handle even the most complicated shapes, patterned fill,

filled-in and empty circles, solid and dotted lines,

variable cursor speed, screen magnify - magnifications -

and two screen stores.

  To enter the program, you should first type in the con-

trol program - listing 1 - and save it to tape or Micro-

drive with auto-run Line 500. You should make no changes to

the program, except to the Load command in line 500 if you

wish to use the program on Microdrive, as memory is tight

and line numbers are important. If you do not have Micro-

drives, then you will be unable to enter the Microdrive

Save/Load lines, so type in lines 200 and 201 again in

place of lines 202 and 203.

  [This would be the best point to mention that the ver-

sion on the TZX does include Microdrive support (which

crashes when used without Interface 1 or emulation thereof.

Use RUN to restart the program; you will find that your

screen has been preserved). I've also provided the special

hexloader mentioned below, though it's unlikely you need it

for anything. And there's a sample screen showing all the

fill patterns.]

  Next:

            CLEAR 24999

and type in the hexloader. If you are going to use your own

hexloader, then you will have to enter the Pokes and Save

command at the end of the program - line 80 - yourself

after you have typed the hex in. Enter the hex from the

listing, eight bytes at a time with no separating spaces,

entering the checksums when prompted.

  When you have finished the program will automatically

save the code to tape. If you want to save it to Micro-

drive, you must New the hexloader first, as otherwise there

will not be enough memory for the "m" channel. It is best

to start off by saving everything to tape, then transfer to

Microdrive later.

  To test the program, first type:

            PRINT USR 0

to clear the computer, then Load the control program. This

will automatically Load the code and print up a menu on

screen. If this does not happen, press 0 then r. If you get

a menu now, then you must have forgotten to enter the Pokes

at the end of the hexloader. If you do not, then you have

made an error in typing in the code. [Rest assured, dearest

reader. Of course the program on the TZX has been tested

and provides the menu as expected.]

  The menu has six options, numbered 0-5. Option 0 allows

you to use the drawing program, option 5 will quit the

program and return to Basic, and the others bring up a sub-

menu asking what you want to save or load.

  When you press 0 you should be presented with a blank

screen, except for a small information window in one cor-

ner. Assuming that there was nothing in memory before you

loaded the program, the screen attributes will be set to 0,

so you will be unable to see your cursor. Press Caps Shift

V, then select option 3 from the Clear Screen menu.



 How to use the program



  I will now explain how to use the program. The first

thing you will need to know is how to move the cursor. The

keys Q, W, E, A, D, Z, X and C are the cursor control keys

- these will be familiar to users of Melbourne Draw. When

used in conjunction with Symbol Shift, these keys will

scroll the screen, and with Caps Shift they can be used to

move the magnification window - more of which later.

  The cursor can be used in any of the four plot modes, Set

- plots point, Res - resets point-equivalent to Inverse 1,

XOR - inverts pixels-equivalent to Over 1 and Skip - allows

you to move the cursor without plotting. These modes are

selected by the keys P, O, I and U respectively.

  To change the colours on the screen you must change from

the pixel cursor - indicated by SCRN in the information

window - to the attributes cursor - ATTR. The L key will

switch between the two cursors. The attribute cursor

behaves exactly like the pixel cursor, except that it is

character-sized. In Set mode, it will draw the ink, paper,

bright and flash values indicated at the bottom of the

information window. These can be altered using the number

keys. Keys 0-7 will change the ink - unshifted - or paper -

with Caps Shift - colour, keys 8 and 9 will change the

bright - unshifted - and flash - with Caps Shift - values.

  Note also that, when using the attribute cursor, Symbol

Shift with the movement keys will scroll the attributes. It

is important to remember, with both pixel and attribute

cursors, that the point underneath the cursor is not plot-

ted until you move the cursor from it. If you wish to plot/

change the attributes at the cursor positions, press Enter

- this will plot in the current mode, so obviously will

have no effect in Skip mode. Finally, on this subject, if

you wish to speed up or slow down the cursor, you can use

Symbol Shift together with the number keys to select a

speed. There are nine speeds (1-9) and also a special "no

repeat" mode (0).

  For the line and circle drawing routines, you have to

specify two points - these will be the two ends of the

line, or of a radius of the circle. To set one end of the

line, or the centre of the circle, press Caps Shift and

Enter. This defines the cursor position as the "last

point". Next, move the cursor to the other end of the line,

or a point on the circumference of the circle.



 See "last point" flashing



  If you press Symbol Shift and Enter together, and hold

them down, you will see the "last point" flashing. This can

be useful when you wish to remind yourself of its position.

To draw a line - select the appropriate mode first - it is

pointless drawing a line in Skip mode! - press Caps Shift

and J. To draw a circle, press Caps Shift and H. Symbol

Shift and H will draw a filled circle, Symbol Shift and J

gives a dotted line. To change the mask for the dotted

line, press Caps Shift and K - the mask is initially set

to 10101010.

  It is important when drawing a picture in colour to

be able to see the positions of the edges of character

squares, so as to avoid "attribute clashes". To help you do

so, the program can superimpose one of two grids over the

screen. Press G for a black-on-white grid, or Caps Shift G

for a grid which retains the ink and paper colours already

on the screen. As the grid is a pattern of Bright and

normal squares, it will not show up on an RGB monitor.

  Now on to the Fill routine. This will fill in any shape

bounded by a solid line or the edge of the screen. Move the

cursor within the shape and press Caps Shift F. To fill a

shape in with one of the 20 fill patterns, proceed as for

a normal fill but press Symbol Shift F. You will be prompt-

ed for a pattern number. Select the pattern using keys 0-9

for the first 10 patterns or Caps Shift plus 0-9 for the

other 10.

  If you want to make up your own pattern, any of the 20

can be redefined. The patterns consist of an 8 by 8 charac-

ter square, like a UDG. Draw your pattern in a character

square - use the grid - and, with the cursor still in the

square containing the pattern, press Caps Shift P. Select

the pattern as for Fill. Pressing Symbol Shift with the

number will abort the fill or pattern define command if you

have selected it by mistake.

  Similar to the "define pattern" command is "define UDG" -

selected with Caps Shift and O. In answer to the "UDG?"

prompt you should press the key corresponding to the

graphic you want to define, which must be in the range A-U.

Any other letter key or Break will abort the command.

  There are two memory-stores for pictures, so that you can

save a picture at any stage in development, then recall it

if you have messed something up. To save a screen, press

Caps Shift and I. To recall it later, press Caps Shift and

U. The long-term store will retain the picture until you

store something else over it, but Fill, Line and Circle all

copy the screen into the temporary store so that you can

undo their operation if need be.

  This can be especially important with Fill as you might

find that you have left a gap in the shape to be filled,

and fill in more than you want to; or you may decide you

have chosen the wrong pattern.



 There is a text mode



  For putting text and UDGs on the screen, there is a Text

mode, selected by pressing T. Type in text as normal,

except that capital letters are unshifted and lower case

shifted, using Caps Shift with the keys 5-8 to move the

cursor around the screen. Graphics mode is selected with

Caps Shift 9, which will change the appearance of the

cursor and display "GRPH" under "Text" in the information

window. [To exit this mode, press Break.]

  The information window now needs some explanation. The

two numbers at the top are, of course, the cursor coordi-

nates. They follow the normal practice of defining (0,0) as

the bottom left corner of the part of the screen normally

available to Basic. The bottom two lines are assigned nega-

tive y-coordinates. The second line of the window will

display the mode - Set, Res, XOR, Skip or Text - and "Fo"

which signifies that "Follow mode" is in operation - this

will be explained later.

  The third line displays the cursor mode - SCRN or ATTR

for the normal cursor, GRPH or nothing for the text cursor

- and the magnification - so far, always 1. Along the

bottom are the paper and ink colours and bright and flash

settings - a bright B appears for Bright 1, a flashing F

for Flash 1. The window can be turned off and on with Caps

Shift N, and it can be moved by pressing N. This is nor-

mally unnecessary as it moves automatically if you move the

cursor over it. So as to be noticable at all times when

switched on, the window selects black or white paper to

contrast with the paper colour underneath it.

  One of the most important and useful features of the

program is the magnifier. This allows you to magnify part

of the screen by a factor of either two or four in each

direction - i.e., magnifying the area by four or 16. The

area to be magnified is called the "magnification window"

and can be seen by pressing Caps Shift and M - press them

again to turn it off. It can be moved around the screen by

pressing Caps Shift along with the cursor movement keys.

Symbol Shift M will select the magnification and hence the

size of the window - with a greater magnification, the area

to be magnified is smaller.

  To magnify the area in the window, press M. There is a

special feature of the magnifier which causes the window

to automatically centre itself on the cursor if it is not

within the magnification window. This means that when draw-

ing in magnified mode, the window will automatically follow

the cursor when it goes off the edge of the screen and is

therefore called "Follow Mode".

  You can turn it off - and back on again - by pressing

Symbol Shift and S. To centre the window press S, and to

move the cursor to the centre of the window, press Caps

Shift and S. You can still change the magnification and

move the window around when in magnified mode, but remem-

ber that in follow mode you cannot move the window away

from the cursor.

  To clear the screen, press Caps Shift and V, then select

either screen which will leave the attributes alone, attri-

butes which will clear the colour details only or both - a

normal CLS.

  Symbol Shift and V will select the Invert command, which

has the same options available. This can be useful for many

things. For example, for inverted text you should invert

the screen, then put the text on the screen normally, then

invert the screen again.

  You can also clear parts of the screen by inverting the

screen, drawing round them and filling them in, and then

inverting the screen again. Note that the option to invert

both screen and attributes will have no visible effect,

unless you turn the grid on. One other command which can be

used in conjunction with Clear is Border - press B - which

can be used to set the border colour. This does not affect

the picture itself, it is purely for convenience of the

user.

  The only other key which you will need to use is R.

Regardless of any shifts, this will return you to the main

Save/Load menu.



[ And to finish it all off, here's a summary of the keys:



QWE   move cursor

A D ^ scroll screen

ZXC @ move magnify window



 P    select Set  mode

 O    select Res  mode

 I    select XOR  mode

 U    select Skip  mode

 L    switch pixel/attr cursor



0-7   change ink

    @ change paper

8-9   change bright

    @ change flash

1-9 ^ select speed

0   ^ no repeat speed



Enter plot point/set attributes

    @ set  last point

    ^ show last point



@J    draw line

@H    draw circle

^H    draw filled circle

^J    draw dotted line

@K    change dot mask



 G    b/w    grid

@G    bright grid



@F    fill solid

^F    fill with pattern

@P    define fill pattern

      0-9   select pattern 0-9

          @ select pattern 10-19

          ^ abort fill/define

@O    define UDG



@I    save   screen

@U    recall screen



 T    select text mode

      normal text upper case

      @    lower case

      @5-8 move cursor

      @9   graphics mode



@N    switch info window

 N    move   info window



@M    switch magnify window

^M    select magnification

 M    magnify area

^S    switch follow mode

 S    centre mag window on cursor

@S    centre cursor on mag window



@V    clear  screen

^V    invert screen

 B    change border colour



 R    return to save/load menu



                                  Richard Bos, April 2012 ]