SHORTCUTS
ZX Computing, December 1986

Keep the short routines coming in - there's #10 for each Short Cut
published, and #20 for the month's Star Cut!


- - - - - - - - - - 
SCREENS
[files: Screens (PROG) + screen (SCREEN$)]

Philip Byford of Herts has come up with an alternative way of
presenting loading screens. Once you have created a screen that you
want to use at the start of your program SAVE it in the two sections
as shown in program 1. This code can be included in your artwork
program at the end of the drawing code, or used as written after a
screen has been saved to tape from a drawing program. This needs to be
stored AFTER program 2 which is your main loading program and would
include a final line to LOAD "mainprog".


- - - - - - - - - - 
CLS
[file: Cls]

Peter Paul Hoogbrush sent these few lines to clear your screen rather
classilly. To use Call by RANDOMIZE USR 32000.


- - - - - - - - - - 
UPSIDE DOWN
[file: Inverter]

Inverter is from H. Shaw of Ayreshire and causes all the characters to
be printed upside down!

Enter the program and run it. The only message you should get is a
"return without GOSUB" error message, but don't panic, all is well, it
is simply written in this form so that it can be MERGED into a program
and called by a GO SUB 9900. Once this has been done then it can be
switched on and off by using RANDOMIZE USR 64290/64335.

A program which caused much comment and confusion in our office when
we left a Speccy in upside down mode for a while and just for the fun
of it we make it our "Shortcut of the Month".


- - - - - - - - - - 
TIPS
[file: Tips]

Two very short cuts from Paul Hemmingway of Hull. First a short
machine code routine to flash the whole screen without disturbing its
contents.

Enter the following lines:

9000 FOR n=60000 TO 60017: READ a: POKE n,a: NEXT n
9010 DATA 33,0,88,1,192,2,62,128,86,130,119,35,11,120,177,32,245,201

After this has been set up, either in a program or by RUNning it you
cause the screen to flash by typing or using RANDOMIZE USR 60000;
using it a second time reverts the screen to normal.

Next is a short routine to enable someone to enter a word without it
being displayed, useful for entering a password or for two-player
games when the entry needs to be secret.

1000 POKE 23609,255: POKE 23624,63: INPUT a$: POKE 23609,0: BORDER 7

If you require a different border colour during input then change the
POKE 23624,63 to POKE 23624,9*colour required, and alter the BORDER colour.


- - - - - - - - - - 
SCREEN SUITE
[files: Suite (PROG) + FN CODE (CODE)]

David Knight is another regular contributor, and has supplied us with
a suite of, not one, but EIGHT useful routines for screen
manipulation.

These are all stored in the printer buffer and are set up as user
defined functions in lines 1 to 8. Enter the program and run it; if
all is well then save it when the program prompts you and delete lines
10 to 160 before saving the FN lines 1 to 8.

To use it in your own programs, LOAD in the code and merge in the FN
lines by including a line:
	LOAD "FN CODE" CODE: MERGE ""
The two sets of code must, of course be on the tape after the main
program. But what do they do?

1. FN p(x,y) - This function gives the colour of any pixel normally
   accessible by the BASIC POINT command. It returns a number between
   0 and 7.

2. FN w() - To call use RANDOMIZE FN w(), and this command is used to
   wipe only the attributes with the current colours without affecting
   the rest of the screen.

3. FN u(n) - A rather more complex routine and only of use to those
   who are experienced programmers, it swaps between four banks of UDGs
   previously set up by the user. Called by RANDOMIZE FN u(n), n
   represents the UDG bank number from 1 to 4. [No explanation was given
   as to where the "four banks of UDGs" should be located. JimG]

4. FN v(address) - This function reflects the character pointed to by
   the address, i.e. To reflect UDG graphic "A" use RANDOMIZE FN v(USR "a").

5. FN h(address) - Reflect horizontally.

6. FN c(address) - Reflect clockwise.

7. FN a(address) - Reflect anticlockwise.

8. FN i(address) - invert character.


- - - - - - - - - - 
WHEN I'M 64
[files: WhenI'm64 (PROG) + 64 (CODE)]

Ben Stragnell from Warwickshire presents a simple way of producing 64
characters to a line. Type in the listing and SAVE the code to tape
when prompted. The code is completely relocatable and can be added to
a program by including the line:
CLEAR address-1: LOAD "" CODE address

The code is 144 bytes long and uses the UDG character U. To use it the
variable s$ is reserved and should be set in the first line of your
program to the maximum length of the message you will need PLUS 3 by a
DIM statement. This is because it must be the first in the variables
area of the computer. i.e. line 1 DIM s$(67).

Before calling the 64 print code you have to set up s$ by filling it
with the data required in the format:
LET s$=CHR$ x+CHR$ y+"text to be printed"+CHR$ 128
x is a value between 0 and 63 and is the horizontal coordinate.
y is a value between 0 and 21 and is the vertical coordinate.
Finally you include a line:
PRINT AT 0,0;: LET anyvar=USR address
to print it.
