WELCOME
to the
BAG of TRICKS
VOLUME 1
You will find an index of the contents of this cartridge
at the end of this document. Every trick / program / routine
is described in a QUILL document like this one. If you wish,
therefore, to know more about each one, the _doc name is same
as that of the program file.
Now, several generalities regarding this BT (Bag of
Tricks, ah yes, again, an acronym !!). First of all, why the
BT ??? A very good question, Mister Holmes. PYRAMIDE is a
company which publishes and distributes programs for the
Sinclair QL, and at this phase of development, we are very
aware of the enormous 'isolation' which surrounds owners of
this micro. The BT proposes to build a bridge between users,
and to become more and more a medium of communication and
information for you !
The answer to how often new publications will be made is
very simple : a new volume of the BT will appear as often as
we collect a sufficient number of choices of possible
interest to QL owners. Regarding the your role...
essentially, this first summer volume has been made possible
thanks to the contributions of the authors of PYRAMIDE
programs.
But the BT will have need of many more programs in the
future, and your contributions will be most WELCOME. We study
every program we receive on Microdrive, establish its value
if we can use it (you do not work for nothing !), or you
return your Microdrive with our reponse, if there is any
doubt.
What kind of programs are of interest to the BT? As a
general rule, there is no restriction on the theme. Small
programs which produce new graphics representations are
better than complex program structures, for example, or ways
of solving difficult mathematical problems... but there are
no limits to the possibilities.
We are mainly interested in SuperBASIC programs and small
routines in machine code which may add a BASIC keyword or
other utilities of this nature, graphic screens drawn by QL
Peintre or other similar programs. We are especially
interested in receiving hints and tricks for the QL or its
peripherals. There is a good chance that your name will be
mentioned with your contribution ! If your program needs
instructions or a 'Method of use', we suggest that you
provide the information in a QUILL file, like this letter.
Please allow me to introduce myself, in effect, I speak
with you, on this QL screen in person, Alexandre GASSMANN, at
your service ! I have (and I am !) been what might be called
the Editor in Chief of the BT. I am connected with PYRAMIDE
because I have developed some programs for them, and it is
with the permission of the other Authors that I am able to
present the choices for this first volume of the BT (what a
feeling!).
Please let me emphasise again the importance of your
contributions: without them, the there is no point to the BT!
If you have any specific questions or comments, please send
them to me, because that will allow me to get to know your
interests better. Without obligation, the BT serves to build
a bridge between QL owners, a sort of 'QL-Connection'...
Alexander GASSMANN
Editor of the BT
page 1
SUMMARY / INDEX OF THE ASTUCES No. 1 CARTRIDGE
Contribution Title Page
. PUISSANCE 4 3
A small program to play puissance 4. The PUISS4 _doc file
also contains also the rules of the game.
. COMPRESSION of the SCREEN 4
Routine in machine code which enables the compression of
graphic screens.
. A TRUE FILL (RE-PAINT) !! 5
At last a fill worthy of the name !
. MINI PAC MAN 6
Can you keep up the pace ?
. FINDING THE AVAILABLE MEMORY 7
Assembler routine to add a good utility keyword to SuperBASIC.
. LIMIT the INTRUDER 8
BASIC keyword to avoid an accidental or deliberate
interuption of the course of a program.
. PRINTED LISTING 9
How many of you pull your hair out when viewing or printing a
listing with the problems caused by non-printing characters ?
. CHANGE of APPEARANCE ! 10
Here is a collection of neater characters for your QL !
. QL MAGAZINE 11
A collection of tricks and tips for using the QL!!
After making your choice, input F3 plus G (for Goto) and then
the Page Number. You will then find all the details.
page 2
--> PUISSANCE 4
Author : Alexandre GASSMANN
Type : Concentration
Language : Basic
Size : env. 3k.
Load with : from basic, type lrun mdv1_PUISSANCE4
If you are familiar with the rules of the game, you may
begin playing (for two players). The use of the program is
self-explanatory.
You arrange your draughts on a "grid" of 7 by 6
compartments. With one turn each, you move your draught
across the top of the game board, above the columns, with the
left or right cursor keys, until you are satisfied. You
"move" the draught onto the board with <ENTER>. The draught
will fall to the bottom of the grid or the next place above
the lowest occupied space.
Regarding each stack : the first player who successfully
aligns 4 draughts in any one direction, wins. The QL will
then ask you if you would like to have a replay.
page 3
--> GRAPHIC SCREEN COMPRESSION
Author : Fran Moerel
Type : Utility
Language : Machine
Size : 500 bytes
Load with : adr=respr(33000)
lbytes mdv1_compress_rsp,adr
CALL adr
Several notes on the application : Instead of coding the
image (BLACK BLACK BLACK WHITE WHITE), this routine will
produce code as (3 BLACK 2 WHITE). This provides a method of
gaining a tremendous file/memory economy with large regular
surfaces.
If you use many points or textures, when the routine reads
a situation where BLACK WHITE BLACK WHITE occurs, it will
store it as (1 BLACK 1 WHITE 1 BLACK 1 WHITE). There is a
risk, therefore, that instead of reducing the size of the
file, the routine will increase file size... it depends on
the complexity of the image.
Here is the description of the BASIC keywords added to
make use of the routine :
* For compression, load the normal image with the lbytes
command and type COMPR 0.
* For de-compression, type EXPND 0 (only if a compressed
screen is in memory).
* To save compressed images, input sbytes
mdv1_your_screen,start,count (do not define the variables
START or COUNT, because this is implemented automatically by
the routine).
* To load the compressed image, input lbytes
mdv1_your_screen,start.
* To obtain the size (in bytes) of the compressed page,
type PRINT COUNT.
Note : The variable CHECK will return 1 if the image
exceeds 32K while it is compressing. If this occurs, the
procedure is abandoned.
To have two screens in memory, it is important to ensure
that the size of each one of the compressed screens does not
occupy more than 16K (because 32K is the amount reserved for
the routine with RESPR). To compress the first screen with
COMPR 0, type EC2 = COUNT; compress the second with COMPR
EC2. To regain either screen, input either EXPND 0 or EXPND
EC2.
In effect, the parameter of COMPR or EXPND is the address
location of the compressed screen (relative to the start of
the reserved area). The first screen, therefore, is in
position 0, and the location of the second screen is relative
to the first screen (the COUNT of the first compression).
page 4
--> PAINTING SURFACES
Author : Mick ANDON
Type : Utility
Language : machine
Size : 600 bytes
Load with : adr=respr(600)
lbytes mdv1_paint_rsp,adr
CALL adr
This routine will add a new keyword to BASIC, PAINT,
enabling you to overcome the limitations and problems, caused
by re-entrant shapes, of the SuperBASIC FILL command.
Syntax :
PAINT #(CHANNEL number),(x pos.),(y pos.),(colour)
It is important that the channel number is same as that of
a channel which is open over the entire screen. In order to
use PAINT, there are certain conditions which must be
observed:
OPEN #5,scr_512x256a0x0 (To use PAINT on this channel.)
The position of X or Y is defined in ABSOLUTE co-ordinates
and not relative...
Example : PAINT #5,100,150,2 will fill an enclosed area at
point 100,150 with the colour red.
page 5
---> MINI PACMAN
Author : Alexandre GASSMANN
Type : Distraction / game
Language : Basic
Size : It should not take more than 4k.
Load with : from basic, type lrun mdv1_MINI_PAC_bot
This version of Pac Man is similar to the original... but
there are no phantoms, for example. The game does, however,
require very fast reflexes and is more demanding...
The yellow muncher is moved around the game area,
sometimes littered with brick obstacles, to capture the
discs. You eat all the discs without colliding with any of
the brick obstacles. If successful, you will go to the next
level of play, which includes both faster movement and more
obstacles....
Good luck!!!
page 6
--> FUNCTION TO OBTAIN FREE_MEMORY
Author : Mick ANDON
Type : Utility
Language : machine
Size : 190 bytes
Load with : adr=respr(190)
lbytes mdv1_free_mem_rsp,adr
CALL adr
Rather than a new keyword, it is a new variable : FREE_MEM
Examples :
PRINT free_mem
or
10 IF free_mem<20000 then print "Not enough memory !"
page 7
--> Inhibiting the BREAK function of the QL
Author : Mick ANDON
Type : Utility
Language : machine
Size : 120 bytes
Load with : adr=respr(120)
lbytes mdv1_lock_rsp,adr
CALL adr
ONLY two keywords :
LOCK inhibits CTRL + SPACE
UNLOCK enables CTRL + SPACE
Simple !
page 8
PRINTED LISTING
The problems of listing non-printable ASCII codes that are
part of the QL character set are numerous. The
interpretation of printing control characters brought about
by, for example, a line feed or line space can become very
confused...
The simpler remedy consists of a 'filter' for all of the
QL's non-printing ASCII characters which can be replaced by
another symbol. The program LIST removes all the special
characters, which are then replaced by an asterix (*).
LIST is used in the following way :
. Save your BASIC program on cartridge
. Type lrun mdv1_LIST (provided that the BT is in drive 1)
. You then indicate the name of the program you want to
list (e.g. mdv2_my_prog or flp1_other_prog).
This routine also allows you to list programs on disk (or
on any other device).
page 9
NEW CHARACTERS
To use our new characters on your QL, simply type from
basic lrun mdv1_new_char
Your screen presentation will now have a new look... A new
look to the QL characters !
page 10
WELCOME TO THIS FIRST MAGAZINE OF THE C.A.
If you wish to consult individual headings at the end of
this document, in the same way you the have obtained this
magazine, press F3 and G, plus the page number corresponding
to the heading.
Please do not forget that the cartridge to Astuces (C.A.)
would not be possible without your participation. Therefore,
please send us you submissions on a QUILL file which can be
included in future editions of Astuces; also, the same
applies to program submissions.
Thanking you in advance...
A. Gassmann
(Editor-Chief)
SUMMARY OF BAG MAGAZINE NUMBER 1
TITLE PAGE NUMBER
Several hints and tricks 12
For you and your QL...
Useful addresses 13
For several POKEs as we like them
A letter from the Boss 14
Ah yes ! The grand patron of PYRAMIDE !
page 11
Several HINTS and TRICKS...
Here are several combinations of keys which you may find
interesting (almost the same as being a utility) :
CTRL + F5
Halts a basic listing (after the command LIST) without
breaking. To continue, press any key to re-start the listing.
CTRL + ALT + 7
Ah yes ! 3 keys at the same time. It is a destructive
function : on the QL, it is a TOTAL block. You will not be
able to continue (except with a RESET) !
Again TWO small tips for BASIC programming:
==
Eliminates confusion or error when entering upper or lower
case characters in response to SELect inputs. The following
line :
10 IF a$=='o' THEN PRINT 'Ok.'
has exactly the same effect that the line :
10 IF a$='O' OR a$='o' THEN PRINT 'OK.'
(== makes upper and lower case characters equal.
:
the symbol ":" can be used in place of THEN
10 IF a=5 THEN GO TO 100
has the same effect as :
10 IF a=5 : GO TO 100
Except that it is more compact...
page 12
POKEs as we like them...
POKE 98403,2 switches off the entire screen. You can
continue to type (but 'in the dark'...)
POKE 98403,8 to change modes : You change to a mode 8
screen (this can cause surprising results...)
POKE 98403,0 changes to mode 4 without corrupting the
screen.
Try running this line :
REPeat l : poke 98403,8 : poke 98403,2 : END REPeat l
with a screen design loaded in mode 4...
Here is a dangerous CALL:
Remove all cartridges from the microdrives, make sure that
there is nothing important in memory and type : CALL 382.
Better than invoking a simple RESET, you will go straight
into a magnificent CRASH, which can include all the colours,
sound, and possibly both drives going at the same time : A QL
gone mad !!! When he seems definitely "dead", try to press
the combination of CTRL+ALT+7. It could give him new life.
Make a RESET if you want to work again.
131072 is the ABSOLUTE address of the screen memory, with
a length of 32768 bytes.
POKE 163976,0 will turn the CAPS LOCK off.
POKE 163976,255 does the opposite : everything that you
type in will occur in upper case letters, after the POKE.
page 13
The LETTER from the Head of Pyramide
Madame, Monsieur
This cartridge represents the first newsletter for QL
users. But we hope that the users will supply future comments
between each other so as to make it unnecessary for us to
write any editorial material... In summary, this is YOUR
newletter.
In this spirit, send us your comments, questions, points
of view, requests, suggestions, programs, articles. We offer
to act as your co-ordinator or you can contact us directly.
PYRAMIDE has tried to fill the program gap on the QL by
writing 6 Titles, and each month makes it more... We hope
that the QL will not fall. Please try to support this Bag of
Tricks by your active participation. It would be the best
proof that the QL is more lively than ever.
The Editor
_____________________________________________________________________________
File: C:\Users\Rich\Desktop\TESTING\Pyramide\Bag of Tricks 1\BAG1_doc
Translated by Quill-View 0.5 Beta (compiled Oct 13 2008)
Copyright 2008 Mikael Strom