Your Spectrum
Issue 20, November 1985 - Shrink Wrapped
Home Contents KwikPik

YS MegaBasic is a big program that's had an enormous impact. But for all you who believe that small is beautiful, Keith Symonds has the solution. A YS MegaBasic program that'll shrink your screens and then print them onto a ZX printer.
Lines 50-60 These lines shrink the bottom half into the top left.
70 GET_0, 34000,5,0,6,16
80 CLS
90 PUT_0, 32000,0,0,6,16: PUT_1, 34000,5,0,6,16
100 PAPER 7: INK 0: WINDOW_0, 0,23,64: CLW_3: GET_0, 30000,0,0,11,16
Lines 70-100 These lines put the whole shrunk picture back onto the screen, and then copies the picture into memory.
120 LET X=(0 AND (A=1 OR A=3))+(16 AND (A=2 OR A=4))
130 LET Y=(0 AND (A=1 0R A=2))+(11 AND (A=3 OR A=4))
140 INPUT "NAME:";A$
150 CLS
160 PUT_0, 30000,Y,X,11,16
Lines 110-160 These lines position your miniaturised screen where you want it.
170 SAVE *"m";1;A$SCREEN$
180 PAUSE 0
190 STOP
Lines 170-190 This section saves the screen and then stops.
9001 BROFF
9009 LET KKK=0
9019 LET KKB=0
9035 LET KKB=KKB+1
9040 NEXT R
9045 LET KKK=KKK+1
9050 NEXT Q
9051 BRON
Lines 9000-9060 This is the Shrink routine.
This program asks for the names of the screen displays in the correct numerical order and then loads them in. You'll then be asked what you want to call the final screen and then it saves it. You're now free to load up the miniature display and copy it onto your printer.
10 REM Mixer v.1 1985
By Keith Symonds
20 :
25 CLEAR 29999
30 CLS
35 SPRINT_10, 80,6,1,"MIXER": SPRINT_0, 90,2,1,"By Keith Symonds": SPRINT_60, 100,2,1,"5:6:85"
40 INPUT "1st position:";A$
50 INPUT "2nd position:";B$
60 INPUT "3rd position:";C$
70 INPUT "4th position:";D$
80 CLS
90 INPUT "Input cartridge and press RETURN";E$
Lines 10-90 This clears the picture area in memory and then asks the names of the four screen$.
100 LOAD *"m";1;A$SCREEN$
110 GET_0, 30000,0,0,11,16
120 LOAD *"m";1;B$SCREEN$
130 GET_0, 31585,0,16,11,16
140 LOAD *"m";1;C$SCREEN$
150 GET_0, 33170,11,0,11,16
160 LOAD *"m";1;D$SCREEN$
170 GET_0, 34755,11,16,11,16
180 CLS
Lines 100-180 This loads in your pictures from microdrive - take out the *"m";1; if you're using tape.
190 INPUT "Name:";A$
200 PUT_0, 30000,0,0,11,16
210 PUT_0, 31585,0,16,11,16
220 PUT_0, 33170,11,0,11,16
230 PUT_0, 34755,11,16,11,16
240 SAVE *"m";1;A$SCREEN$
250 PAUSE 0
260 STOP
Lines 190-260 This block simply positions the four shrunk screens on the display and then saves the picture as a separate file.
There was a time when the world was awash with ZX printer paper. Ah, those halcyon days! You couldn't move for programs that let you dump displays up to eight times larger than real size to Sinclair's hot piece. How times change - now everyone's short of the shiny stuff - and no, I don't mean just money!
   That's why I've devised a routine to squeeze four full sized screen displays into one. And what's more, I did it using YS MegaBasic! The very useful GET, PUT and PROCedures meant that the program could be short and, best of all, quick to type in.
   Of course, it's still not easy to shrink a screen by half if you still want to retain any semblance of detail. My routine scans the area needed for shrinking, finds out if every other pixel is on or off and then determines whether or not to plot a pixel in the area

Sky Ranger large pic
Pick up a picture, any picture - this program will take 'em all. Now, load it into the Shrinker program ...

Sky Ranger small pic
... and just watch that SCREEN$ go for the slimmer's awards. Maybe there's a little lack of quality, but remember you're working in a quarter of the size.

four combined pics
Why not bring three friends to the party? The Mixer program will let you move 'em round, and then save a compiled pic of the lot!
where the shrunk screen is to be placed. Tricky stuff you might think, but easily taken care of with the GET command.
   All that's left to be done is to place the display into one of the four corners and then the second program puts them all onto one display to be saved or printed. Easy really, provided of course, that you have a copy of YS MegaBasic. If you haven't, isn't it about time you saw a shrink!
For all you YS MegaBasic hacks, here's an explanation of the parameters used in the Shrink PROCedure:
SHRINK x,y,u,d,b,c,e,f
x and y are the pixel co-ordinates of the bottom left-hand corner of the area to be shrunk.
u is the number of pixels the area is across.
d is the number of pixels the area is down.
b is the amount to be shrunk in the u direction.
c is the amount to be shrunk in the d direction.
e and f are the pixel co-ordinates of where the shrunk area will be placed.
Load your copy of YS MegaBasic and then enter the program before saving it to tape. If you're not using microdrives, then change the following lines to:

Now run the program and it'll ask you for the name of the screen display you want to shrink. Start the program and the program will load the piccy. You'll have to be patient now while you wait for the display to be shrunk in the wash!
You'll then be offered a choice of where you want to place your shrunken screen. 1=top left, 2=top right, 3=bottom left, 4=bottom right.
If you're using tape, it's an idea to save your screens in number order for the mixer program. Finally, the program will save the screen display.
10 CLEAR 29999: PCLEAR
14 SPRINT_6, 85,5,1,"SHRINK": SPRINT_0, 95,2,1,"By Keith Symonds": SPRINT_60, 105,2,1;"5:6:85"
15 INPUT "Name of screen display:";'A$
20 LOAD *"m";1;A$SCREEN$
Lines 10-20 These lines shift the Ramtop and load in the screen$ you want to shrink.
25 GET_0, 30000,11,15,13,17
26 WINDOW_11, 32,12,32: CLW_0
Lines 25-26 These lines capture the bottom right of the screen ...
30 SHRINK_0, 88,255,87,2,2,128,4
Line 30 ... and this line calls the Shrink PROCedure, which squashes the top half into the bottom right.
35 GET_0, 32000,16,16,6,16
40 PUT_0, 30000,11,15,13,17
Lines 35-40 This puts the squashed top half into memory and then replaces the bottom half.
50 WINDOW_0, 0,11,32: CLW_0
60 SHRINK_0, 0,255,87,2,2,0,88
Home Contents KwikPik