PAW

TECHNICAL

GUIDE

A Technical guide to:

The Professional Adventure Writer

A graphic adventure writing system for the Sinclair Spectrum computers

Converted to Word Format by Pablo Contreras

If Gilsoft want to sue me for this, please don't because:

a) I'm a great fan of your product and want to encourage its use
b) Nobody would buy it now anyway
c) I did buy PAW when it came out
d) I'm very skint

Although I've tried to keep errors out, I am only human so please e-mail me any corrections you may
find - my e-mail address is pablo@patrol.i-way.co.uk.
 
 
 
 

¸ 1986 Gilsoft International Ltd.
Program: T.J. Gilberts, G.Yeandle and P.Wade
Graphics: D.Peeke, K.Maddocks and A.Williams
Manuals: T.J. Gilberts

All Rights reserved. No part of this publication may be copied, loaned, hired or reproduced in any form
whatsoever including electronic retrieval systems without the prior written consent of the authors and
Gilsoft International Ltd.

The above notice does not apply to the 'run time' routines appended to, and which form a part of, a
saved game which you are free to distribute any way you wish in that form. All we would request is that
you credit the use of the Professional Adventure Writer somewhere within the game.

Acknowledgement

Thanks to Howard and Pam for their forbearance. Phil for his 'comments', Greame for his ideas, Dicon
et al for the graphics and all our customers for their support and suggestions.

Overview
PAW can be divided into three main functional areas thus:

1/ The Database

The database is the collection of tables organised in a logical manner, which contain all the information
to define an adventure game. This database is initially set up to contain a minimum of entries which
will probably be needed in every game. There is usually one entry in a table to simplify the operations
of the system. The database may utilise the additional sideways RAM pages of a 128K Spectrum.

2/ The Editor

This consists of a two level menu system i.e. most functions on the main menu present a sub-menu from
which all facilities can be selected. All facilities are set either from a command line as part of the sub-
menu option or in response to a prompt. This combination of menu and command line has been found
to be the most efficient both for the beginner and the more experienced user.

3/ The Interpreter

The real heart of PAW is contained in this section of the program. The next chapter deals with the
operation of the interpreter in detail, but it essentially fetches commands from the player and uses the
information contained in the database to decode and respond to those commands.

The sheer size of PAW precludes it being held entirely within the main memory area. On a 128K
Spectrum the majority of the code is held as overlays on a sideways RAM page and transferred into the
main area whenever required. A similar system is used on a 48K Spectrum by holdin three of the
overlays in free memory until the area of memory used is overwritten. If the sideways RAM page is
initialised on a 128K or the memory area overwritten on a 48K, an attempt to select an option not in the
current overlay will result in PAW attempting to lead the requisite overlay from cassette (or disc). The
main menu and overlay system gives an overhead of approximately 4K which is unavailable to PAW for
the database. About 10K is consumed by the interpreter and its workspace (e.g. Ramsave buffer, input
and wordwrap buffers etc.) This leaves approximately 27K for the database, plus 5 pages of 16K each,
on a 128K Spectrum (a total of about 117K). This is maximised by the inclusion of a text compressor
which introduces an overhead of 222 bytes (for an expansion dictionary) this giving about 40% effective
text compression. On an average text only game on the 48K Spectrum this provides an effective
addition of 8K of database space (i.e. a total of 35K).
The Interpreter
The following description of the interpreter should be read in conjunction with the flowcharts provided
overleaf.

Initialise
The background colours and character set are selected - the screen isn't cleared as this always occurs
upon describing location zero. The flags are all zeroed except for; flag 37, the number of objects
conveyable, which is set to 4; flag 52, the maximum weight of objects conveyable, which is set to 10;
flags 46 & 47, the current pronoun ("IT" usually), which are set to 255 (no pronoun) and glag 1 which
is set to be the number of objects carried but not worn. Note that clearing the flags has the effect that
the game always starts at location zero. This is because flag 38, the current location of the player, is
now zero.

Describe Current Location
If flag 2 is non zero it is decremented (reduced by 1). If it is dark (flag 0 is non zero) and flag 3 is non
zero then flag 3 is decremented. If it is dark, flag 4 is non zero and object 0 (the source of light) is
absent, then flag 4 is decremented.

The screen is cleared if the current screen mode (contents of flag 40) is not 1.

