
ZOOM
by Mark Jones for Sinclair Spectrum
from Your Computer vol.4,#11 (Nov.1984)

Mark Jones takes you up, up and away ... with his 
instant enlarger for the bleary-eyed Spectrum.


ZOOM IS AN easy to use machine-code utility and allows the user to
enlarge to full screen size the area of the screen enclosed within a
window. This window can be varied in size from 8-256 pixels wide and
from 3-192 pixels high. When in Magnify mode the magnified area can be
viewed continuously as the window is moved. Since the magnified area can
also itself be magnified, using the same window, infinite magnification
is possible, even if of doubtful use. The routine does not magnify the
colour but produces the magnification in the current permanent attribute
colour.

The routine accesses various Basic variables for its parameters. This
means you do not have to bother Poking any numbers, but just use a Let
statement. If you call the routine without having assigned the following
variables a "2 Variable not found" error will be given.

The machine code has comprehensive error checking. Zoom will not allow
XPOS or YPOS to be values that make a part of the window off screen. If
say, XPOS was 270, an illegal screen co-ordinate, Zoom would give XPOS a
new value that ensured that the window was entirely on the screen; this
value would vary with the size of the window. The width of the window
can have values between 0 and 5, the depth can have values between 0 and
6. If the variables Width or Depth have values that are too big Zoom
will change the value to the maximum permissible value. Likewise if
either has a negative value Zoom will replace the value with 0. The
width and depth numbers correspond to the following window sizes:

Width           Depth
0 256 Pixels    192 Pixels
1 128            96
2  64            48
3  32            24
4  16            12
5   8             6
6   -             3

Thus to have a window size 64 pixels by 12 pixels, Width would be 2 and
depth would be 4. If you wish to see an example of Zoom error
correcting, load up with the Zoom code and then run the following lines
of Basic.

10 LET XPOS=260: LET YPOS=-10
20 LET WIDTH=6: LET DEPTH=-5

Having run the program type:

RAND USR 50000

This will draw the Zoom window. In this case you will see a very tall,
thin window. If you now type Print XPOS, YPOS, Width, Depth you will
find that Width=5, Depth=0, XPOS=248 and YPOS=192. Since XPOS and YPOS
denote the top left corner of the window, YPOS has been made 192 since
the window is 192 pixels high; ie. this is the first value of YPOS above
-10 that allows the window to appear/sit on the screen. XPOS has been
rounded down until the window is on the screen, in this case 256-window
width.

The algorithm used for Zoom takes each line of the window, places it in
a buffer and keeps on doubling it in width until it is 32 bytes wide. It
then puts the 32-byte buffer down on the screen - 192/(window y size) -
times. The initial form of the screen is saved at 32768 and the
magnified image is formed on the normal screen; ie. at 16384. To create
Zoom, type in program A and then save it. Now try running it, if you
have no errors, then save the code. The code can be used independently
of program B, this program is provided to help you use Zoom.


Basic program commands.

A  Clear main screen and back-up.
B  Move back-up screen down to current window screen.
L  Load with new back-up screen.
m  Magnify area under window until next key press.
M  Continuously magnify. View can be moved around using normal direction keys.
N  Retrieve back-up screen.
P  Make magnified image current window screen.
s  Alter window movement step size.
x  Increase window width.
X  Decrease window width.
y  Increase window depth.
Y  Decrease window height.


Machine-code routines.

Address
30000  XOR current window onto screen. Doing this twice will delete the window.
30003  Move screen from 32768 to 16384.
30011  Move screen from 16384 to 32768.
30019  Move screen from 39680 to 16384.
30027  Move screen from 16384 to 39680.
30039  Magnify area under window.

50708-50800 is used as workspace by Zoom and should be left clear.
32768-39679 Used to store screen during magnification.
39680-46591 Used to store back-up screen.


Variables.

XPOS   X co-ordinate of window
YPOS   Y co-ordinate of window
WIDTH  Width of window 0-5
DEPTH  Depth of window 0-6


Addition from YC Jan'85, page 40 (saved in "ZoomColour")
--------------------------------
COLOUR MAGNIFIER FOR ZOOM
Congratulations to Mark Jones for his idea of the Zoom program in last
month's issue. I use the program particularly for examining more
closely commercial loading screen pictures such as those of Atic Atac
and Sabre Wulf. However, black and white pictures sometimes get a
little dull, and in certain places the removal of colour destroys the
effect. I have therefore written a colour magnifier to go with the
program.
  The problem arises - this is possibly why the original program does
not have colour - when the window is not aligned with the colour
attributes. Magnifying colour in this case may be worse than no colour
at all. My program therefore has several options. As it stands, the
colour is only magnified if the window is aligned, otherwise the
colour is removed.
  However, by adding the lines under the Rem statements - 1020 and
1040 - you can alter the program in two ways. Line 1020 removes the
instructions which stop the colour from being magnified when the
window is in the wrong place. Adding this line causes the area nearest
to the window which is aligned to be magnified with colour. Adding
lines 1020 and 1040 causes the exact are in the window to be
magnified, always with colour.
  To use the colour program, first type in line 10-120 inclusive of
the program [There is no line 120 in the listing. JimG], and run and
correct until there are no errors. Then add the other lines and save
the program. Find the cassette on which you recorded the Zoom control
program and position it at the beginning of the code. Run the program
again, loading in the code and saving the new code in its place.
Ian Collier
Bolton

[See "ZoomColour" in ZOOM.TAP for the extra listing.]


--
Another Fine Product transcribed by:
Jim Grimwood, Weardale, England
http://www.users.globalnet.co.uk/~jg27paw4/
--