If it is dark, and Object 0 is absent, then System message 0 (referred to as SM0 - "It's too dark to see
anything") is displayed. Otherwise any picture present for the location is drawn and the location
description displayed without a NEWLINE.

Search Process Table 1
Flowchart 2 and the next section describe the scanning of a process table. Process table 1 is used
mainly to contain the entries to add extra information to the current location description. E.g. details of
open doors, objects present etc. It will also contain a PROTECT action, when using screen mode 4, to
set the screen line for text to scroll under.

We now enter the main loop of the interpreter which deals with teach time fame (i.e. each phrase
extracted or each timeout on input which occurs) and the response to players commands.

Search Process Table 2
This contains the main control for PAW's turn at the game. It is used to implement the movements and
actions of PSI's, the uncontrolled events such as bridges collapsing, and so on.

Get Phrase
If flags 5 to 8 are non zero they are decremented. If it is dark (Flag 0 is non zero) and flag 9 is non zero
then it is decremented. If it is dark and flag 10 is non zero is is decremented if object 0 is absent.

The parser is called to extract a phrase and convert it into a logical sentence - LS. If the input buffer is
empty, a new input line is obtained from the player by printing a prompt and making a call to the input
routine. The prompt will be the system message whose number is contained in flag 42 - a value of 0 will
select one of the system messages 2,3,4 or 5 in the ration 30:30:30:10 respectively.

If the timeout option is selected, by making flag 48 contain a value greater than zero, then the input
routine might time out. In this case SM35 ("Time passes.") is displayed and a return made to scan
process 2 again.

A phrase is extracted and converted into the logical sentence; by converting any words present, that are
in the vocabulary, into their word value and placing them in the required flags.

If no valid phrase can be found then SM6 ("I couldn't understand any of that") is displayed, and a
return made to scan process 2.

Search Response Table
Turns (flag 31 and 32), which is the number of valid phrases extracted by the parser, is increased by
one. Two flags area used to allow 256 lots of 256 turns (i.e. 65536).

The Response table is then scanned, for an entry which matches the Verb and Noun1 of the current LS,
using the process table routines detailed below.

If it is successful in carrying out an action (i.e. If PAW executes at least one action other than
NOTDONE) then a return is made to scan process table 2.

Search the Connections Table
A search is made of the connections table entry for the current location, for a word which matches the
current LS Verb. If one is found then the players current location (flag 38) is set to be the number
associated with the word. Then a return is made to describe the current location. Otherwise PAW
prints SM8 ("I can't go in that direction") if the current LS Verb has a word value less than 14 or SM7
("I can't do that") if it does not. In both cases a return is made to scan process table 2.

Flowchart 1

                      /-------\
                      | Start |
                      \-------/
                          |
                      +----------+
                      |Initialise|
                      +----------+
                          |
        +---\             |
        |D   >------------+---------------------------------------+
        +---/             |                                       |
                      +-----------+                               |
                      |Describe   |                               |
                      |Location   |                               |
                      |Process 1  |                               |
                      +-----------+                               |
                          |                                       |
+-------------------------|                                       |
|                         |                                       |
|                     +-----------+                               |
|                     |Process 2  |                               |
|                     |Get Phrase |                               |
|                     +-----------+                               |
|                         |                                       |
|                        /-\                                      |
|               No  /----   ----\  Yes                            |
^           +------<    Found?   >-------+                        |
|           |       \----\-/----/        |                        ^
|           |                            |                        |
|          /-\                      +-----------+                 |
|  No /----   ----\  Yes            |TURNS+1    |                 |
|  +-<   Timeout?  >----+           |Search     |                 |
|  |  \----   ----/     |           |Response   |                 |
|  |       \-/          |           +-----------+                 |
|  |                    |                |                        |
| /------------/   /----------/          |                        |
| |SM6         |   |SM35      |          |                        |
| |"I don't    |   |"Time     |          |                        |
| |"Understand"|   |Passes.." |          |                        |
| /------------/   /----------/         /-\                       |
|      |                |      Yes /----   ----\  No              |
+------+----------------+--<------<    Done?    >-----+           ^
|                                  \----\-/----/      |           |
|                                                     |           |
|                                                +-----------+    |
|                                                |Search     |    |
|                                                |Connection |    |
|                                                |Table      |    |
|                                                +-----------+    |
|                                                     |           |
|                                                    /-\          |
|                                           No  /----   ----\ Yes |
|                      +-----------------------<    Found?   >----+
|                      |                        \----\-/----/
|                     /-\
|                /----   ----\
|      +--------<  Verb<14?   >-----------+
|      |         \----\-/----/            |
|      |                                  |
|  /----------/                      /-----------/
|  |SM8       |                      |SM7        |
|  |"Can't    |                      |"Can't go  |
|  |do that"  |                      |that way"  |
|  /----------/                      /-----------/
|      |                                  |
+------+---------------<------------------+

Flowchart 2

                      /-------\
                      | Start |
                      \-------/
                          |
                          +-------------------------------------+
                          |                                     |
                         /-\                                    |
                No  /----   ----\                               |
+------------------                              |
|                   \----\-/----/                               ^
|                         | Yes                                 |
|                   /----/-\----\ Yes                           |
|                  ----------------+             |
|                   \----\-/----/                 |             ^
|                         | No              /----/-\----\ No    |
|                         |                < Verb Match? >------+
|                         |                 \----\-/----/       |
|                         |                       | Yes         ^
|                         |                 /----/-\----\ No    |
|                         |                < Noun Match? >------+
|                         |                 \----\-/----/       |
|                         |                       | Yes         ^
|                         +-----------------------+----<--------+-+
|                         |                                     | |
|                   /----/-\-----\ No                           | |
|                  -----------------------------+ |
|                   \----\-/-----/                              ^ |
|                         | Yes                                 | |
|                         |                                     | ^
|               No  /----/-\-----\ Yes                          | |
|        +---------<  Condition?  >---------------+             | |
|        |          \----\-/-----/                |             ^ |
|        |                                        |             | |
|   +-----------+                           /----/-\----\ No    | |
|   | Do Action |                          <   Succeed?  >------+ |
|   +-----------+                           \----\-/----/         |
|        |                                        | Yes           |
|  /----/-\----\ Yes    +---\                     |               |
| <    DESC?    >-------+ D  >                    |               |
|  \----\-/----/        +---/                     |               |
|        | No                                     |               |
|  /----/-\----\ No                               |               |
+-<    Exit?    >---------------------------------+---------------+
|  \----\-/----/                                                   
|
+--------+
         |
     /-------\
     |  End  |
     \-------/

Scan a Process Table
Response is a process table (Note that any sub-processes which are called from within Response exhibit
the same features), so it will also be scanned by this section of PAW> The difference of course is that
PAW tries to match the Verb and Noun1 of the logical sentence in a Response table.

Essentially PAW will look at each entry in the table until it is exhausted - the table of entries, not
PAW! Assuming there is an entry, it will, if in Response, ensure the Verb and Noun match those of the
LS. The use of the words "*" and "_", as either the Verb or the Noun, will cause a match with any word
in that part of the logical sentence. Thus entries in Response of "* *", "_ _", and combinations of same,
will cause a trigger of the entry no matter what the LS. This feature must be used in any table which
will be called by both a Response and a Process table. If in a Process the Verb and Noun will match
anyway, no matter what the logical sentence.

PAW will then look at each CondAct in turn; if it is a condition, which succeeds, then PAW will look
at the next condact. Otherwise it will drop out of the current condact list and look at the next entry, if
present, in the table - an exception to this is the CondAct QUIT which, if it fails, will drop out of the
table completely - this is not shown in flowchart 2 for clarity. If it is an action it will be carried out.
Actions can be divided into five main groups:

1/ Desc; which will completely exit the execution of all tables (i.e. even if in a 10th level sub-process)
and jump to describe the current location.

2/ END: (a group on its own) which will completely exit the execution of all tables and jump to
initialise a new game.

3/ Exit; any action which will stop processing of the current table and exit to the calling table (or back
to the main loop if in Response, Process 1 or 2). E.g. INVEN, DONE etc.

4/ Conditional Exit; any action which will stop processing of the current table and exit to the calling
table (or back to the main loop if in Response, Process 1 or 2) if it fails to do its required function. E.g.
GET, PUTIN etc. Otherwise it will continue with the next CondAct.

5/ Normal; any action which carries out its function, and allows PAW to continue looking at the next
CondAct in the current entry. E.g. COPYFF, PLUS etc.

It may be seen that QUIT acts like a type 4 action, but is still a condition, so its a CondAct! The
summary of CondActs at the end of this book shows which type each Action is.

The CondActs
There now follows a detailed description of each CondAct. They are divided into groups according to
the subject they deal with in PAW; such as flags, objects etc and give some hints as to a possible use.

Several abbreviations are used in the descriptions as follows.

locno. Is a valid location number.

locno+ is a valid location number or; 252 (not-created), 253 (worn), 254 (carried) and 255 which is
converted into the current location of the player.

mesno. is a valid message.

sysno. is a valid system message

flagno. is any flag (0 to 255).

procno. is a valid sub-process number.

word is word of the required type, which is present in the vocabulary, or "_" which ensures no-word -
not an anymatch as normal.

value is a value from 0 to 255.

Conditions
There are four conditions which deal with testing the location of the player as follows;

AT locno.
Succeeds if the current location is the same as locno.

NOTAT locno.
Succeeds if the current location is different to locno.

ACGT locno.
Succeeds if the current location is greater than locno.

ATLT locno.
Succeeds if the current location is less than locno.

There are eight conditions which deal with the current location of an object;

PRESENT objno.
Succeeds if Object objno. is carried, worn, or at the current location.

ABSENT objno.
Succeeds if Object objno. is not carried, not worn and not at the current location.

WORN objno.
Succeeds if object objno. is worn.

NOTWORN objno.
Succeeds if Object objno. is carried.

CARRIED objno.
Succeeds if Object objno. is carried.

NOTCARR objno.
Succeeds if Object objno. is not carried.

ISAT objno. locno+
Succeeds if Object objno. is not at Location locno.

ISNOTAT objno. locno+
Succeeds if Object objno. is not at Location locno.

There are eight conditions which deal with the value and comparison of flags;

ZERO flagno.
Succeeds if Flag flagno. is set to zero.

NOTZERO flagno.
Succeeds if Flag flagno. is not set to zero.

EQ flagno. value
Succeeds if Flag flagno. is equal to value.

NOTEQ flagno. value
Succeeds if Flag flagno. is not equal to value.

GT flagno. value
Succeeds if Flag flagno. is greater than value.

LT flagno. value
Succeeds if Flag flagno. is set to less than value.

SAME flagno1 flagno2
Succeeds if Flag flagno1 has the same value as Flag flagno2.

NOTSAME flagno1 flagno2
Succeeds if Flag flagno1 does not have the same value as Flag flagno2.

There are five conditions to check for an extended logical sentence. It is best to use these conditions
only if the specific word (or absence of word using "_") is needed to differentiate a situation. This
allows greater flexibility in the commands understod by the entry.

ADJECT1 word
Succeeds if the first noun's adjective in the current LS is word.

ADVERB word
Succeeds if the adverb in the current LS is word.

PREP word
Succeeds if the preposition in the current LS is word.

NOUN2 word
Succeeds if the second noun in the current LS is word.

ADJECT2 word
Succeeds if the second noun's adjective in the current LS is word.

The following condition is for random occurrences. You could use it to provide a chance of a tree
falling on the player during a lightning strike or a bridge collapsing etc. Do not abuse this facility,
always allow a player a way of preventing a problem; such as rubber boots for the lightning, or similar.

CHANCE percent
Succeeds if percent is less than or equal to a random number in the range 1-100 (inclusive). This a
CHANCE 50 condition would allow PAW to look at the next CondAct only if the random number
generated was between 1 and 50, a 50% chance of success.

A single condition to test for a timeout;

TIMEOUT
Will succeed if the last request for input from the player was allowed to timeout. For example an entry
in Process table 2 of; TIMEOUT MESSAGE 0 (where message 0 read "Come on sleepy") could be
created, perhaps with a CHANCE or a count of time outs to make it less monotonous!

The true CondAct;

QUIT
SM12 ("Are you sure") is printed and the input routine called. Will succeed if the player replies with
the first letter of SM30 ("Y") to the prompt. If not then Actions NEWTEXT and DONE are performed.

Actions

There are nineteen actions to deal with the manipulation of object positions;

GET objno.
If Object objno. is worn or carried, SM25 ("I already have the _.") is printed and actions NEWTEXT
DONE are performed.

If Object objno. is not at the current location, SM26 ("There isn't one of those here.") is printed and
actions NEWTEXT DONE are performed.

If the total weight of the objects carried and worn by the player plus Object objno. would exceed the
maximum conveyable weight (Flag 52) then SM43 ("The _ weighs too much for me.") is printed and
actions NEWTEXT DONE are performed.

If the maximum number of objects is being carried (Flag 1 is greater than, or the same as, Flag 37) ("I
can't carry any more things.") is printed and actions NEWTEXT DONE are performed. In addition any
current DOALL loop is cancelled.

Otherwise the position of Object objno. is changed to carried, Flag 1 is incremented and SM36 ("I now
have the _.") is printed.

DROP objno.
If Object objno. is worn then SM24 ("I can't. I'm wearing the _.") is printed and actions NEWTEXT
DONE are performed.

If Object objno. is at the current location (but neither worn nor carried), SM49 ("I don't have the _.") is
printed and actions NEWTEXT DONE are performed.

If Object objno. is not at the current location then SM28 ("I don't have one of those.") is printed and
actions NEWTEXT DONE are performed.

Otherwise the position of Object objno. is changed to the current location, Flag 1 is decremented and
SM39 ("I've dropped the _.") is printed.

WEAR objno.
If Object objno. is at the current location (but not carried or worn) SM49 ("I don't have the _.") is
printed and actions NEWTEXT DONE are performed.

If Object objno. is worn, SM29 ("I'm already wearing the _.") is printed and action NEWTEXT DONE
are performed.

If Object objno. is worn, SM29 ("I'm already wearing the _.") is printed and actions NEWTEXT DONE
are performed.

If Object objno. is not carried, SM28 ("I don't have one of those.") is printed and actions NEWTEXT
DONE are performed.

If Object objno. is not flagged as Wearable (WR option in the object weight menu) then SM40 ("I can't
wear the _.") is printed.

Otherwise the position of Object objno. is changed to worn, Flag 1 is decremented and SM37 ("I'm
now wearing the _.") is printed.

REMOVE objno
If Object objno. is carried or at the current location (but not worn) then SM50 ("I'm not wearing the
_.") is printed and actions NEWTEXT DONE are performed.

If Object objno. is not worn, SM23 ("I'm not wearing one of those.") is printed and actions NEWTEXT
DONE are performed.

If Object objno. is not flagged as wearable (and thus removable) then SM41 ("I can't remove the _.") is
printed and actions NEWTEXT DONE are performed.

If the maximum number of objects is being carried (Flag 1 is greater than, or the same as, Flag 37),
SM42 ("I can't remove the _. My hands are full.") is printed and actions NEWTEXT DONE are
performed.

Otherwise the position of Object objno. is changed to carried. Flag 1 is incremented and SM38 ("I've
removed the _.") printed.

CREATE objno
The position of Object objno. is changed to the current location and Flag 1 is decremented if the object
was carried.

DESTROY objno.
The position of Object objno. is changed to not-created and Flag 1 is decremented if the object was
carried.

SWAP objno1 objno2
The positions of the two objects are exchanged. Flag 1 is not adjusted. The currently referenced object
is set to be Object objno2.

PLACE objno. locno+
The position of Object objno. is changed to Location locno. Flag 1 is decremented if the object was
carried. It is incremented if the object is placed at location 254 (carried).

PUTO locno+
The position of the currently referenced object (i.e. that object whose number is in flag 51), is changed
to be Location locno. Flag 54 remains its old location. Flag 1 is decremented if the object was carried.
It is incremented if the object is placed at location 254 (carried).

PUTIN objno. locno.
If Object locno. does not exist or is not flagged as a container (option C on the object weight menu)
then a run time error is generated of "Illegal Argument".

If Object objno. is worn then SM24 ("I can't. I'm wearing the _.") is printed and actions NEWTEXT
DONE are performed.

If Object objno. is at the current location (but neither worn nor carried), SM49 ("I don't have the _.") is
printed and actions NEWTEXT DONE are performed.

If Object objno. is not at the current location, but not carried, then SM28 ("I don't have one of those.")
is printed and actions NEWTEXT DONE are performed.

Otherwise the position of Object objno. is changed to Location locno. Flag 1 is decremented and SM44
("The _ is in the"), a description of Object locno. and SM51 (".") is printed.

TAKEOUT objno. locno.
If Object locno. does not exist or is not flagged as a container (option C on the object weight menu)
then a run time error is generated "Illegal Argument".

If Object objno. is worn or carried, SM25 ("I already have the _.") is printed and actions NEWTEXT
DONE are performed.

If Object objno. is at the current location, SM45 ("The _ isn't in the"), a description of Object locno.
and SM51 (".")is printed and actions NEWTEXT DONE are performed.

If Object objno. is not at the current location and not at Location locno. then SM52 ("There isn't one of
those in the"), a description of Object locno. and SM51 (".")is printed and actions NEWTEXT DONE
are performed.

If Object locno. is not carried or worn, and the total weight of the objects carried and worn by the player
plus Object objno. would exceed the maximum converyable weight (Flag 52) then SM43 ("The _
weighs too much for me.") is printed and actions NEWTEXT DONE are performed.

If the maximum number of objects is being carried (Flag 1 is greater than, or the same as, Flag 37),
SM27 ("I can't carry any more things.") is printed and actions NEWTEXT DONE are performed. In
addition any current DOALL loop is cancelled.

Otherwise the position of Object objno. is changed to carried, Flag 1 is incremented and SM36 ("I now
have the _.") is printed.

Note: No check is made, by either PUTIN or TAKEOUT, that Object locno. is actually present. This
must be carried out by you if required.

DROPALL
All objects which are carried or worn are created at the current location (i.e. all objects are dopped) and
Flag 1 is set to 0. This is included for compatibility with older writing systems. Note that DOALL 254
will carry out a true DROP ALL, taking care of any special actions included.

The next six actions are automatic versions of GET, DROP, WEAR, REMOVE, PUTIN and
TAKEOUT. They are automatic in that instead of needing to specify the object number, they each
convert Noun (Adjective)1 into the currently referenced object - by searching the object word table. The
search is for an object which is at one of several locations in descending order of priority - see
individual descriptions. This search against priority allows PAW to 'know' which object is implied if
more than one object with the same Noun description (when the player has not specified an adjective)
exists; at the current location, carried or worn - and in the container in the case of TAKEOUT.

AUTOG
A search for the object number represented by Noun (Adjective)1 is made in object word order of
location priority; here, carried, worn. i.e. The player is more likely to be trying to GET an object that is
at the current location than one that is carried or worn. If an object is found its number is passed to
GET action. Otherwise if there is an object in existence anywhere in the game if Noun1 was not in the
vocabulary then SM26 ("There isn't one of those here.") is printed. Else SM8 ("I can't do that.") is
printed (i.e. It is not a valid object but does exist in the game). Either way actions NEWTEXT DONE
are performed.

AUTOD
A search for the object number represented by Noun (Adjective)1 is made in object word in order of
location priority; carried, worn, here. i.e. The player is more likely to be trying to DROP a carried
object than one that is worn or here. If an object is found its number is passed to the DROP action.
Otherwise if there is an object in existence anywhere in the game or if Noun1 was not in the vocabulary
then SM28 ("I don't have one of those.") is printed. Else SM8 ("I can't do that.") is printed (i.e. It is
not a valid object but does exist in the game). Either way actions NEWTEXT DONE are performed.

AUTOW
A search for the object number represented by Noun (Adjective)1 is made in object word in order of
location priority; carried, worn, here. i.e. The player is more likely to be trying to WEAR a carried
object than one that is worn or here. If an object is found its number is passed to WEAR action.
Otherwise if there is an object in existence anywhere in the game or if Noun1 was not in the vocabulary
then SM28 ("I don't have one of those.") is printed. Else SM8 ("I can't do that.") is printed (i.e. It is
not a valid object but does exist in the game). Either way actions NEWTEXT DONE are performed.

AUTOR
A search for the object number represented by Noun (Adjective)1 is made in object word in order of
location priority; worn, carried, here. i.e. The Player is more likely to be trying to REMOVE a worn
object than one that is carried or here. If an object is found its number is passed to the REMOVE
action. Otherwise if there is an object in existence anywhere in the game or if Noun1 was not in the
vocabulary then SM23 ("I can't do that.") is printed (i.e. It is not a valid object but does exist in the
game). Either way actions NEWTEXT DONE are performed.

AUTOP locno.
A search for the object number represented by Noun (Adjective)1 is made in object word in order of
location priority; carried, worn, here. i.e. The plyaer is more likely to be trying to PUT a carried object
inside another than one that is worn or here. If an object is found its number is passed to the PUTIN
action. Otherwise if there is an object in existence anywhere in the game or if Noun1 was not in the
vocabulary then SM28 ("I don't have one of those.") is printed. Else SM8 ("I can't do that.") is printed
(i.e. It is not a valid object but does exist in the game). Either way actions NEWTEXT DONE are
performed.

AUTOT locno.
A search for the object number represented by Noun (Adjective)1 is made in object word in order of
location priority; in container, carried, worn, here. i.e. The player is more likely to be trying to get an
object out of a container which is actually in there than one that is carried, worn or here. If an object is
found its number is passed to the TAKEOUT action. Otherwise if there is an object in existence
anywhere in the game or if Noun1 was not in the vocabulary then SM52 ("There isn't one of those in
the "), a description of Object locno. and SM51 (".") is printed. Else SM8 ("I can't do that.") is printed
(i.e. It is not a valid object but does exist in the game). Either way actions NEWTEXT DONE are
performed.

Note: No check is made, by either AUTOP or AUTOT, that Object locno. is actually present. This must
be carried out by you - if required.

COPYOO objno1 objno2
The position of Object objno2 is set to be the same as the position of Object Objno1. The currently
referenced object is et to be Object objno2.

There ae four actions which allow various parameters of objects to be; placed in flags, set fro flags - for
comparison or manipulation.

COPYOF objno. flagno.
The position of Object objno. is copied into Flag flagno. This could be used to examine the location of
an object in a comparison with another flag value. e.g. COPYOF 1 11 SAME 11 38 could be used to
check that object 1 was at the same location as the player - although ISAT 1 255 would be better!

COPYFO flagno. objno.
The position of Object objno. is set to be the contents of Flag flagno. An attempt to copy from a flag
containing 255 will result in a run time error of "Invalid Argument". Setting an object to an invalid
location will still be accepted as it presents no danger to the operation of PAW.

WHATO
A search for the object number represented by Noun (Adjective)1 is made in object word in order of
location priority; carried, worn, here. This is because it is assumed any use of WHATO will be related
to carried objects rather than any that are worn or here. If an object is found its number is placed in flag
51, along with the standard current object parameters in flags 54-57. This allows you to create other
auto actions (the tutorial gives an example of this for dropping objects in the tree).

WEIGH objno. flagno.
The true weight of Object objno. is calculated (i.e. if it is a container, any objects inside have their
weight added - don't forget that nested containers stop adding their contents after ten levels) and the
value is placed in Flag flagno. This will have a maximum value of 255 which will not be exceeded. If
Object objno. is a container of zero weight, Flag flagno. will be cleared as objects in zero weight
containers, also weigh zero!

Now ten actions to manipulate the flags;

SET flagno.
Flag flagno. is set to 255.

CLEAR flagno.
Flag flagno. is cleared to 0.

LET flagno. value
Flag flagno. is set to value.

PLUS flagno. value
Flag flagno. is increased by value. If the result exceeds 255 the flag is set to 255.

MINUS flagno. value
Flag flano. is decreased by value. If the result is negative the flag is set to 0.

ADD flagno1 flagno2
Flag flagno2 has the contents of Flag flagno1 added to it. If the result exceeds 255 the flag is set to
255.

SUB flagno1 flagno2
Flag flagno2 has the contents of Flag flagno1 subtracted from it. If the result is negative the flag is set
to 0.

COPYFF flagno1 flagno2
The contents of Flag flagno1 is copied to Flag flagno2.

RANDOM flagno.
Flag flagno. is set to a number from the Pseudo-random sequence from 1 to 100. This could be useful
to allow random decisions to be made in a more flexible way than with the CHANCE condition.

MOVE flagno
This is a very powerful action designed to manipulate PSI's. It allows the current LS Verb to be used to
scan connections table for the location given in Flag flagno. If the Verb is found then Flag flagno. is
changed to be the location number associated with it, and the next condact is considered. If the verb is
not found, or the original location number was invalid, then PAW considers the next entry in the table -
if present. This you could consider that PAW carries out the following imaginary entries on exit from
Response if no action has been done;

_ _ MOVE 38 ; Attempt to move player
DESC ; Describe this new loc.

_ _ LT 33 14 ; Movement word?
SYSMESS 7 ; "Can't go that way.."
DONE

_ _ SYSMESS 8 ; "I can't do that"

This feature could be used to provide characters with Random movement in valid directions; by setting
the LS Verb to a random movement word and allowing MOVE to decide if the character can go that
way. Note that any special movements which are dealt with in the Response for the player, must be
dealt with separately for a PSI as well.

Three actions to manipulate the flags dealing with the player;

GOTO locno.
Changes the current location to locno. This effectively sets flag 38 to the value locno.

WEIGHT flagno.
Calculates the true weight of all objects carried and worn by the player (i.e. any containers will have the
weight of their contents added upto a maximum of 255) this value is then placed in Flag flagno. This
would be useful to ensure the player was not carrying too much weight to cross a bridge without it
collapsing etc.

ABILITY value1 value2
This sets Flag 37, the maximum number of objects conveyable, to value1 and Flag 52, the maximum
weight of objects the player may carry and wear at any one time (or their strength), to be value2. No
checks are made to ensure that the player is not already carrying more than the maximum. GET and so
on, which check the values, will still work correctly and prevent the player carrying any more objects,
even if you set the value lower than that which is already carried!

There are seven actions which deal with the manipulation of the flags for the screen mode, format and
input etc;

MODE mode option
There are five screen modes each controlled by Flag 40 and set using the MODE action thus:-

Mode 0
If a picture (other than 'subroutine') is present in the database, the screen is cleared to the default
colours and the picture drawn. Once a key is pressed the original colours are restored, and the location
is described.

Mode 1
Text Only. Full screen scroll. Text is output to the screen continuously. CLS is not active on describe.

Mode 2.
If a picture (other than 'subroutine') is present in the database, the screen is cleared to the default
colours and the picture drawn. The original colours are restored, the area below the line given in Flag
41 is cleared and text printed from the same line.

Mode 3
As Mode 2 above but the picture does not scroll away.

Mode 4
A text only mode which protects the location description as if it were a picture, all other text scrols
under. You will probably need a PROTECT action at a suitable point in Process 1 (e.g. after
LISTOBJ?) as otherwise only as far as the last but one line of text will be protected.

In all graphic modes above; option 2 forces the border NOT to be set to the Paper colour - it's best to
select this in modes 2 & 3 as the border is reset as soon as the picture is fully drawn causing an
annoying flicker. Option 1 makes SM32 ("More.") appear when the screen area fils (unlike "Scroll?"
you cannot breakout - will, in the editor you can!). Option 3 of course provides both options and option
0 neither! e.g. MODE 4 1 will select a fixed text window with a "More." prompt.

LINE lineno.
This sets the line that text should be printed from in the split screen graphic modes, and in the case of
mode 2 the top line of the area to be cleared. Be careful when using a lower screen input (see INPUT
action) to allow at least four spare lines in the upper screen (not forgetting to account for the number of
lines used by the prompt and marker) or a runtime error will occur if a full input line is entered.

GRAPHIC option
This allows the way in which pictures are dealt with by PAW to be modified, there are three valid
options;

0 - Normal, any picture present for a location is drawn when the player first visits that location, and then
only if pictures are turned ON or a temporary redraw is requested.

1 - OFF, any pictures are completely ignored by PAW, even if a temporary redraw is requested.

2 - ON, any picture present for a location is drawn every time the player visits that location.

There is an option 3 (option = 2+1) but pictures OFF takes priority anyway, so it is redundant. The
current picture for a location can be redrawn by adding 128 to flag 29, this is a temporary redraw, which
can be used for when the player requests the picture in Normal mode. i.e. PLUS 29 128 DESC would
be required entry in Response.

PROMPT sysno.
Causes System message sysno. to be displayed whenever PAW obtains a command line from the player.
A value of 0 (default) will cause PAW to select one of SM2, SM3, SM4 or SM5 in the ratio
30:30:30:10 respectively. Note this does not affect the prompts displayed by the END or QUIT
condacts.

TIME duration option
Allows input to be set to 'time-out' after a specific duration in 1.28 secon intervals, i.e. the Process 2
table will be called again if the player types nothing for the specified period. 'option' allows this to
also occur on ANYKEY and "More." prompt. In order to calculate the number to use for the option
just add the numbers hown next to each item to achieve the required combination;

1 - While waiting for the first character of Input only.
2 - While waiting for the key on the "More." prompt.
4 - While waiting for the key on the ANYKEY action.

e.g. TIME 5 6 (option = 2+4) will allow 6.4 seconds of inactivity on behalf of the player on input,
ANYKEY or "More." and between each keypress. Whereas TIME 5 3 (option = 1+2) allows it only
on the first character of input and on "More.".

Time 0 0 will stop timeouts (default).

INPUT options
This action allows the way the input routine operates to be changed by selecting options. Some
combinations are of no use but are a by product of the way PAW works. To calculate the number to use
for the option just add the numbers shown next to each item to achieve the required combination;

1 - Will cause the input prompt, marker and cursor to be displayed in the lower screen area. This is the
preferred input mode for time out games, where timeout can occur between keypresses, as the input line
is not left partially printed if timeout occurs part way through.

2 - will cause PAW to print a copy of the input line when ENTER is pressed, this is for use mainly with
item 1 to allow the final input line to be displayed on screen so that the player knows what has been
typed.

4 - This will cause the reprint of any text input so far, when input is resumed after a timeout. Again
mainly for use with item 1 when timeout can occur between keypresses.

A default of INPUT 0 (no options) is assumed by PAW.

PROTECT
Used in conjunction with MODE 4 mainly. This action sets the current print line as the top of the
scrolling text window. It should only be used within Process 1 (it will be allowed elsewhere but has no
meaning) after any text you want protected has been printed. This is usually before / after a LISTOBJ
action as objects are usually the last thing printed.

It also has uses in other modes to allow say a picture and part of the location description to be
protected, with the remainder of the text scrolling underneath!

Three actions to deal with the printing of flag values on the screen;

PRINT flagno.
The decimal contents of Flag flagno. are displayed in the current temporary colours without leading or
trailing spaces. This is a very useful action. Say flag 100 contained the number of coins carried by the
player, then an entry in a process table of MES 10 ("You have ") PRINT 100 MESSAGE 11 (" gold
coins."), could be used to display this to the player.

TURNS
SM17-20 "You have taken x turn(s)." is printed where x is Flag 31 + 256 * Flag 32.

SCORE
SM21-22 "You have scored x%" is printed where x is Flag 30.

Thirteen (!) actions to deal with screen output and control;

CLS
Clears the screen to current background colours. Also clears the current print position and SAVEAT
position to 0,0.

NEWLINE
Prints spaces to the end of the current line and then resets the colours & character set to the current
background colours.

MES msno.
Prints Message mesno. in the current temporary colours, then carries out a NEWLINE action.

SYSMESS sysno.
Prints System Message sysno. in the current temporary colours.

PICTURE locno.
Draws graphics picture locno. regardless of whether it is a subroutine or main picture. Note: the screen
and colours are not cleared first as with describe location. This could be used to add (or take away if
you PRINTAT and MES to remove with spaces) parts of a picture. The sample game TEWK uses this
feature several times. Note that a picture will be drawn from the last point used by the previous picture
drawn!

PAPER n
Where n ranges from 0 to 9. Changes background paper colour.

INK n
Where n ranges from 0 to 9. Changes background ink colour.

BORDER n
Where n ranges from 0 to 7. Changes screen border colour.

CHARSET value
Changes main character set to value given if valid, otherwise no action is taken.

The next three screen control actions allow a section of text to be printed on the screen away from the
current print position. This could be used to provide an information line on top of the current picture,
or a section of text in a small window on the picture etc etc. TEWK uses this facility to provide its drop
down window inventory in response to the STATUS command.

SAVEAT
Flushes the current wordwrap buffer thus restoring the current background colours. Then saves the
current print position, overwriting any previously saved position.

BACKAT
Flushes the current wordwrap buffer thus restoring the current background colours. Then restores the
print position last saved by SAVEAT.

PRINTAT lineno. colno.
The current print position is changed to the specified value. note this will also flush the wordwrap
buffer and restore the temporary colours to the background colours.

Three actions dealing with listing objects on the screen. The first two are controlled by / set the value
of Flag 53 as desribed in the chapter on objects.

LISTOBJ
If any objects are present then SM1 ("I can also see:") is printed, followed by a list of all objects present
at the current location. If there are no objects then nothing (as in null, not the word!) is printed.

LISTAT locno+
If any objects are present then they are listed. Otherwise SM53 ("nothing.") is printed - note that you
will usually have to precede this action with a message along the lines of "In the bag is;" etc. It would
be possible to create an alternative to the INVEN action described next by using 254 & 254 as
parameters for LISTAT.

INVEN
This action is not affected by the continuous object list flag for compatibility with older writing
systems.

SM9 ("I have with me:") is printed. If no objects are carried or worn SM11 ("Nothing at all.") is
printed. Otherwise the object text for each object that is carried or worn is printed on a separate line. If
an object is worn its object text is followed by SM10 (" (worn)"), right aligned on the next line if it will
not fit on the same one. Action DONE is then performed.

The two actions which completely exit Response / Process execution;

DESC
Will cancel any DOALL loop, any sub-process calls and make a jump to describe the current location.

END
SM13 ("Would you like to play again?") is printed and the input routine called. Any DOALL loop an
sub-process calls are concelled. If the reply does not start with the first character of SM31 a jump is
made to Initialise. Otherwise a jump is made to the Editor (if it is present) or to the BASIC NEW
command.

Three exit table actions;

DONE
This action jumps to the end of the process table and flags to PAW that an action has been carried out.
i.e. no more condacts or entries are considered. A return will this be made to the previous calling
process table, or to the start point of any active DOALL loop.

NOTDONE
This action jumps to the end of the process table and flags to PAW that no action has been carried out.
i.e. no more condacts or entries are considered. A return will this be made to the previous calling
process table or to the start point of any active DOALL loop. This will cause PAW to print one of the
"I can't" messages if needed. i.e. if no other action is carried out and no entry is present in connections
for the current Verb.

OK
SM15 ("OK") is printed and action DONE is performed.

Four actions to allow the current state of the game to be saved and restored;

SAVE
The standard start tape message for the spectrum is printed at the bottom of the screen. When a key is
pressed the game position is saved to tape, then action DESC is performed. If BREAK is pressed
during the save a jump is made to Initialise. The save includes all information required to allow the
restoration of the game to the exact same as it was before the save, including the values of flags,
positions of objects, picture drawn flags etc.

LOAD
Loads data (which should be a game position) from tape, then action DESC is performed. If BREAK is
pressed during the load or a tape error is detected a jump is made to Initialise. If data is loaded which is
not a game position, a tape error will normally be detected.

RAMSAVE
In a similar way to SAVE this action saves all the information relevant to the game in progress not onto
tape but into a memory buffer. This buffer is of course volatile and will be destroyed when the machine
is turned off which should be made clear to the player. In addition it will also be cleared when you
return to the editor section of PAW - in case you then change the design of the game!

RAMLOAD flagno.
This action is the counterpart of RAMSAVE and allows the saved buffer to be restored. The parameter
specifies the last flag to be reloaded which can be used to preserve values over a restore, for example an
entry of:

RAMLO _ COPYFF 30 255
RAMLOAD 254
COPYFF 255 30
DESC

could be used to maintain the current score, so that the player can not use RAMSAVE / LOAD as an
easy option for achieving 100%.

Note: unlike SAVE and LOAD the RAM actions allow the next Condact to be carried out. They
should normally always be followed by a DESC in order that the game state is restored to an identical
position.

The actions could be used to implement an OOPS command that is common on other systems to take
back the previous move; by creating an entry in Process 2 (or Response) which does an automatic
RAMSAVE every time the player enters a move.

Two actions to allow the game to be paused to a time or until a key is pressed;

ANYKEY
SM16 ("Press any key to continue") is printed at the bottom of the screen and the keyboard is scanned
until a key is pressed or until the timeout duration has elapsed if enabled.

PAUSE value
Pauses for value / 50 secs. However, if value is zero then the pause is for 256/50 secs. Note that the
keyboard is disabled for the duration of the pause.

Two actions to deal with control of the parser;

PARSE
This action was designed to deal with speech to PSIs. Any string (i.e. a further phrase enclosed in
quotes [" "]) that was present in the players current phrase is converted into a LS - overwriting the
existing LS formed originally for that phrase. If no phrase is present or it is invalid, then PAWW will
look at the next condact. Otherwise the next entry is considered with the new LS of the speech made to
the PSI. Because it overwrites the current LS it must be used only in a sub-response table, the table will
have form of:

* * PARSE ; Always do this entry
MESSAGE x ; "They don't understand"
DONE

word word CondAct list ; Any phrase PSI understands

_ _ MESSAGE x ; as above or different message

there will be two or more calling entries which will be similar to:

SAY name SAME pos 38 ; Are they here?
PROCESS y ; Decode speech..
DONE ; LS destroyed so always DONE.

SAY name MESSAGE x ; "They are not here!"
DONE

NEWTEXT
Forces the loss of any remaining phrases on the current input line. You would use this to prevent the
player continuing without a fresh input should something go badly for his situation. e.g. the GET action
carries out a NEWTEXT if it fails to get the required object for any reason, to prevent disaster with a
sentence such as:

GET SWORD AND KILL ORC WITH IT

as attacking the ORC without the sword may be dangerous!

One action to deal with sound

BEEP duration pitch
Both duration and pitch may range from 0 to 255. Duration is in units of one hundredth of a second.
The value of itch is obtained by taking the value you would use in a BASIC BEEP command, adding 60
then dividing by 2.

Several actions which are more difficult to classify;

PROCESS procno.
This powerful action transfers the attention of PAW to the specified Process table number. This sub-
process will exhibit the same features as the table which called it. i.e. if called by Response, PAW will
match the Verb and Noun1 of the LS against the word entries as with the main table. Note that it is a
true subroutine call and any exit from the new table (e.g. DONE, OK etc) will return control to the
condact which follows the calling PROCESS action. A sub-process can call (nest) further process' to a
depth of 10 at which point a run time error of "Limit reached" will be generated.

DOALL locno+
Another powerful action allows the implementation of an 'ALL' type command.

1 - An attempt is made to find an object at Location locno. If this is unsuccessful the DOALL is
cancelled and action DONE is performed.

2 - The object number is converted into the LS Nound1 (and Adjective1 if present) by reference to the
object word table. If Noun (Adjective)1 matches Noun (Adjective)2 then a return is made to step 1.
This implements the "Verb ALL EXCEPT object" facility of the parser.

3 - The next condact and / or entry in the table is then considered. This effectively converts a phrase of
"Verb All" into "Verb object" which is then processed by the table as if the player had typed it in.

4 - When an attempt is made to exit the current table, if the DOALL is still active (i.e. has not been
cancelled by an action) then the attention of PAW is returned to the DOALL as from step 1; with the
object search continuing from the next highest object number to that just considered.

The main ramification of the search method through the object word table is; objects which have the
Same Noun (Adjective) description (where the game works out which object is referred to by its
presence) must be checked for in ascending order of object number, or one of them may be missed.

Use of DOALL to implement things like OPEN ALL must account for the fact that doors are often flags
only and would have to be made into objects if they were to be included in a DOALL.

RESET locno+
This action is designed to allow the implementation of multi-part games where the objects which are not
carried forward are reset to their starting location.

All objects which can be carried between parts must be present (with the same description) in each part.
Any others may be reused within each part at will.

Any objects which are present at the current location are moved to Location locno. And the current
location is set to be locno. Any other objects are set to the locations given by the Initially At table. No
effect on flags. Action DESC is performed when complete.

The suggested method of its use is given in the chapter on multi-part games.

EXTERN value
Calls external routine with parameter value. There is a special chapter dealing with this subject.

Detailed Description of the Database
The database consists of a number of inter-related tables and also contains an area of miscellaneous
information e.g. values of background colours, number of objects conveyable, character sets etc. On a
128K machine the main data areas and pointers are present for each RAM page. Effectively each page
is an independent database. The tables present (in the order they appear in memory) are:

UDG's
This table, which is 152 bytes long, contains the User Defined Graphics. The UDG's can be changed
with the character editor described later. Codes 144-162.

Shades
This table is 128 bytes long and contains the graphics Shade patterns. These can be changed with the
character editor as described later. Codes 0-15.

The above two tables are saved / loaded as a pair and are termed character set 0. (although the ROM set
provides codes 32-127).

Miscellaneous
Several small tables and values, 50 bytes in total.

Character Sets
This table is empty until a character set is inserted using the character editor. 768 bytes are used then
by each character set inserted.

Dictionary
This table contains only one byte until the compressor is used for the first time on the database. After
that it contains 222 bytes of expansion dictionary to allow the tokens 165-255 to be converted into the
letter groupings they represent.

The Process tables
These tables form the heart of the database providing the main game control.

The Response Table
Each entry contains the word values of the Verb and Noun for the LS the entry is to deal with followed
by any number of condacts. When the adventure is played, if there is an entry in the table which
matches the Verb and Noun1 of the LS entered then the condacts are performed. The condacts that may
be present and the effect that they have is fully specified in the description of the Interpreter. The order
of entries in the table is in ascending order of the Verb value. Entries which have the same Verb value
are held in ascending order of the Noun value. Entries with the same Verb and Noun value are held in
the order they were inserted into the database. The word "_" has a word of value 255 while the word
"*" has a word value of 1. An example of the order of the table, with word value shown in brackets, is
as follows:

* (1) * (1)
LOOK (30) UP (10)
LOOK (30) DOWN (11)
LOOK (30) _ (255)
GET (100) * (1)
GET (100) KEY (16)
GET (100) LAMP (26)
GET (100) LAMP (26)
_ (255) _ 255

The other process tables are held in the same format, but the words are ignored by PAW when they are
scanned, unless the process is called from within Response using a PROCESS action.

Process 1
Is canned by PAW after a location is described, to allow any additional information which forms a part
of the location description to be displayed.

Process 2
Is scanned by PAW after every time frame. That is after every phrase extracted from the player's input,
or after every time-out on input.

Any further sub-processes follow the initial three when begun on the Process option of the main menu.

The Verb and Noun used for each entry in Process 1 and 2 (and any sub-processes called from them)
have no meaning as they are ignored but can be used to provide a note as to the function of that entry
within the table.

Every process table has an overhead of seven bytes (21 are used in a null database as three - including
Response - are already present.) Each entry subsequently uses 5 bytes and each condact uses 1, 2 or 3
bytes depending on the number of parameters.

Note: If a word is deleted from the vocabulary, and no synonyms of it are present, then all entries in the
process tables (including Response) which contain that word, are also deleted.

The Object Text table
This table, which has an entry for each object, contains the text which is printed when an object is
described. Each entry uses 3 bytes plus the length of the text. An object is anything in the adventure
which may be manipulated and objects are numbered from 0 upwards. Object 0 is assumed by the
Interpreter to be a source of light. Whenever a new object text is inserted an entry of not-created is
made for that object in the Initially at table, an entry of "_ _" in object word and a weight of 1 unit
without a container or wear / remove attribute is inserted into the object weight table.

The Location Text table
This table, which has an entry for each location, contains the text which is printed when a location is
described. Each entry uses 3 bytes plus the length of the text. The entries are numbered from 0
upwards and location 0 is the location at which the adventure starts. Whenever a new location is
inserted a null entry for that location is also made in the connections table.

The Message Text table
This table contains the text of any messages which are needed for the adventure. The messages are
numbered form 0 upwards and each one uses 3 bytes plus the length of the text.

The System Messages
This table contains the messages used by the Interpreter. Each entry uses 3 bytes plus the length of the
text. The description of the Interpreter shows when these messages are used. In addition extra
messages can be inserted by the writer to provide messages for the game if so required.

The Connections table
This table has an entry for each location and each entry may either be empty (null) or contain a number
of 'movement pairs'. A movement pair consists of a word value of a Verb (or conversion Noun) from
the vocabulary followed by a location number. This means that any Verb (or conversion Noun) with
that word value causes movement to that location. A typical entry could be SOUTH 6 EAST 7 LEAVE
6 NORTH 5 which means that SOUTH or LEAVE or their synonyms cause movement to location 6,
EAST or its synonyms to location 7 and NORTH or its synonyms to location 5. Each entry uses 3 bytes
plus 2 bytes for each movement pair.

Note 1. The movement pairs contain the word value not the actual word. If a word value is deleted from
the vocabulary then all movement pairs which contain that word value are also deleted.

Note 2. When the adventure is being played it is only the LS Verb which will cause movement.

Note 3. If a movement is performed by an entry in the Response table using the GOTO action, then it
may not be needed in the Connections table, unless that entry is required for a PSI who can move
unconditionally.

The Vocabulary
Each entry in the table uses 7 bytes and contains a word (or the first five characters, if the word is
longer than five characters) a word type from 0 to 6 and a word value in the range 2-254. The types are:

0 - Verb
1 - Adverb
2 - Noun
3 - Adjective
4 - Preposition
5 - Conjugation
6 - Pronoun

Words with the same word value are called synonyms. The entries are held in ascending order of word
value and within each word value, entries with more spaces come first e.g.

U
UP
CLIMB
ASCEN(D)

where entries with the same word value also have the same number of spaces the entry inserted first
comes earlier e.g. CLIMB was inserted before ASCEN(D).

Note 1. Whenever the editor has to convert from a word value to a word it takes the first word with that
value of the required type.

Note 2. Verbs and Conversion Nouns with values less than 14 should be reserved for movement words.

The Object Initially At table
This table has a 1 byte entry for each object, which specifies the location at which the object is situated
at the beginning of the adventure. An object can also start the adventure being worn, carried or not-
created.

The Object Word table
This table has a 2 byte entry for each object, which holds the Noun and Adjective word values
associated with that object.

The Object Weight and Attribute table
This table has a one byte entry for each word. Bit 7 is used to show if the object can be Worn /
Removed (i.e. the WR option). Bit 6 is used to show that the object is a container (the C option) and
Bits 0 to 5 define the weight of the object (giving a range from 0-63).

The graphics area of the database grows DOWN from the top of memory:

The Location Flags
This table has a 1 byte entry for each picture; Bit 7 specifies if the picture can be drawn when that
location is reached (i.e. if the location is not a 'subroutine'), bits 0 to 5 describe the start PAPER &
INK for the picture while bite 6 is unused.

The Picture Table
Each entry in the table uses 3 bytes plus the length of the Drawstring. There are always the same
number of entries as locations in the adventure. The Drawstring is encoded as a variety of various
length commands which minimise the amount of memory needed to produce the drawing.

The Pointers
The main database pointers.

Detailed Description of the Editor
Each menu option is described in the order it appears;

Vocabulary
Insert I word No. Type

No. is in the range 2-254 and Type is in the range 0-6.

If word is not already present in the vocabulary it is inserted with a word value of No. and a type of
Type.

Delete D word
If word is present in the vocabulary, it, its type and its word value are deleted. If synonyms of the word
deleted are present in the vocabulary no further action is taken. However, if no synonyms are present,
then:

a) all entries in the process tables which use this word value (in respect of type also) are also deleted.
b) b) if the word value is less than 14 then all movements in the connection table which use this word
value are also deleted.
c) c) all entries in the Object Word Table which use this word value (in respect of type also) are set to
null.

Show synonyms S word
If word is present in the vocabulary, it and all other words with the same word value and type are
displayed. (Note that for Conversion Nouns - those less than 20 - any synonymous Verbs will also be
shown and vice-versa).

Print P (Type) or L (Type)
Printing is either to the screen using P or to the printer using L. If Type is specified only words of that
type are listed.

Note 1. Be careful using delete as it can also affect the process, connections and object word tables. It
can also take a long time (minutes) if the database is large.

Note 2. Verbs and Nouns with a word value of less than 14 are assumed to be movement words by the
Interpreter and cause SM7 (I can't go in that direction.") to be printed instead of SM8 ("I can't do
that").

Note 3. Word values from 2 to 254 can be used for each word type. The words will not be synonymous
because they are of a different type. This allows over 250 words of each type - even without synonums -
to exist in the vocabulary!

Location Text
Insert I
If the maximum number of locations has been inserted then the error "Limit Reached" is generated.
Otherwise the next available location number on the highest used RAM page (shown on the Free
Memory option) is allocated and a null entry is made for it in the graphic location text table. Processing
then continues with an automatic call to the amend routine to allow the writer to amend the null text
entry already set up in the location text table.

Begin new Page B
If all RAM pages have been used or the maximum number of locations have been inserted the error
"Limit Reached" is generated. Otherwise the next available RAM page has a null database created on it
an the next available location number is assigned. Processing then continues with an automatic call to
the amend routine to allow the writer to amend the null text entry in the new page.

Amend A locno.
The existing text for Location locno. is copied to the input buffer and displayed at the bottom of the
screen for amending. When ENTER is pressed the existing entry is replaced with the contents of the
input buffer.

Print P (locno.) or L (locno.)
Printing is either to the screen using P or to the printer using L. Printing starts with the text for
Location locno. or at the beginning if locno. is not specified.

Note 1. The start of an adventure is always at Location 0.
Note 2. There is a limit of 252 locations.
Note 3. You will be unable to begin a new page if all available location numbers have been previously
allocated.

Connections
Amend A locno.
The existing entry for Location locno. is decoded, copied to the input buffer and displayed at the
bottom of the screen for amending. When ENTER is pressed the input buffer is vetted to be empty or to
contain word locno. repeated any number of times. word must be a Verb (or Conversion Noun) which
is present in the vocabulary and locno must be present in the location text table.

If there are no syntax errors the existing entry is replaced with an encoded copy of the input buffer (i.e.
words changed to word values).

Print P (locno.) or L locno.
Printing is either to the screen using P or to the printer using L. Printing starts with the entry for
Location locno. or at the beginning if locno. is not specified.

Note 1. A location text must be present for a Location before connections can be present.
Note 2. Any Verbs (or conversion Nouns) in the Vocabulary may be used in the Connections table not
only movement words.
Note 3. When an entry is decoded (for Amend or Print) the word value is changed into the first Verb
(or conversion Noun) in the Vocabulary with that word value.

Graphics
Amend A picno.
The graphic database is expanded to provide a gap at the end of the reruired picture. The main loop of
the Graphics Editor described below is then entered. When return is pressed any gap still remaining is
removed. n.b. unlike editing text the database itself is changed, this you cannot abandon an edit with
CAPS SHIFT & 6 (it does a NEXT command for a start!).

Size S
The number of bytes between the start of the drawstring and the start of the next is calculated and
printed on the screen.

Print, Copy and Dump. P picno., C picno. and D picno.
picno. must be specified.

If D was selected a filename is requested.

The required picture is drawn on the screen.

If C was selected the printer COPY is called (see printer section for details).

If D was selected a SCREEN$ file is saved with the filename given (i.e. a code block of the screen
16384,6912), this file could then be used as a loading screen for the game or edited using another art
package.

Note 1. You cannot reload a SCREEN$ file into the database.

Default Colours
Amend A picno (Paper Ink)
A flag is set to indicate that picture picno. is a subroutine unless PAPER and INK valued are specified,
in which case they are stored as the default colours for the picture. All locations in the adventure which
do not require a picture should be Amended as a subroutine.

Print P or L
Printing is either to the screen using P or the printer using L. If the location is not a subroutine the
colours are printed.

Messages
Insert I
The next available message number is allocated and a null entry is made for it in the mesage text table
on the highest used RAM page (shown on the Free Memory option). An automatic call to the amend
routine is then made to allow the user to amend the null entry.

Begin new Page B
The next available message number is allocated to the null message on the next RAM page if it has ben
initialised on the location text menu. Otherwise the error "Page not initialised" is generated.
Processing countinues with an automatic call to the amend routine to allow the user to amend the null
entry.

Amend A mesno.
The existing text for message mesno. is copied to the input buffer and displayed at the bottom of the
screen for amending. When ENTER is pressed the existing text is replaced with the contents of the
input buffer.

Print P (mesno.) or L (mesno.)
Printing is either to the screen using P or to the printer using L. Printing starts with the text for
message mesno. or at the beginning if mesno. is not specified.

Note 1. There is a limit of 255 messages, but as system messages can be inserted and printed they can
also be used in the game providing 510 messages (although some are used!)
Note 2. You cannot begin a new page of messages without first initialising the page by inserting a
location on it.

System Messages
Insert
The next available system message number is allocated and a null entry made for it in the system
messaeg table on RAM page 0. An automatic call is then made to the amnd routine to allow the writer
to amend the null entry.

Amend A mesno.
The existing text for system message mesno. is copied to the input buffer and displayed at the bottom of
the screen for amending. When ENTER is pressed, the existing text is replaced with the contents of the
input buffer.

Print P (mesno.) or L (mesno.)
Print is either to the screen using P or to the printer using L. Printing starts with the text for system
message mesno. or at the beginning if mesno. is not specified.

Note 1. The description of the Interpreter shows where these messages are used. They may be changed
to use "You" instead of "I" if you prefer, i.e. "You're not wearing it", or even into different languages,
but be careful to maintain their meaning.

Note 2. Messages 30 and 31 are not really messages but contain the positive and negative replies used
in the QUIT and END condacts. Therefore be very careful changing these as action END is the main
way back to the Editor from the Interpreter. You shoudn't make them more than one character in
length, or the compressor may tokenise them!

Note 3. SM10 (" (worn") has its length calculated by INVEN. This means it should not include any
control codes, and must be re-entered if the compressor is used to remove any tokens. In addition, for
the calculation of screen position to work, it should start with a space.

Note 4. SM34 (the cursor) may contain any number of control characters, but, must not move the print
position more than one character space or input will become confused. Any input character will be in
the temporary colours in force at the end of this message.

Note 5. A further 202 messages may be inserted for your own use, but as there is no equivalent of the
MESSAGE action a NEWLINE action must be carried out explicitly if needed.

Note 6. CPM PAW uses messages 54 to 60. This should be borne in mind if you intend transferring a
game to another system.

Object Text
Insert I
The next available object number is allocated and a null entry is made for it in the object text atble. An
entry of not-created is made for it in the object initially at table, an entry of "_ _" in the object word
table and a weight of 1 unit without any attributes in the object weight table. Processing then continues
with an automatic call to the amend routine to allow the user to amend the null text entry already set up
in the object text table.

Amend A objno.
The existing text for Object objno. is copied to the input buffer and displayed at the bottom of the
screen for amending. When ENTER is pressed the existing text is replaced with the contents of the
input buffer.

Print P (objno.) or L (objno.)
Printing is either to the screen using P or to the printer using L. Printing starts with the text for Object
objno. or at the beginning if objno. is not specified.

note 1. Object 0 is considered by the Interpreter to be a source of light.

Note 2. There is a limit of 255 objects.

Object Initially At table
Specifies the location at which an object is situated at the start of the adventure.

Amend A objno. locno.
The existing entry for Object objno. is replaced with locno. which must either be present in the location
text table or be one of the special locnos. 252 not-created, 253 worn or 254 carried.

Print P or L
Printing is to the screen using P or to the printer using L.

Note 1. An object text must be present for an object before a start location can be present.

The Object Word table
Amend A objno. Noun Adjective
The existing entry for Object objno. is replaced with the values of Noun and Adjective which must be
present in the Vocabulary (or be an underline to set the entry to null).

Print P or L
Printing is to the screen using P or to the printer using L.

The Object Weight table
Amend A objno. Weight Option
The existing entry of Object objno, is replaced with the weight and option specified. The weight may
range from 0 to 64. The option specifies the object attributes and may take the values:

0 - No attributes
1 - The object is a container.
2 - The object is wearable / removable
3 - The object is a wearable / removable container!

Print P or L
Printing is to the screen using P or to the printer using L. The weight can be followed by "C" to
indicate a container an / or "WR" to indicate wearable / removable.

Note 1. You may only select the container attribute for an object, if a location with the same number
exists. This is because PAW trets this location as the "inside"!

Note 2. A container of weight 0 will not have the weight of its contents added to any calculation. This
could be used to create a magic sack or a levitation transporter etc.

The Process (including Response) tables
Two options are available only on the main Process sub-menu:

Begin new Table B
The next available process number is allocated and null table is created. Processing continues with a
call to the Select table option with the new table number.

Select table S No.
The specified table is made the currently selected table and the sub-menu is redisplayed.

The other options are available on both the Response and Process sub-menus:

Amend A Verb Noun (n)
If an entry number n is not specified the first entry in the table of Verb and Noun is copied to the input
buffer and displayed at the bottom of the screen for amending. Otherwise the entry number specified is
used (ranging from 0 to the number of entries inserted - 1). When ENTER is pressed the input buffer is
vetted to be empty, in which case the existing entry is deleted, or to contain any number of valid
condacts. If there are no syntax errors the existing entry is replaced with the contents of the input
buffer. Any following entries in the table with the same word values (i.e. Verb and Noun) are then
displayed in turn for amending in the same way.

Insert I Verb Noun (n)
Verb and Noun must be underline characters, asterisk characters or words which are in the vocabulary.
The word values of Verb and Noun (underline has a word value of 255, asterisk a word value of 1) are
used to find the correct place in the table for the new entry to be created. If any entries already exist for
Verb Noun and no entry number n is specified then the new entry will be created after the existing
entries. Otherwise the new entry will be created before the entry number specified. A null entry is
created at the appropriate place and an automatic call made to the amend routine to allow the user to
amend the null entry.

The condacts that may be used are shown in the description of the Interpreter and in the summary at the
end of this guide.

Print P (Verb (Noun)) or L (Verb (Noun))
Printing is either to the screen using P or to the printer using L. Printing starts at the first entry with
word values of Verb Noun. If Verb or Noun are not specified then a word value of 0 is assumed. This
P or L by itself starts at the beginning of the table.

Note 1. To delete an entry; amend it, so that no conditions or actions remain.

Note 2. There is a limit of 255 process tables. Calls can be nested to maximum of 10, after which an
error occurs.

Extra Options
Selects the other display for the main menu.

Test Adventure
"Do you require disgnistics?" is printed and any reply that doesn't start with "Y" is assumed to be
negative. A jump is then made to the Interpreter. If diagnostics were requested then whenever the
Interpreter's input routine is used, pressing ENTER without typing anything will result in the value of a
flag being displayed in the lower screen along with an input prompt. You can at this point type in the
number of another flag to display that flag's value or an "=" folowed by a number to set the flag
displayed to that value. Pressing ENTER returns to the input.

The main way back to the Editor from the Interpreter is by performing the action END in a process
table.

Free Memory
The number of unused bytes on each page are printed. Pages which have not yet been initialised are
shown as "unused" and if Page 7 currently contains the overlays this fact is also displayed. Following
the unused memory list will be lists of the last message and last location used on each page to allow you
to monitor them.

Note that on a 48K spectrum only page 0 will be displayed - as that's all there is!

Background Colours
The BORDER, PAPER & INK colours may be set to any valid values. INK 9 (i.e. contrast) is
recommended but please note that INK 9 behaves differently in the bottom part of the screen.

In addition if any character sets have been inserted into the database you will be able to select them as
the primary set.

Characters
Characters consist of an 8 by 8 pixel grid and define the way letters, numbers, punctuation, UDG's and
shades look on the screen. Initially only one character set is present, the one that is contained within
the spectrum ROM. This set is also considered to contain the 16 shade patterns (codes 0 to 15) and 19
UDG's (codes 144 to 162) and is termed Set 0.

Insert I
If the maximum number of character sets has not been reached the next available set number is
allocated. A 768 byte entry is inserted in the character table and a copy of the designs for 96 characters
(codes 32 to 127) in the ROM are copied into the entry. Otherwise an error of "Limit Reached" is
generated.

Amed A set character
The character specified from the set specified is presented on screen for possible amending. Only
characters 0 to 15 and 144 to 162 may be amended from set 0, whereas only characters 32 to 127 may be
amended from any other set.

The editor provides three areas of screen:

1/ The Grid
The bit patterns of a particular character are shown on a much enlarged (x8) grid of yellow and white
squares, any set bits being shown by a black square. Also present on the grid is a flashing red square
showing the current cursor position.

2/ The Test Patterns
To the right of the Grid are two test patterns of the current character as if it was a shade in both normal
& Inverted forms. This does not change as you change the Grid but it can be updated by pressing R for
Redraw.

3/ Status Area
This shows the current character, set and a summary of the commands available.

In order to modify the pattern use the cursor keys (CAPS SHIFT 5 to 8 on a 48K spectrum) to move the
flashing cursor. The state of the bit under the cursor can be changed at any time using the SPACE key.
ENTER will store the amended character back in the database. Q will abandon the edit leaving the
character unchanged.

Print and Copy sets P or C
The currently defined UDG's, Shades and inserted character sets are printed on the screen.

If C was selected then the printer COPY is called - see printer section for details.

Load and Save sets L set or S set

If set has been inserted a prompt is printed for a filename, the tenth letter is converted to a (c) sign and
the required set loaded or saved as specified. Saving / Loading set 0 acts on the 286 bytes of UDG's
and Shades.

Note 1. You cannot amend a character from a set or load a set until it has been inserted.

Note 2. The files for sets other than 0 are a standard 768 bytes spectrum character set. They could thus
be loaded into / defined with, a different designer as long as the filename ends in position 10 with a (c)
symbol.

Compress Text
"Compress database (Y/N)?" is displayed and any reply which dosn't start with "Y" is assumed to be
negative and causes a return to the main menu. Otherwise a 222 byte dictionary is inserted into the
databse. The database is then scanned for occurences of each of 90 common letter groupings which are
replaced with a signle byte token in the range 154 to 255. This method of compression reduces any text
in the game by approximately 40%. This could on a text only 128K game provide an equivalent of
160K of memory for the game!

Note 1. When editing text after compression the cursor will skip 2, 3, 4, or 5 characters due to the
tokenisation. Corrections should be typed in full as they will be re-compressed the next time the
compressor is used.

Save Database
The database area is saved to tape as a sequence of files, two per page. Then tenth position of the
filename is set by PAW as the latters A to L is sequence for each file.

Verify Database
The files for a databse previously saved to tape are checked for differences against the database curently
in memory.

Load Database
The files for a database previously saved to tape are loaded overwriting any database currently in
memory.

Very Important
If BREAK is pressed or a tape error is detected during a load then the database held in memory will be
corrupt and should not be used as it may corrupt the Editor and Interpreter. Under these curcusmtances
the only Editor option which may be used safely is Load Database and this should be used until a
database is loaded successfully.

Save Adventure
The Interpreter and database are saved to tape as a sequenceof files using the filename specified. They
are saved in such a way that the Adventure will auto run when loaded from BASIC using LOAD "" -
without the PAW Editor being present.

Verify Adventure
Verifies that an Adventure has been saved correctly.

Detailed description of the Graphic Editor
This section of PAW allows a variety of operations to be carried out on the drawstring for a location.
When editing, the string is laid out in memory as follows;

        +----------|
        |          |
        | NEXT     |    Any commands still undrawn
        +----------+
        |          |
        |          |
        | SPARE    |    Available memory
        |          |
        |          |
        +----------+
        | END      |    Temporary end marker
        +----------+
        |          |
        |          |
        |          |
        | DRAW     |    The main drawstring
        +----------+

A rubber banded line is used for drawstring; in the base point of the line (Known as 'point') shows the
last point plotted, moved to etc, the rubber banded end of line shows the next position of point or the
start point for a fill / shade etc.

The Editor provides four groups of commands. Any which insert a command into the drawstring require
a SYMBOL SHIFT key to be held down;

1) Drawstring Commands
ABS MOVE A
Moves point to the x,y position of end of the line setting only the attributes. This is coded as a PLOT
with Inverse and Over set on.

PLOT P
Sets the pixel at the end of the line according to Inverse and Over, then moves point to that position.

REL MOVE R
Moves point to the end of the line without affecting the screen. This is coded as a relative offset from
the old point.

LINE L
Draws (or fixes) a straight line from point to the end of line according to Inverse and Over, then moves
point to end of the line. The line is coded as a relative offset from the old point.

FILL F
The area from the end of line (relative) is filled using solid pixels. Fill works by passing a pattern to the
SHADE routine so the notes on SHADE apply also.

All the above use 3 bytes in the database.

SHADE S
The area from the end of lne (relative) is shaded with one of a large number of patterns. The database
contains 16 patterns (0-15) which can be changed using the Character Editor.

The pattern used for shading is determined as follows:
a) You are asked for 2 pattern numbers in the range 0 to 15. If you only want the one pattern then
specify the same number for both patterns.
b) b) The 2 patterns specified are OR'd together i.e. they are placed on top of each other.
c) c) If INVERSE was 'on' the resultant pattern is inverted, i.e. SET / RESET pixels are swapped.

Note 1. The shade first works in a downward direction and then in an upward direction. For speed,
when it is going down it doesn't look up and vice versa. Any areas the shade misses must be shaded
separetely, although careful choice of the start position for the shade will minimise this.

Note 2. If the area to be shaded is too complex, then the shade will be abandoned. It has to do this to
enable it to detect when it comes across an area which has already been shaded. This an area can only
be shaded once as an already shaded area will be too complex to shade again. You should not shade an
area then try to fill in the background with a fill command, use the Inverse option!

TEXT T
If any character sets have been inserted in the database, a set number is requested. Then a character
code in the range 32 to 162 is requested. This character is placed on screen in the character square (as
shown by the Grid command) that the tip of line is contained within. It is mainly designed to allow "the
fiddly bits" of a picture to be drawn using the character editor - thus using less memory than lots of
lines!

Text and Shade use 4 bytes in the database each.

BLOCK B
Causes a block of the currently selected colours to fill the rectangle of attribute squares which the line
defines the diagonal of.

Block uses 5 bytes in the database.

2) Colour Commands
INK X
The current ink is set to the value selected. INK 8 as in BASIC causes all ink to be taken from the
existing screen attributes.

PAPER C
Sets the current paper to the value selected. PAPER 8 as in BASIC.

FLASH V
The new value of Flash is requested (0,1 or 8)

BRIGHT Z
The new value of Bright is requested (0,1, or 8)

all the above use one byte in the databse.

INVERSE I
The state of Inverse (on/off) is toggled.

OVER O
The state of Over (on/off) is toggled.

Neither Inverse nor Over use any memory but their state is encoded as part of each future instruction
which is affected by them

3) Subroutine Command
GOSUB G
A picture number is requested which must be in the range 0 to locno. A scale value for the picture is
then requested. This can be from 0 to 7 where the number indicates the size of the picture in eighths - 0
means 'no scale' (i.e. 8/8).

Please note;

a) Scale only affects certain commands, these are MOVE RELATIVE, LINE, FILL and SHADE.
MOVE ABSOLUTE, PLOT, BLOCK and TEXT commands will note be scaled or relocated and
should generally not be used in subroutines (although they will work and can be used usefully
sometimes).
b) You may only nest subroutine calls to a level of ten. (nesting means calling a subroutine from
within a subroutine).
c) Scale does not affect GOSUB commands, i.e. if a GOSUB is used within a subroutine the string
drawn will be a fixed size and not scaled.
d) Calling the same routine you are drawing will cause a "Limit Reached" error as the limit of 10
subroutine levels will have been reached.

Gosub uses two bytes in the database.

4) Editing commands
START >
Puts the Drawstring pointer at the start of the drawstring.

NEXT \/
Executes next available drawstring command: if there isn't one the command is ignored.

PREVIOUS /\
Moves the drawstring pointer back one command and updates the screen.

DELETE
(CAPS SHIFT & 0 ON 48K) deletes the previous command in the drawstring and updates the screen.

DELETE NEXT
GRAPH(ICS) (CAPS SHIFT & 9 on 48K) deletes the next command if there is one.

GRID Y
Has a toggle action for a character grid of INK 0, PAPER 7 and PAPER 6. This allows exact positions
of colour boundaries to be taken into account while drawing.

JOYSTICK J
Toggles the Kempston (tm) joystick option on and off.

The keys around S move the end of line around one pixel at a time (this can be accelerated to eight
pixels a time by holding down the CAPS SHIFT key) thus:

Q W E

A S

Z X C

The joystick should be plugged into Port 2 of Interface 2 or the Spectrum Plus 2. Alternatively it can be
plugged into a Kempston (tm) interface in which case SYMBOL SHIFT & J should be used to enable
PAW to read it. CAPS SHIFT will also accelerate the rate of movement on the joystick. The Fire
button will act like SYMBOL SHIFT and L to draw a line.

Editor Error Messages and their meanings
Due to the complex nature of PAW many features can generate errors. Whenever an error is discovered
a message describing the error is printed in the lower section of the screen. PAW then waits for a key to
be pressed before returning to the menu on which that error occurred. There are two exceptions to this:

1/ After an error during editing a drawstring; the Drawstring pointer is positioned just before the
command which caused the error (i.e. a NEXT command will cause the error again). If you are unable
to correct the problem then DELETE NEXT can be used to delete the erroneous command. Note that
this may still leave further commands undrawn (which may cause another error).

2/ While an adventure is running; If the PAW editor is not present then a jump is made to initialise a
new game after the error report. Otherwise a diagnostic line is printed on the bottom line of the screen.
This displays the Process table, Verb and Noun of the entry and the condact in which the error
occurred. You are then provided with the flag diagnostics to help confirm where the error occurred.
When ENTER is pressed the normal error report is printed and a return made to the main menu of
PAW.

When using your own programs in conjunction with the EXTERN command any of the standard BASIC
errors can occur. Note though that the line and statement number are not printed - so test your program
thoroughly without the adventure present!

PAW also generates several errors of its own which are:

BREAK
BREAK was pressed during a peripheral operation or while a game was running.

STOP in INPUT
CAPS SHIFT & 6 pressed.

Tape loading error
as BASIC. Note that a tape error during a load database means that the database is corrupt and only
reloads should be attempted.

Database full
There is not enough room in the database for what you were attempting.

Limit reached
The maximum number of locations, messages, objects, process tables or RAM pages are already present.
Alternatively the maximum subroutine or sub-process depth has been reached - 10. This can also occur
if an attempt is made to DOAL while a DOALL loop is active.

Integer our of range
While drawing a picture a LINE command has gone out of range. This is usually due to a change of
position of the starting point while editing.

Out of memory
This indicates that the entry for a process or connection entry was to large for the buffer (unliketoly to
occur). Also occurs when attempting to start a new RAM page on a 48K spectrum, loading a 128K
game on a 48K spectrum or if insufficient workspace has been left e.g. by setting up fixed channels
before loading or by writing too big a program for use with EXTERN.

Invalid Argument
This error is printed when a condact discovers an illegal value. e.g. An attempt to set flag 38 to an
illegal location, an attempt to PUTIN / TAKEOUT on a non container object or to set an object at
location 255 (COPYFO only). But see point 2 above for diagnostic information.

Note 1. During input the Spectrum will emit a RASP if the screen and / or input buffer is full.

Note 2. If an entry is present in the database which is too big to fir on one screen, the Spectrum will
give out a RASP when the entry is displayed at the bottom of the screen for amending.

Note 3. If an abnormally large entry is inserted in the connections table using abbreviations e.g. N 1 W
6 S 4 etc and the abbreviations are deleted from the vocabulary, the movement entry (when decoded) i.e.
NORTH 1 WEST 6 SOUTH 4 etc could be too big for the input buffer. If this happens an out of
memory message will be produced. The remedy is to reinsert the abbreviations in the vocabulary.

PAW and printers
PAW prints to the printer using channel #3 (usually "P").

Should this be a ZX thermal printer (or the Alphacom equivalent) then all printout is directed to the
required ROM routines. The Thermal printers only work in 48k mode on a 128K spectrum and will
print exactly what is on screen including new character sets and so on. The "C" option on the
characters and graphics menus will COPY the screen as normal.

On a 128K spectrum the printer channel defaults to the RS232 port and again PAW will sense this. All
printout is directed through the port having filtered the character set thus:

0 - 31 are surpressed except for 7 & 13 which print a CR (13) and 6 (TAB) which prints as a space
32 - 127 are printed as a space.
128 - 162 are printed as a question mark ("?")
163 and 164 are expanded to be the keywords PLAY & SPECTRUM.
165 - 255 are expanded either to the standard keywords in an uncompressed database, or to the correct
letter groupings in a compressed one.

If you have Interface 1, it is possible to use the RS232 to print to a printer by opeding the "t" channel
with the command:

OPEN #3, "t"

before loading the PAW program. The channel will then operate as described above for the 128K
RS232.

In general it should be possible to use any printer interface which redirects channel #3 correctly - with
one proviso; it does not mind having its output address redirected.

Failing that if you are nifty with the old m/c you can write a specific printer driver. PAW prints an
address when it loads called PRTADD. This gives the address of the vectors within PAW for the
printer system defined as follows (character is in A):

PRTADD DEFW PRTRET ; Address of character output
COPVEC JP DOCOPY ; Make this your screen copy
PRTRET RET ; Put your driver here.

There is free memory up to 29504 decimal for this to be expanded into. Save your driver code from the
correct address with a filename with character position 10 set to "A" along with a file of no bytes with
the same name ending in "B". You must redirect channel #3 (to anything) to fool PAW that there is a
non thermal printer connected before you load it. Then use the Load database option from the main
menu to load your driver (PAW thinks it's a database an loads both files, one of which is your driver).

The Essays
There now follows a discussion of nine topics which rely on several features of PAW in combination
and are thus not so easy to describe under any one heading:

128K Considerations for those lucky 128K spectrum owners.
Colour Boundaries deals with the spikey problem of attributes.
The parser gives a little English lesson.
Screen Output starts a newline in descriptions.
Objects will be more flexible after reading this.
Multi-part games for when memory just isn't big enough.
Light & Dark throws some light on the matter?
EXTERN and SCREEN$ are just made for each other.
PSIs add a bit of character to your games!

Enough of the frivolity there are pages to fill...

128K Considerations
When loaded, only page 0 is in use and has about 25500 bytes spare. Pages 1, 3, 4, 6 & 7 are unused
but can hold 16K each.

Message & Location text, Connections, Graphics & Default Colours can use pages 1-7, all the other
tables only use page 0. All table entries for a location will be held within the same page.

When a location text is inserted null entries are made in the Connection, Graphics & Default Colour
tables for that location. The I option on the Location Text menu always inserts in the highest used page.
Option B on that menuis used to begin a new page i.e. it inserts on the next page. You have to decide
when to use B to start a new page but we would suggest that you use the compressor to gain all memory
available before starting another page as you cannot insert extra messages etc onto a page once a new
one has been started - only amend existing entries.

The start database supplied has location 0 on page 0 and youy will need to consider whether location 1
should be on a new page bearing in mind that ll the other tables can only use page 0. We would advise
all messages and locations are on pages 1 and up, as page 0 can soon become filled with vocabulary etc.

A similar thing applies to the message text table; I inserts on the highest selected page, B begins another
page if it has been initialised by putting a location on it!

If you want your game to run on a 48K spectrum then you must not use any page other than 0.

Colour Boundaries
Probably one of the most difficult aspects of using graphics on the Spectrum is the problem of the
attribute colour system.

This essentially means that only two colours can be used in any one 8x8 pixel group. The areas are
shown by the GRID option in the graphics editor. The two colours are the PAPER and INK, the colours
of reset and set pixels respectively. Both Paper and Ink can be any of eight values for each 8x8 pixel
group.

The fill and shade routines fill in a defined area with a pattern of set and reset pixels. So if you use
different INK and / or PAPER colours for two adjacent fills or shades, you will get a coarse stepping
effect. This is due to the colours for the second fill affecting pixels in the groups which were set by the
first.

This effect can be overcome in one of four main ways:

1 / Ignore it! This system is used on some pictures in the TEWK game. The effect is minimised by not
having shaded or filled areas directly adjacent to each other.

2 / Use shade fully. The shade system can be used along with just two colours to create very effective
pictures using varying densities of shade.

3 / Careful positioning as used in the tutorial manual. All areas are defined on exact attribute
boundaries. This has the effect of creating very cubist pictures.

4 / Alternate colour. This allows two areas of solid colour (not shades) to be adjacent to each other. It
sounds complicated but in principle is fairly straightforward: the diagram shows this far more simply
than reams of text.

The outlines of area A and B are drawn. Area A is filled using an INK of the first colour required. Area
B is filled using an INK of the second colour required. The block command is used on the rectangle (C)
with the PAPER set to be the second colour required and an INK of 8. This leaves area A and B
unchanged. The colouring of the PAPER makes the join look continuous.

The Parser
The parser works by scanning an input line (up to 125 characters) for words which are in the
vocabulary, extracting 'Phrases' which it can turn into Logical sentences.

When a phrase has been extracted, the Response and Connections tables are scanned to see if the
Logical Sentence is recognised. If not then system message 8 ("I can't do that") or system message 7 ("I
can't go in that direction") will be displayed depending on the Verb value (i.e. if less than 14 then
system message 7 will be used) and a new text input is requested. A new text input will also be
requested if an action fails in some way (e.g. an object too heavy) or if the writer forces it with a
NEWTEXT action. The results might otherwise be catastrophic for the player. e.g. GET AXE AND
ATTACK TROLL, if you don't have the axe you wouldn't really want to tackle the Troll!

If the LS is successfully executed then another phrase is extracted or new text requested if there is no
more text in the buffer.

Phrases are separated by conjugation ("AND" & "THEN" usually) and by any punctuation.

A Pronoun ("IT" usually) can be used to refer to the Noun/Adjective used in the previous Phrase - even
if this was a separate input. Nouns with word values less than 50 are Proper Nouns and will not affect
the Pronoun.

The Logical Sentence format is as follows:

(Adverb) Verb (Adjective1 (Noun1)) (preposition) (Adjective2 (Noun2))

where bracketed types are optional, i.e. the minimum phrase is a Verb (or a Conversion Noun - which is
a Noun with a word value < 20 - which if no Verb is found in a phrase will be converted into a Verb e.g.
NORTH). If the verb is omitted then the LS will assume the previously used verb is required. i.e. GET
SWORD AND SHIELF will work correctly! - the pronoun will be the first object in a list like this,
SWORD in the example.

Note that the phrase does not strictly have to be typed in by the player in this format. As an example:

GET THE SMALL SWORD QUICKLY
QUICKLY GET THE SMALL SWORD
QUICKLY THE SMALL SWORD GET

are all equivalent phrases producing the same LS. Although the third version is rather dubious English.

A true sentence could be:

GET ALL. OPEN THE DOOR AND GO SOUTH THEN GET THE BUCKET AND LOOK IN
IT.

which will become five LS's:

GET ALL
OPEN DOOR (because THE is not in the vocabulary)
SOUTH (because GO is not in the vocabulary)
GET BUCKET
LOOK BUCKET (from IT) IN (preposition)

Note that DOALL will not generate the object described by Noun(Adjective)2 of the Logical sentence.
This provides a simple method of implementing EXCEPT. e.g. GET ALL EXCEPT THE FISH, it has
the side effect of not allowing PUT ALL EXCEPT THE FISH IN THE BUCKET, as this has three
nouns!

Screen Output
Character sets are selected in text by selecting a colour 0-5 then a single DELETE to generate ESCCs 0-
5, and will only take effect if a corresponding set has been inserted.

ESCC 7 is a true newline (but does not reset colours as it is part of a message).

ESCC 6 works as a TAB but should be used with care as it will often be suppressed by the text
formatter when printing.

Colours and character sets selected within text will stay in force until a NEWLINE action. e.g. To print
the number of coins carried by the player (held in flag 100 say); If message 1 contains a RED PAPER
control code then an entry in Response (or a Process table) of:

COINS MES 1 ; "<RED>You are carrying"
_ PRINT 100
MESSAGE 2 ; " coins."
DONE

will result in the entire message being printed in red. This is called a compound message and can be
used successfully to create neat displays.

Objects
Underlines in text will be converted during gameplay into a description of the last object referenced by
GET, DROP, DESTROY etc. This is mainly to deal with the fact that GET, DROP etc report their
success (or failure!) but can be used usefully for examining objects and other automatic reports.

Flag 53 is used to control the way objects are displayed when the LISTOBJ and LISTAT actions are
used. If the flag is set to 64 (i.e. Bit 6 is set) then objects will be listed without newlines between them,
forming a valid English sentence - compound listing.

The formats are as follows:

SM53 ("nothing") - can only occur with LISTAT
object SM48(".")
object SM47(" and ") object SM48(".")
object SM46(", ") object SM47 (" and ") object SM48(".")

In addition, Bit 7 of flag 53 will be set (i.e. flag will be grater than 127) if any objects were printed.
This allows you to determine whether or nor a NEWLINE is required to reset colours.

A LISTAT action will usually be preceded by a message.

The description of object is constructed from the full description given in the object text table. The
preferred format for an object description is:

indefinite.article (adjective) noun . extra text

where; the indefinite article is "A" or adjectives "An" or "Some". The Adjective and the Noun should
have a lower case letter e.g. "A small key", "Some sand" or "An orange. Rather mouldy'. PAW extracts
a description of the object in two ways:

1/ For GET, DROP etc (i.e. "_") the indefinite article is skipped and the description printed upto (but
not including) the first full stop, e.g. "I now have the small key."

2/ For a compount list of objects the indefinite article is forced to start with a lower case letter and the
description printed upto (but not including) the first full stop. e.g. "In the bag is a small key.".

Obviously if you don't use underline or compound listings, then you are free to describe objects any
way you like.

Important: If an object is to be a container; there must be an unused location with the same number for
PAW to use as the "inside"! i.e. Object objno. 1 would need Location locno. 1 - Not forgetting to mark
it as a container ("C") on object weight!

Creating Multi-Part Adventures
In order to create a larger (and thus more interesting) play area in an adventure, without sacrificing the
quality of the description, you can split the game into smaller sections. It is best to do this with a game
that lends itself to having several areas, with only one join between each, this is called a bottleneck. e.g.
a game where setting sail on a boat is the final task in the first part.

To allow the score, turns taken and other information to be carried forward into the next game you must
use the LOAD / SAVE game position actions. In order to load a game position into a different game to
ahat which it was saved from, you need the same number of locations and objects in each part. In
addition, all objects which may possibly be carried forward by the player, must have the same
description in all parts.

Let's take a game with 120 locations, that is to be split in half, thus requiring 60 locations in each part.
Actually location 60 will exist in both games as the transition location (where the player starts and
finishes) and a spare flag (say 26) will be used to indicate which part of the game a position is from. So
when the player completes part 1 they are moved to location 60 and flag 26 is set to 1 to show it.

The setup for part 1 would be:

Location 60
End of Part 1 - Prepare a tape to save your position. (You may save more than one copy if you like).
Please LOAD part 2 and follow the onscreen prompts.

Process 1

END _ AT 60 ; End of game?
_ LET 25 1 ; Valid position from part 1.
SAVE

And in part 2:

Location 0
Part 2 - Prepare to load tape with saved position

Location 60
Any introduction wanted for Part 2.

Process 1

START _ AT 0 ; Just starting?
LOAD ; Will then be at another location

START _ NOTEQ 26 ; Not a valid position from part 1
GOTO 0 ; So request another load
DESC

START _ AT 60 ; Just loaded a valid position
ANYKEY ; Wait until introduction read
RESET 1 ; Start game properly at location 1

The RESET action does a DESC of the new start location automatically, after setting all objects that
aren't carried, worn or at location 60 to their starting position. Note that you should insert any CLEAR
actions for flags between the ANYKEY and the RESET as the flags are not affected by the RESET.

Light and Dark
Darkness is becoming something of a cliche in adventures these days, but used correctly it can add to
the sense of realism considerably.

Within PAW, darkness is created by setting flag 0 to a value other than 0. This must be done whenever
the player moves into and out of darkness, i.e. the move must be done with a GOTO in the Response
table, to allow the SET or CLEAR action to occur.

If the player is being provided with a source of light then object 0 is the easiest way of implementing it.
A source of light does not have to be a torch or candle, with a little imagination it can be infra-red
glasses or a wide beam laser!

Take for example the creation of a night and day cycle, over 24 time frames which we will assume are
equivalent to 1 hour.

The entries required in Process 2 are:

_ CYCLE EQ 5 0 ; End of cycle
LET 5 24 ; Start the counter again

_ NIGHT EQ 5 18 ; Nightfall
SET 0
MESSAGE X

_ DAY EQ 5 6 ; Daybreak
CLEAR 0
MESSAGE y

Importantly if part of the game is underground, or inside a building, don't forget to determine if the
player can actually see nightfall and daybreak from where they are, before printing the messages.

EXTERN and Loading screens
The EXTERN command can be used to call either your own machine language programs or a section of
a BASIC program. This feature can be utilised only in a final game, as the 4K of memory previously
occupied by the main menu becomes available (the other 2K is PAW's workspace so hands off!) The
important address is the value printed when PAW loads called EXTVEC. You must use the value given
on the copy of PAW you save the final game from, or chaos will ensue.

For machine coders only: In order that EXTERN can execute machine code routines you must POKE
the three bytes at EXTVEC with a JP to our start address. Register IX must be preserved as it points at
Flag 0. All others may be destroyed, but SP must be balanced. Register A on entry contains the
parameters to the EXTERN command. If you save the two bytes at EXTVEC+1 they point to the
routine which calls a BASIC program - the line number must be in A.

For BASIC users: a POKE extvec,195 - after loading the interpreter file - will enable any EXTERN
actions to execute the BASIC line (100+parameter) e.g. EXTERN 10 will goto line 110 in BASIC. To
return to the next condact a STOP command in BASIC is required. You cannot use CLS in BASIC (or
m/c), but address EXTVEC+3 contains a routine to do this. i.e. RANDOMIZE USR EXTVEC+3 will
clear the screen. In addition EXTVEC+12 contains the line number to print the filenames of the
database files on and EXTVEC+9 is the load database and start game entry point.

As an example the following program (without the REM's) must be saved to a fresh tape with SAVE
"gamename" LINE 10:

10 REM load game
15 BORDER 0: PAPER 0: INK 0: REM so filenames are invisible
20 CLEAR 29856: REM this is maximum value for RAMTOP.
25 LET extvec=?????: REM whatever it is...
30 LOAD ""SCREEN$: PRINT AT 19,0;: REM stops damage to pic!
40 LOAD ""CODE: REM load interpreter file
50 POKE extvec,195: REM enable EXTERN
60 POKE extvec+12,20: REM filenames on line 20
70 RANDOMIZE USR (extvec+9): REM load database and start game
100 REM line that is called by EXTERN 0
110 PRINT "hello from BASIC": STOP
355 REM line that is called by EXTERN 255!

Lines 100-355 could contain GOTO statements if required.

Save your SCREEN$ immediately after the program on the tape. Then from within PAW save the
Adventure (using option A) after that.

Important there must be at least 2000 bytes spare for PAW's workspace or your BASIC program will
start to disappear! RAMTOP may be lowered to contain your machine code but 2K must be spare!

Pseudo-Intelligence
The main thing to remember is that a character (or PSI) is a word in the Vocabulary (usually a Noun
with a value less than 50 so as to be a Proper Noun). Some flags, a series of messages and some entries
in one or more Process tables. One flag shows where they are, the messages provide information about
their actions and the process table entries tie it all together.

So imagine a character called Sanec who can walk around independently. He is described in the
vocabulary as SANEC (word value 25, Noun). Flag number 20 is used to give his location. Process
table 3 will deal with speech to him. While Process table 4 will deal with his movements and actions.
The following entries allow him to move around when you ask him to. After a short time he will get
"bored" and vanish in a puff of smoke!

Message 1
Sanec did not seem to understand what you said.

Message 2
No one of that name here!

Message 3
Sanec replies "hello" in a gruff voice.

Message 4
Sanec wanders that way as he has nothing bettern to do.

Message 5
Sanec the wizard is here.

Message 6
Sanec 'politely' ignores what you say.

Message 7
Sanec turns to face you and in his gruff voice announces; "I'm bored with all this, I'm off to a bigger
game" and promptly vanishes in a puff of green smoke!

First; Sanec's presence at a location must be announced. So in Process 1 (which is called after every
describe of a location) we check if he is here i.e. flag 20 (his location) is the same as flag 38 (our
location). Note that we ensure we are not at location 0 as this is always an introduction screen.

SANEC _ SAME 20 38 ; Ensure Sanec is here
_ NOTAT 0 ; Player is not in location 0
MESSAGE 5 ; Say Sanec is here

To deal with speech to Sanec, we need entries in Response as follows:

SAY SANEC PREP TO ; This could be imitted to allow
; Short Verb Noun sentences
; to be understood
SAME 20 38 ; Make sure Sanec is here
PROCESS 3 ; Deal with any speech
DONE

SAY _ PREP TO
MESSAGE 2 ; no one of that name here!
DONE

The following entries in Process 3:

* * PARSE ; This entry always carried out
; convert the input string to a
; LS
MESSAGE 1 ; PARSE comes here if it fails
; to find a valid phrase
DONE ; Note that the LS is corrupt
; and no further table entries
; must be executed

HELLO MESSAGE 3 ; Assuming HELLO is a verb in
; vocab
DONE ; so that SAY TO SANEC
; "HELLO" works

_ _ LT 34 14 ; A movement word said to
; Sanec?
MOVE 20 ; See if a connection for that
; way
MESSAGE 4 ; Come here and tell player if
; so

_ _ MESSAGE 6 ; He ignores you (i.e. nothing
; else)

Obviously many more entries would be required to give Sanec an appearance of understanding speech,
but with a few clever entries he can give a wide variety of responses.

Finally; to give Sanec a chance of disappearing when bored, we need an entry in Process 4 of:

SANEC _ EQ 20 2 ; At location two?
CHANCE 10 ; 10% chance
SET 20 ; Location 255 does not exist
AT 2 ; are we where he was?
MESSAGE 7 ; POOFF! - tell player he
; disappears

And an entry in Process 2 to call table 4 regularly:

SANEC _ PROCESS 4

In this way a very convincing character can be built up. They add a great deal to the sense of relism in
games. Especially if interaction with them is required as part of the solution.

Graphic Editor Commands
Occasionally when moving the line at speed it will disappear, this is due to a beat frequency of update
with screen flyback.

Moving the end of the rubber banded line is achieved with:

Q W E
A D
Z X C

at 1 pixel per move. Alternatively use Interface 2 / Plus 2 joystick port 2 or Kempston(tm) interface
(SYMBOL SHIFT & J).

Hold down the CAPS SHIFT key to accelerate to eight pixels per move.

The drawstring editing commands:

Cursor Right (CAPS SHIFT & 8) - Start of drawstring
Cursor Down (CAPS SHIFT & 6) - Next command
Cursor Up (CAPS SHIFT & 7) - Previous command
DELETE (CAPS SHIFT & 0) - Delete previous command
GRAPHICS (CAPS SHIFT & 9) - Delete next command

All the following commands require SYMBOL SHIFT to be held down unless otherwise specified.

The toggles:

I Inverse Toggle
O Over Toggle
Y Grid Toggle
J Kempston(tm) joystick toggle

The next commands all insert into the database:

A Absolute Move (a PLOT with I and O selected)
B Block in rectangle attribute area. Diagonal defined by line.
F Fill area from end of line. (See footnote)
G Gosub to location number with scale
X Ink (produces prompt for Ink selection)
L Line fix (draws rubber banded line)
C Paper Select
P Plot point at end of line
R Relative Move point to end of line
S Shade an area of screen from end of line with pattern
V Flash Select
Z Bright Select
T Text character on screen, selects character and set no.

Note: Fill and Shade are not completely re-entrant. Fill is a shade with all pixels in pattern set.

ENTER on its own to finish editing session.

The System Messages
The majority of system messages contain ESCC 7's to allow correct spacing on the screen.

SM0 - is used instead of the location description when it is dark.
SM1 - is printed by LISTOBJ if at least one object is present.
SM2 to SM5 - are the four input prompts which are selected randomly unless flag 42 is set to be a valid
message number.
SM6 - is produced by the parser when no further phrase can be understood.
SM7 - is produced if no action was carried out (or NOTDONE was) in Response when the Verb is < 14
SM8 - is produced if no action was carried out (or NOTDONE was) in Response when the Verb is > 13
SM9 to SM11 - are printed by the END action.
SM12 - printed by QUIT
SM13 and 14 - are printed by the END action
SM15 - the OK action message.
SM16 - the ANYKEY action message.
SM17 to SM20 - are the TURNS action messages.
SM21 and SM22 - are the SCORE action messages.
SM23 and SM29 - are the first of many messages produced by the object manipulating actions.
SM30 - the positive response expected by END and QUIT.
SM31 - the negative response expected by END and QUIT.
SM32 - produced when a screen full of text has appeared.
SM33 - the input marker.
SM34 - the cursor.
SM35 - displayed when a timeout occurs
SM36 to SM45 - are more messages produced by the object manipulating actions.
SM46 - the link between objects when listing continuously
SM47 - the final link between the last two objects when listing
SM48 - the termination of a list of objects (printed by both LISTOBJ and LISTAT, so take care.)
SM49 and SM50 - yet more object messages
SM51 - the termination for a compound sentence on PUTIN / TAKEOUT (and AUTOP / AUTOT)
SM52 - a final object message
SM53 - message for LISTAT action if no objects found.

SM54 onwards are free to be inserted for your own use. PAW on other machines may use more
messages, so bear this in mind if you intend transferring the adventure to another version. E.g. PAW
under CPM uses messages 54 to 60!

Function of PAW Flags
The normal flags are free for use in any way in games. The auto decrement flags (2 to 10) are also free
for use, but be sure you know in which situations they are reduced before using them. Other flags
should mostly only be set using the appropriate action, but useful tests can be carried out on their
contents.

Flag 0 - When non zero indicates game is dark (see also object 0)
Flag 1 - Holds quantity of objects player is carrying (but not wearing)

The following flags are decremented if non zero by PAW:
Flag 2 - When a location is described
Flag 3 - When a location is described and it's dark (Flag 0 not 0)
Flag 4 - When a location is described, it's dark and object 0 is absent.
Flag 5 to 8 - Every time frame (i.e. every phrase / timeout)
Flag 9 - Every time frame that it's dark
Flag 10 - Every time frame that it's dark and object 0 is absent

Flag 11 to 28 are free for use in your own games

Flag 29 holds Picture Control flags
Bit 7 - Set this to force picture to be drawn (LOOK)
Bit 6 - Set this to always draw picture (PICS ON)
Bit 5 - Set this to never draw picture (PICS OFF)
this is set by using the GRAPHIC action

Flag 30 - Score flag
Flag 31 / 32 (LSB/MSB) holds number of turns player has taken (actually this is the number of phrases
extracted from the player's input).

Flag 33 - holds the Verb for the current logical sentence
Flag 34 - holds the first Noun in the current logical sentence
Flag 35 - holds the Adjective for the first Noun
Flag 36 - holds the Adverb for the current logical sentence
Flag 37 - holds maximum number of objects conveyable (initially 4). Set using ABILITY action.
Flag 38 - holds current location of player.
Flag 39 - holds current top line of screen
Flag 40 - holds screen mode (range 0 to 4..) set with MODE action. Also bit 7 - Forces no change of
Border, Bit 6 Produces "More.." when screen fills.
Flag 41 - holds line number for split (if not in range 4-24 then 12 used) this is set by the PROTECT
action to be the current screen line.
Flag 42 - holds prompt to use (a system message number - 0 selects one of four randomly. Set by the
PROMPT action).
Flag 43 - holds the Preposition in the current logical sentence.
Flag 44 - holds the second Noun in the current logical sentence.
Flag 45 - holds the Adjective for the second Noun
Flag 46 - holds the current pronoun ("IT" usually) Noun
Flag 47 - holds the current pronoun ("IT" usually) Adjective

Flag 48 holds Timeout duration required
Flag 49 holds Timeout Control flags
Bit 7 - Set if timeout occurred last frame
Bit 6 - Set if data available for recall (not of use to writer)
Bit 5 - Set this to cause auto recall of input buffer on timeout
Bit 4 - Set this to print buffer on exit, (for use with Bit 3)
Bit 3 - Set this to take input from lower screen
Bit 2 - Set this so timeout can occur on ANYKEY
Bit 1 - Set this so timeout can occur on "More..."
Bit 0 - Set this so timeout can occur at start of input only

Set using INPUT and TIME (as is flag 48), TIMEOUT tests bit 7 of this flag.

Flag 50 - holds locno. for DOALL loop. i.e. value following DOALL
Flag 51 - holds last object referenced by GET / DROP / WEAR / WHATO etc. This is the number of
the currently referenced object as printed in place of any underlines in text.
Flag 52 - holds player's strengths (maximum weight of objects carried and worn - initially 10)
Flag 53 - holds object print flags
Bit 7 - Set if any object printed as part of LISTOBJ or LISTAT
Bit 6 - Set this to cause continuous object listing i.e. LET 53 64 will make PAW list objects
on the same line forming a valid sentence.
Flag 54 - holds the present location of the currently referenced object
Flag 55 - holds the weight of the currently referenced object
Flag 56 is 128 if the currently referenced object is a container
Flag 57 is 128 if the currently referenced object is wearable
Flag 58 & 59 should be avoided as they will be used for expansion.
Flag 60 to 255 are available for your own use.

The Condacts
Conditions:

AT locno ; ensure player at specific location
NOTAT locno
ATGT locno ; higher location than specified
ATLT locno ; lower...

PRESENT objno
ABSENT objno
WORN objno
NOTWORN objno
CARRIED objno
NOTCARR objno
ISAT objno locno+
ISNOTAT objno locno+

ZERO flagno
NOTZERO flagno
EQ flagno 0-255
NOTEQ flagno 0-255
GT flagno 0-255
LT flagno 0-255
SAME flagno flagno
NOTSAME flagno flagno

ADJECT1 word
ADVERB word
PREP word
NOUN2 word
ADJECT2 word

CHANCE 0-99 ; random possibility of success
TIMEOUT

QUIT

Actions (Those marked 4 are type 4, 3 are type 3, 1 are type 1)

GET 4 objno
DROP 4 objno
WEAR 4 objno
REMOVE 4 objno
CREATE objno
DESTROY objno
SWAP objno objno
PLACE objno locno+
PUTO locno+
PUTIN 4 objno locno.
TAKEOUT 4 objno locno.
DROPALL
AUTOG 4
AUTOD 4
AUTOW 4
AUTOR 4
AUTOP 4 locno
COPYOO objno objno

COPYOF objno flagno ; copy position of object to flag
COPYFO flagno objno

WHATO ; convert Noun1(Adjective1) to
; current object
WEIGH flagno objno ; weight of object is put in flag

SET flagno
CLEAR flagno
PLUS flagno 0-255 ; add value to flag
MINUS flagno 0-255
LET flagno 0-255
ADD flagno1 flagno2 ; contents of flagno1 added to flagno2
SUB flagno1 flagno2
COPYFF flagno1 flagno2
RANDOM flagno ; set to random number from 0-99
MOVE flagno ; adjust contents of flag according to
; the LS Verb and the Connection
; table entry for location, that the
; contents specify. (Allows movement
; of PSI's)
GOTO locno
WEIGHT flagno ; Weight of objects carried & worn
; are put in flag
ABILITY 0-255 0-255 ; Set conveyable objects and strength

MODE 0-4 0-3
LINE 0-20 ; Set screen line to split picture
GRAPHIC 0-3
PROMPT sysno ; Prompt on input. 0 is random
INPUT 0-7
TIME 0-255 0-7
PROTECT

PRINT flagno ; display contents of flag on screen
TURNS
SCORE
CLS
NEWLINE
MES mesno ; message without a newline
MESSAGE mesno ; message with a newline
SYSMESS sysno ; system message without newline
PICTURE locno ; Display picture (without CLS)
PAPER 0-9
INK 0-9
BORDER 0-7
CHARSET 0-255 ; Select character set (if inserted)
SAVEAT ; Save current print position
BACKAT ; return to it
PRINTAT 0-20 0-31 ; Set a new print position

LISTOBJ ; List objects at current location
LISTAT locno+ ; List objects at specified location
INVEN 3

DESC 1

END ; Type 2, Exits table to restart game

DONE 3
NOTDONE 3
OK 3

SAVE 1
LOAD 1
RAMSAVE
RAMLOAD flagno

ANYKEY
PAUSE 0-255 ; Delay program for n/50 of a second

PARSE ; Convert input string to valid LS
NEWTEXT ; Force the loss of remaining phrases

BEEP 0-255 0-255

PROCESS procno

DOALL locno+ ; Generate Noun(Adjective)1 for each
; object at Location locno.

RESET 1 locno ; Move player and present objects,
; reset others to initially at - used
; to chain games with LOAD

EXTERN 0-255 ; Call external program

Where:
locno. is a valid location number.
locno+ also allows the use of; 252 (not created), 253 (worn), 254 (carried) and 255 which is converted
into the current location of the player.
mesno. is a valid message.
sysno. is a valid system message.
flagno. is any flag (0 to 255)
procno. is a valid sub-process number.
word; is a word of the required type, which is present in the vocabulary, or "_" which ensures no-word -
not an anymatch as normal.

d