Home » Archimedes archive » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94 » !AWJune94/Goodies/Zap/!Zap/Docs/E-Command

!AWJune94/Goodies/Zap/!Zap/Docs/E-Command

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94
Filename: !AWJune94/Goodies/Zap/!Zap/Docs/E-Command
Read OK:
File size: 37CF bytes
Load address: 0000
Exec address: 0000
File contents
*************************************************************************
* >E-Command	Documents how to add commands to Zap			*
*************************************************************************

As mentioned in the ReadMe file, commands are added to Zap by registering a
table of commands when the module providing the extra commands initialises.
You should use the call Zap_AddCommands to register the table. The table has
the format below. All offsets are from your module start unless otherwise
indicated.

	#0	Offset of table from start of module (so Zap can convert the
		offsets below into addresses).
	#4	Offset from module start of 'Zap service call code' or 0
		if none. Zap calls this entry point to tell you about
		various things - see the section below.
	#8	List of commands, terminated by a zero word. Each element
		of the list has the format:
		
		<command name>+<0 byte terminator>+
		<ZERO bytes padding until word aligned>+
		<word giving command offset from module start>
		
The command name must be in UPPER CASE in this table. In general, command
names are not case sensitive, but they are converted to upper case in order
to search for them in the command tables. The characters padding to the next
word alignment MUST be ZEROs as the table is searched through in words not
in bytes.

When a command is found in the table, its address is calculated, and
henceforth the command is referred to by its address. This unfortunately
means that I cannot pass the command your module workspace when the command
is called as I do not know which module the command lies in. This is not
usually a problem however as you may claim workspace from Zap's heap. If this
is not sufficient, then you will just have to store the address of your
workspace in the module itself and read it when you are called (until I work
out a better method).

The address of the command is of course the address called when the command
is executed. However, at offset -4, the word before the first instruction of
the command, some flags are stored. These flags determine what type of
parameter the command takes and how the command interacts with the
minibuffer. This word must be filled in. It's meaning is as follows:

b0		Set if the command doesn't need R10 on entry (eg called from
b1		Set if the command doesn't need R8 on entry   a menu).
b2		Set if the command doesn't need R9 on entry
b3-b5		Argument type for the command:
		0 = Command takes no parameters
		1 = Command takes a list of bytes as parameter
		2 = Command takes a list of words as parameter
		3 = Command takes a string as parameter
		4 = Command takes a block of data as parameter
		5-7 reserved
b6		Set if you wished to be called before minibuffer opened
b7		Set if you wish to be called after every minibuffer update
b8		Set if you wish to be called before a key is inserted into
		the minibuffer (and possibly alter it).
b9		Set if you want TAB to complete file names in the minibuffer
b10		Set if you may want to kill the minibuffer when it starts up.
b11		Set if you may want minibuffer to remain open when command
		has finished.
b12		Set if you wish universal argument to multiply R1 by n on
		calling the instruction instead of calling it n times.
		If the command takes byte or word list data then the data
		is duplicated the given number of times.
b13		Reserved for Paul Moore's system.
b14		Set if the command should not be executed when loading a
		file to prevent Trojans.
b15-b31		Reserved - set to 0

Bits 0-2 are used by commands which may be called from a menu, and thus may
not be typed. You should leave them as 0.

The entry/exit conditions of your command depend on your flags word as I will
detail below. You are ALWAYS called with the following registers set up on
entry:

	R3 = info flags:
		b0 Set => The last command call was to this command as well.
			(eg to spot cumulative ctrl K's/Yanks).
		b1-b27 => Reserved
		b28-b31=> Top bits of R2 when command called via
			  Zap_ProcessCommand.
	R8 = window of the input caret (see E-Windows) (unless flags b1 set)
	R9 = file block associated with R8 (see E-File) (flags b2=0)
	R10 = cursor block pointer of input cursor (see E-Cursors) (b3=0)
	      (This is car_cursor if the cursors are combined and
	       car_input if they are split - see E-Vars).
	R13 = small FD stack
	
And in general registers R0-R2 have the meaning:

	R0 = data pointer (your input)
	R1 = number of times key was pressed (all key presses are buffered)
	R2 = action code (if you have a string argument)

On exit from a command you may corrupt the registers R0-R11 and the flags.
You should return V flag set and R0=error block on error. Some of the
minibuffer calls with R2<>0 require you to return a result in R0. To detail
the actual meaning of R0-R2 I have partitioned into cases below. Registers
not mentioned are undefined.

If you want to call a command yourself, then please use the call
Zap_ProcessCommand or Zap_CommandString. All calls from Zap are made by this
method. See the file 'Commands' for the syntax used when typing a command
into the keys file, or sending it to Zap_CommandString.

Data type = None (0)
--------------------

Then R1=Number of times key pressed, and R0,R2 are not used. If the same
command is bound to more than one key then all the buffered keypresses may
not be due to the same key! Eg, the command UP. In the keys file it should
appear with no parameters.

Data type = Byte list (1)
-------------------------

Then R0=Pointer to a list of bytes, and R1=Number of bytes in the list. Eg,
the command CHAR. In the keys file, the command should appear with a byte as
parameter, eg CHAR 143 (or CHAR n where n is substituted for the key number
it lies on). Thus if the user types A,B,C which have the commands CHAR 65,
CHAR 66, CHAR 67 assigned to them, then the command will be called once with
the list 65,66,67 if the keypresses were buffered.

Data type = Word list (2)
-------------------------

Then R0=Pointer to a list of words, and R1=Number of words in the list. This
works as for the byte list data type except that the command takes a word
(4 bytes) as parameter.

Data type = String (3)
----------------------

All strings in this section are zero terminated. When you are passed R0 as
the contents of the minibuffer, this excludes the prompt (see Zap_MiniWrite).
In the following calls, R2 gives the action code distinguishing them.

CASE 1 - A string is specified after the command in the keys file (eg INSERT
	"Hello").
	
	In this case you are called with R0=pointer to the string R1=number
	of times the key was pressed. R2=0.
	
CASE 2 - No string specified in the keys file (eg INSERT).
	
In this case, a minibuffer is opened for the user to type in the string for
the command to use. Most of the flags in the flags word control the way the
minibuffer works. If the flags in bits 6+ are all clear then everything is
handled automatically for you and you are called with R2=1 and R0=minibuffer
contents when the user types RETURN. The detailed workings of the minibuffer
are described below. Please supply a prompt (use b6) where possible.

The following happens before the minibuffer is opened on screen:

First of all, the minibuffer is cleared. If you wish to be called at this
point (eg to add a prompt) then set b6 of your flags word and you will be
called with R2=6 (R0,R1 undefined, R8-R10 setup as usual). You should then
insert your prompt using Zap_MiniPrompt. Please look at Zap_MiniWrite for
other ways of changing the minibuffer contents. It is possible that you may
wish to kill the minibuffer at this point, before it is opened, as an null
argument may sometimes be acceptable. For example, the command SAVEFILE
(Emacs CTRL-X CTRL-S) only wants to open a minibuffer if the file is untitled
(does not have a full path name). To do this, set b10 of your flags word (in
addition to b6) and return R0=0 to open the minibuffer as usual, or
R0=pointer to the string argument you want the command to be executed with.
Your command will then be called again with R2=0 and R0=the parameter you
have passed. This method ensures that the command is learnt correctly, as
only command calls with R2=0 or R2=1 are learnt. Minibuffer setup calls with
R2>1 are NOT learnt when you are in 'learn a key sequence mode'.

Now the minibuffer is opened on screen. The following happens when a key is
typed by the user:

If you have b7 and b8 cleared then the key is inserted into the minibuffer
automatically. ESCAPE and CTRL-G cause the minibuffer to close (without
calling you) and RETURN causes your command to be called as described
below.

If you want to intercept keys BEFORE they are acted on then set b8 of your
flags word. You will then be called with R2=&8000+Zaps internal key number,
and R0=the minibuffer contents string when the key is typed. After you have
dealt with the key, you return a value in R0 to tell the minibuffer what to
do with the key. There are 3 possible cases:
 R0=-1		In this case no change is made to the minibuffer. Command
		processing continues as normal (you will be called if b7
		of your flags word set etc).
 R0=key number	Then the given key is acted on as if it were the one typed.
 		Hence you will usually exit by SUB R0,R2,#&8000.
 R0=&8000	In this case, the minibuffer is quitted as if Return had
    +key number	been pressed (ie you are called with R2=1 as described
		below). Then, AFTER the minibuffer has been closed, the
		indicated key will be acted on as if typed in the editing
		window. This enables keyboard-search to be quitted by, for
		example, up arrow or ctrl X.
 (If you just want to quit the minibuffer then return R0=&1B=ESCAPE).
 One common use of this call is to trap the TAB key for completing an entry
(eg command name or filename). If you set b9 of your flags word, then Zap
assumes the buffer contains a file name and automatically completes the file
name when TAB is pressed, saving you all the work!

If you want to examine the minibuffer contents AFTER the character has been
entered into the minibuffer by Zap, you should set b7 of your flags word. You
will then be called with R0=the minibuffer contents string, and R2=7. This
call (as with the previous one) is made before the minibuffer contents is
updated on screen and thus you don't need to call Zap_MiniUpdate if you alter
the minibuffer contents. For example, search as you type (CTRL-S) uses this
call to jump to the next match after every key press.

Zap enters keys into the minibuffer until the user presses ESCAPE, CTRL-G or
RETURN. The first two quit the minibuffer.

When the user presses RETURN, you are called with R0=pointer to string typed
into the minibuffer, and R2=1. As usual, the string pointed to by R0 does not
include the prompt. You should then perform the command action, with this
string as input. Usually, the minibuffer will be closed after your command
has finished. If you wish it to remain open (eg the COMMAND command) then
set b11 of your command word, and return R0=0 to close the minibuffer and
R0=1 to leave it open when you exit from being called with R2=1.

The codes R2=1 and R2=0 should cause the same action to take place. This is
to ensure the LEARN function works correctly. When a learnt function is
executed, the minibuffer will not be opened again, but the command will be
called with R2=0 and the previously typed string as input in R0. For example,
if you learn the sequence: ctrl-S , "wibble" , RETURN typed in the
minibuffer, then when this is played back the command SEARCHFORWARD will be
called with R2=0 and R0="wibble" as opposed to opening the minibuffer. Only
command calls with R2=0 or 1 are learnt.

Data type = Block (4)
---------------------

Then R0 = pointer to a data block (of command dependant format), and
R1=number of times key pressed. This argument type is used by the command
MULTICOMMAND which is used internally within Zap to execute a list of other
commands. For example, when you type a sequence of commands separated by a
":" in the keys file, then this is converted to the one command MULTICOMMAND
with data block as a list of the functions to call. You cannot put such a
command in the keys file as there is no way of specifying a data block as
parameter.


EXAMPLE
-------

The code below implements a simple command which asks you to enter a number
into the minibuffer and then switches to that display mode. FNcall is a macro
which calls the named Zap entry point (see E-Zapcalls for its definition).

	EQUD (3<<3)+(1<<6)		\ string argument + ask for prompt
	.command_start
	STMFD R13!,{R14}
	TEQ R2,#6			\ is the minibuffer about to open
	BEQ add_prompt
	FNcall(Zap_MiniEval)		\ find the number typed
	LDMVSFD R13!,{PC}		\ error
	LDMCSFD R13!,{PC}		\ wasn't a valid number
	FNcall(Zap_NewMode)		\ change mode
	LDMFD R13!,{PC}			\ finished
	.add_prompt
	ADR R0,prompt_string
	FNcall(Zap_MiniPrompt)		\ insert the prompt string
	LDMFD R13!,{PC}		 
	.prompt_string
	EQUS "New mode: "
	EQUB 0
	ALIGN

It is the offset of command_start that you must place in your command table,
not the offset of the EQUD flags word before it. Note that the command
performs the same action regardless of whether R2=0 or R2=1.


Zap service calls
-----------------

If the second word in your command table is non zero then it gives the
module offset of a 'Zap service call handler'. This code is called at
various points to tell you about things. In general the entry/exit
conditions are:

	\E	R1=reason code and other registers may hold data.
		R11=undefined
		R12=Zaps workspace pointer as usual.
	\X	You should preserve R1-R13 unless otherwise stated.
		R0 and flags may be corrupted.
		
The (current) service calls are listed below. You should ignore unrecognised
values in R1 so I can add more if necessary.

R1=0
Zap is quitting and about to kill your module. Return R0=-1 to stop it.
Your module will NOT be automatically killed if have no service call handler
(for backwards compatibility).

R1=1
Zap has just started but has not set up its heap yet.

R1=2
Zap has started and set up its heap. You should use this call to claim any
workspace via Zap_Claim.

R1=3
Zap is deleting a file. R9=file block of file being deleted. (See E-File)

R1=4
Zap is deleting a window. R8=window block of window being deleted.
(See E-Windows)
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 2a 2a 2a 2a  2a 0a 2a 20 3e 45 2d 43  |*********.* >E-C|
00000050  6f 6d 6d 61 6e 64 09 44  6f 63 75 6d 65 6e 74 73  |ommand.Documents|
00000060  20 68 6f 77 20 74 6f 20  61 64 64 20 63 6f 6d 6d  | how to add comm|
00000070  61 6e 64 73 20 74 6f 20  5a 61 70 09 09 09 2a 0a  |ands to Zap...*.|
00000080  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000000c0  2a 2a 2a 2a 2a 2a 2a 2a  2a 0a 0a 41 73 20 6d 65  |*********..As me|
000000d0  6e 74 69 6f 6e 65 64 20  69 6e 20 74 68 65 20 52  |ntioned in the R|
000000e0  65 61 64 4d 65 20 66 69  6c 65 2c 20 63 6f 6d 6d  |eadMe file, comm|
000000f0  61 6e 64 73 20 61 72 65  20 61 64 64 65 64 20 74  |ands are added t|
00000100  6f 20 5a 61 70 20 62 79  20 72 65 67 69 73 74 65  |o Zap by registe|
00000110  72 69 6e 67 20 61 0a 74  61 62 6c 65 20 6f 66 20  |ring a.table of |
00000120  63 6f 6d 6d 61 6e 64 73  20 77 68 65 6e 20 74 68  |commands when th|
00000130  65 20 6d 6f 64 75 6c 65  20 70 72 6f 76 69 64 69  |e module providi|
00000140  6e 67 20 74 68 65 20 65  78 74 72 61 20 63 6f 6d  |ng the extra com|
00000150  6d 61 6e 64 73 20 69 6e  69 74 69 61 6c 69 73 65  |mands initialise|
00000160  73 2e 0a 59 6f 75 20 73  68 6f 75 6c 64 20 75 73  |s..You should us|
00000170  65 20 74 68 65 20 63 61  6c 6c 20 5a 61 70 5f 41  |e the call Zap_A|
00000180  64 64 43 6f 6d 6d 61 6e  64 73 20 74 6f 20 72 65  |ddCommands to re|
00000190  67 69 73 74 65 72 20 74  68 65 20 74 61 62 6c 65  |gister the table|
000001a0  2e 20 54 68 65 20 74 61  62 6c 65 20 68 61 73 0a  |. The table has.|
000001b0  74 68 65 20 66 6f 72 6d  61 74 20 62 65 6c 6f 77  |the format below|
000001c0  2e 20 41 6c 6c 20 6f 66  66 73 65 74 73 20 61 72  |. All offsets ar|
000001d0  65 20 66 72 6f 6d 20 79  6f 75 72 20 6d 6f 64 75  |e from your modu|
000001e0  6c 65 20 73 74 61 72 74  20 75 6e 6c 65 73 73 20  |le start unless |
000001f0  6f 74 68 65 72 77 69 73  65 0a 69 6e 64 69 63 61  |otherwise.indica|
00000200  74 65 64 2e 0a 0a 09 23  30 09 4f 66 66 73 65 74  |ted....#0.Offset|
00000210  20 6f 66 20 74 61 62 6c  65 20 66 72 6f 6d 20 73  | of table from s|
00000220  74 61 72 74 20 6f 66 20  6d 6f 64 75 6c 65 20 28  |tart of module (|
00000230  73 6f 20 5a 61 70 20 63  61 6e 20 63 6f 6e 76 65  |so Zap can conve|
00000240  72 74 20 74 68 65 0a 09  09 6f 66 66 73 65 74 73  |rt the...offsets|
00000250  20 62 65 6c 6f 77 20 69  6e 74 6f 20 61 64 64 72  | below into addr|
00000260  65 73 73 65 73 29 2e 0a  09 23 34 09 4f 66 66 73  |esses)...#4.Offs|
00000270  65 74 20 66 72 6f 6d 20  6d 6f 64 75 6c 65 20 73  |et from module s|
00000280  74 61 72 74 20 6f 66 20  27 5a 61 70 20 73 65 72  |tart of 'Zap ser|
00000290  76 69 63 65 20 63 61 6c  6c 20 63 6f 64 65 27 20  |vice call code' |
000002a0  6f 72 20 30 0a 09 09 69  66 20 6e 6f 6e 65 2e 20  |or 0...if none. |
000002b0  5a 61 70 20 63 61 6c 6c  73 20 74 68 69 73 20 65  |Zap calls this e|
000002c0  6e 74 72 79 20 70 6f 69  6e 74 20 74 6f 20 74 65  |ntry point to te|
000002d0  6c 6c 20 79 6f 75 20 61  62 6f 75 74 0a 09 09 76  |ll you about...v|
000002e0  61 72 69 6f 75 73 20 74  68 69 6e 67 73 20 2d 20  |arious things - |
000002f0  73 65 65 20 74 68 65 20  73 65 63 74 69 6f 6e 20  |see the section |
00000300  62 65 6c 6f 77 2e 0a 09  23 38 09 4c 69 73 74 20  |below...#8.List |
00000310  6f 66 20 63 6f 6d 6d 61  6e 64 73 2c 20 74 65 72  |of commands, ter|
00000320  6d 69 6e 61 74 65 64 20  62 79 20 61 20 7a 65 72  |minated by a zer|
00000330  6f 20 77 6f 72 64 2e 20  45 61 63 68 20 65 6c 65  |o word. Each ele|
00000340  6d 65 6e 74 0a 09 09 6f  66 20 74 68 65 20 6c 69  |ment...of the li|
00000350  73 74 20 68 61 73 20 74  68 65 20 66 6f 72 6d 61  |st has the forma|
00000360  74 3a 0a 09 09 0a 09 09  3c 63 6f 6d 6d 61 6e 64  |t:......<command|
00000370  20 6e 61 6d 65 3e 2b 3c  30 20 62 79 74 65 20 74  | name>+<0 byte t|
00000380  65 72 6d 69 6e 61 74 6f  72 3e 2b 0a 09 09 3c 5a  |erminator>+...<Z|
00000390  45 52 4f 20 62 79 74 65  73 20 70 61 64 64 69 6e  |ERO bytes paddin|
000003a0  67 20 75 6e 74 69 6c 20  77 6f 72 64 20 61 6c 69  |g until word ali|
000003b0  67 6e 65 64 3e 2b 0a 09  09 3c 77 6f 72 64 20 67  |gned>+...<word g|
000003c0  69 76 69 6e 67 20 63 6f  6d 6d 61 6e 64 20 6f 66  |iving command of|
000003d0  66 73 65 74 20 66 72 6f  6d 20 6d 6f 64 75 6c 65  |fset from module|
000003e0  20 73 74 61 72 74 3e 0a  09 09 0a 54 68 65 20 63  | start>....The c|
000003f0  6f 6d 6d 61 6e 64 20 6e  61 6d 65 20 6d 75 73 74  |ommand name must|
00000400  20 62 65 20 69 6e 20 55  50 50 45 52 20 43 41 53  | be in UPPER CAS|
00000410  45 20 69 6e 20 74 68 69  73 20 74 61 62 6c 65 2e  |E in this table.|
00000420  20 49 6e 20 67 65 6e 65  72 61 6c 2c 20 63 6f 6d  | In general, com|
00000430  6d 61 6e 64 0a 6e 61 6d  65 73 20 61 72 65 20 6e  |mand.names are n|
00000440  6f 74 20 63 61 73 65 20  73 65 6e 73 69 74 69 76  |ot case sensitiv|
00000450  65 2c 20 62 75 74 20 74  68 65 79 20 61 72 65 20  |e, but they are |
00000460  63 6f 6e 76 65 72 74 65  64 20 74 6f 20 75 70 70  |converted to upp|
00000470  65 72 20 63 61 73 65 20  69 6e 20 6f 72 64 65 72  |er case in order|
00000480  0a 74 6f 20 73 65 61 72  63 68 20 66 6f 72 20 74  |.to search for t|
00000490  68 65 6d 20 69 6e 20 74  68 65 20 63 6f 6d 6d 61  |hem in the comma|
000004a0  6e 64 20 74 61 62 6c 65  73 2e 20 54 68 65 20 63  |nd tables. The c|
000004b0  68 61 72 61 63 74 65 72  73 20 70 61 64 64 69 6e  |haracters paddin|
000004c0  67 20 74 6f 20 74 68 65  20 6e 65 78 74 0a 77 6f  |g to the next.wo|
000004d0  72 64 20 61 6c 69 67 6e  6d 65 6e 74 20 4d 55 53  |rd alignment MUS|
000004e0  54 20 62 65 20 5a 45 52  4f 73 20 61 73 20 74 68  |T be ZEROs as th|
000004f0  65 20 74 61 62 6c 65 20  69 73 20 73 65 61 72 63  |e table is searc|
00000500  68 65 64 20 74 68 72 6f  75 67 68 20 69 6e 20 77  |hed through in w|
00000510  6f 72 64 73 20 6e 6f 74  0a 69 6e 20 62 79 74 65  |ords not.in byte|
00000520  73 2e 0a 0a 57 68 65 6e  20 61 20 63 6f 6d 6d 61  |s...When a comma|
00000530  6e 64 20 69 73 20 66 6f  75 6e 64 20 69 6e 20 74  |nd is found in t|
00000540  68 65 20 74 61 62 6c 65  2c 20 69 74 73 20 61 64  |he table, its ad|
00000550  64 72 65 73 73 20 69 73  20 63 61 6c 63 75 6c 61  |dress is calcula|
00000560  74 65 64 2c 20 61 6e 64  0a 68 65 6e 63 65 66 6f  |ted, and.hencefo|
00000570  72 74 68 20 74 68 65 20  63 6f 6d 6d 61 6e 64 20  |rth the command |
00000580  69 73 20 72 65 66 65 72  72 65 64 20 74 6f 20 62  |is referred to b|
00000590  79 20 69 74 73 20 61 64  64 72 65 73 73 2e 20 54  |y its address. T|
000005a0  68 69 73 20 75 6e 66 6f  72 74 75 6e 61 74 65 6c  |his unfortunatel|
000005b0  79 0a 6d 65 61 6e 73 20  74 68 61 74 20 49 20 63  |y.means that I c|
000005c0  61 6e 6e 6f 74 20 70 61  73 73 20 74 68 65 20 63  |annot pass the c|
000005d0  6f 6d 6d 61 6e 64 20 79  6f 75 72 20 6d 6f 64 75  |ommand your modu|
000005e0  6c 65 20 77 6f 72 6b 73  70 61 63 65 20 77 68 65  |le workspace whe|
000005f0  6e 20 74 68 65 20 63 6f  6d 6d 61 6e 64 0a 69 73  |n the command.is|
00000600  20 63 61 6c 6c 65 64 20  61 73 20 49 20 64 6f 20  | called as I do |
00000610  6e 6f 74 20 6b 6e 6f 77  20 77 68 69 63 68 20 6d  |not know which m|
00000620  6f 64 75 6c 65 20 74 68  65 20 63 6f 6d 6d 61 6e  |odule the comman|
00000630  64 20 6c 69 65 73 20 69  6e 2e 20 54 68 69 73 20  |d lies in. This |
00000640  69 73 20 6e 6f 74 0a 75  73 75 61 6c 6c 79 20 61  |is not.usually a|
00000650  20 70 72 6f 62 6c 65 6d  20 68 6f 77 65 76 65 72  | problem however|
00000660  20 61 73 20 79 6f 75 20  6d 61 79 20 63 6c 61 69  | as you may clai|
00000670  6d 20 77 6f 72 6b 73 70  61 63 65 20 66 72 6f 6d  |m workspace from|
00000680  20 5a 61 70 27 73 20 68  65 61 70 2e 20 49 66 20  | Zap's heap. If |
00000690  74 68 69 73 0a 69 73 20  6e 6f 74 20 73 75 66 66  |this.is not suff|
000006a0  69 63 69 65 6e 74 2c 20  74 68 65 6e 20 79 6f 75  |icient, then you|
000006b0  20 77 69 6c 6c 20 6a 75  73 74 20 68 61 76 65 20  | will just have |
000006c0  74 6f 20 73 74 6f 72 65  20 74 68 65 20 61 64 64  |to store the add|
000006d0  72 65 73 73 20 6f 66 20  79 6f 75 72 0a 77 6f 72  |ress of your.wor|
000006e0  6b 73 70 61 63 65 20 69  6e 20 74 68 65 20 6d 6f  |kspace in the mo|
000006f0  64 75 6c 65 20 69 74 73  65 6c 66 20 61 6e 64 20  |dule itself and |
00000700  72 65 61 64 20 69 74 20  77 68 65 6e 20 79 6f 75  |read it when you|
00000710  20 61 72 65 20 63 61 6c  6c 65 64 20 28 75 6e 74  | are called (unt|
00000720  69 6c 20 49 20 77 6f 72  6b 0a 6f 75 74 20 61 20  |il I work.out a |
00000730  62 65 74 74 65 72 20 6d  65 74 68 6f 64 29 2e 0a  |better method)..|
00000740  0a 54 68 65 20 61 64 64  72 65 73 73 20 6f 66 20  |.The address of |
00000750  74 68 65 20 63 6f 6d 6d  61 6e 64 20 69 73 20 6f  |the command is o|
00000760  66 20 63 6f 75 72 73 65  20 74 68 65 20 61 64 64  |f course the add|
00000770  72 65 73 73 20 63 61 6c  6c 65 64 20 77 68 65 6e  |ress called when|
00000780  20 74 68 65 20 63 6f 6d  6d 61 6e 64 0a 69 73 20  | the command.is |
00000790  65 78 65 63 75 74 65 64  2e 20 48 6f 77 65 76 65  |executed. Howeve|
000007a0  72 2c 20 61 74 20 6f 66  66 73 65 74 20 2d 34 2c  |r, at offset -4,|
000007b0  20 74 68 65 20 77 6f 72  64 20 62 65 66 6f 72 65  | the word before|
000007c0  20 74 68 65 20 66 69 72  73 74 20 69 6e 73 74 72  | the first instr|
000007d0  75 63 74 69 6f 6e 20 6f  66 0a 74 68 65 20 63 6f  |uction of.the co|
000007e0  6d 6d 61 6e 64 2c 20 73  6f 6d 65 20 66 6c 61 67  |mmand, some flag|
000007f0  73 20 61 72 65 20 73 74  6f 72 65 64 2e 20 54 68  |s are stored. Th|
00000800  65 73 65 20 66 6c 61 67  73 20 64 65 74 65 72 6d  |ese flags determ|
00000810  69 6e 65 20 77 68 61 74  20 74 79 70 65 20 6f 66  |ine what type of|
00000820  0a 70 61 72 61 6d 65 74  65 72 20 74 68 65 20 63  |.parameter the c|
00000830  6f 6d 6d 61 6e 64 20 74  61 6b 65 73 20 61 6e 64  |ommand takes and|
00000840  20 68 6f 77 20 74 68 65  20 63 6f 6d 6d 61 6e 64  | how the command|
00000850  20 69 6e 74 65 72 61 63  74 73 20 77 69 74 68 20  | interacts with |
00000860  74 68 65 0a 6d 69 6e 69  62 75 66 66 65 72 2e 20  |the.minibuffer. |
00000870  54 68 69 73 20 77 6f 72  64 20 6d 75 73 74 20 62  |This word must b|
00000880  65 20 66 69 6c 6c 65 64  20 69 6e 2e 20 49 74 27  |e filled in. It'|
00000890  73 20 6d 65 61 6e 69 6e  67 20 69 73 20 61 73 20  |s meaning is as |
000008a0  66 6f 6c 6c 6f 77 73 3a  0a 0a 62 30 09 09 53 65  |follows:..b0..Se|
000008b0  74 20 69 66 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |t if the command|
000008c0  20 64 6f 65 73 6e 27 74  20 6e 65 65 64 20 52 31  | doesn't need R1|
000008d0  30 20 6f 6e 20 65 6e 74  72 79 20 28 65 67 20 63  |0 on entry (eg c|
000008e0  61 6c 6c 65 64 20 66 72  6f 6d 0a 62 31 09 09 53  |alled from.b1..S|
000008f0  65 74 20 69 66 20 74 68  65 20 63 6f 6d 6d 61 6e  |et if the comman|
00000900  64 20 64 6f 65 73 6e 27  74 20 6e 65 65 64 20 52  |d doesn't need R|
00000910  38 20 6f 6e 20 65 6e 74  72 79 20 20 20 61 20 6d  |8 on entry   a m|
00000920  65 6e 75 29 2e 0a 62 32  09 09 53 65 74 20 69 66  |enu)..b2..Set if|
00000930  20 74 68 65 20 63 6f 6d  6d 61 6e 64 20 64 6f 65  | the command doe|
00000940  73 6e 27 74 20 6e 65 65  64 20 52 39 20 6f 6e 20  |sn't need R9 on |
00000950  65 6e 74 72 79 0a 62 33  2d 62 35 09 09 41 72 67  |entry.b3-b5..Arg|
00000960  75 6d 65 6e 74 20 74 79  70 65 20 66 6f 72 20 74  |ument type for t|
00000970  68 65 20 63 6f 6d 6d 61  6e 64 3a 0a 09 09 30 20  |he command:...0 |
00000980  3d 20 43 6f 6d 6d 61 6e  64 20 74 61 6b 65 73 20  |= Command takes |
00000990  6e 6f 20 70 61 72 61 6d  65 74 65 72 73 0a 09 09  |no parameters...|
000009a0  31 20 3d 20 43 6f 6d 6d  61 6e 64 20 74 61 6b 65  |1 = Command take|
000009b0  73 20 61 20 6c 69 73 74  20 6f 66 20 62 79 74 65  |s a list of byte|
000009c0  73 20 61 73 20 70 61 72  61 6d 65 74 65 72 0a 09  |s as parameter..|
000009d0  09 32 20 3d 20 43 6f 6d  6d 61 6e 64 20 74 61 6b  |.2 = Command tak|
000009e0  65 73 20 61 20 6c 69 73  74 20 6f 66 20 77 6f 72  |es a list of wor|
000009f0  64 73 20 61 73 20 70 61  72 61 6d 65 74 65 72 0a  |ds as parameter.|
00000a00  09 09 33 20 3d 20 43 6f  6d 6d 61 6e 64 20 74 61  |..3 = Command ta|
00000a10  6b 65 73 20 61 20 73 74  72 69 6e 67 20 61 73 20  |kes a string as |
00000a20  70 61 72 61 6d 65 74 65  72 0a 09 09 34 20 3d 20  |parameter...4 = |
00000a30  43 6f 6d 6d 61 6e 64 20  74 61 6b 65 73 20 61 20  |Command takes a |
00000a40  62 6c 6f 63 6b 20 6f 66  20 64 61 74 61 20 61 73  |block of data as|
00000a50  20 70 61 72 61 6d 65 74  65 72 0a 09 09 35 2d 37  | parameter...5-7|
00000a60  20 72 65 73 65 72 76 65  64 0a 62 36 09 09 53 65  | reserved.b6..Se|
00000a70  74 20 69 66 20 79 6f 75  20 77 69 73 68 65 64 20  |t if you wished |
00000a80  74 6f 20 62 65 20 63 61  6c 6c 65 64 20 62 65 66  |to be called bef|
00000a90  6f 72 65 20 6d 69 6e 69  62 75 66 66 65 72 20 6f  |ore minibuffer o|
00000aa0  70 65 6e 65 64 0a 62 37  09 09 53 65 74 20 69 66  |pened.b7..Set if|
00000ab0  20 79 6f 75 20 77 69 73  68 20 74 6f 20 62 65 20  | you wish to be |
00000ac0  63 61 6c 6c 65 64 20 61  66 74 65 72 20 65 76 65  |called after eve|
00000ad0  72 79 20 6d 69 6e 69 62  75 66 66 65 72 20 75 70  |ry minibuffer up|
00000ae0  64 61 74 65 0a 62 38 09  09 53 65 74 20 69 66 20  |date.b8..Set if |
00000af0  79 6f 75 20 77 69 73 68  20 74 6f 20 62 65 20 63  |you wish to be c|
00000b00  61 6c 6c 65 64 20 62 65  66 6f 72 65 20 61 20 6b  |alled before a k|
00000b10  65 79 20 69 73 20 69 6e  73 65 72 74 65 64 20 69  |ey is inserted i|
00000b20  6e 74 6f 0a 09 09 74 68  65 20 6d 69 6e 69 62 75  |nto...the minibu|
00000b30  66 66 65 72 20 28 61 6e  64 20 70 6f 73 73 69 62  |ffer (and possib|
00000b40  6c 79 20 61 6c 74 65 72  20 69 74 29 2e 0a 62 39  |ly alter it)..b9|
00000b50  09 09 53 65 74 20 69 66  20 79 6f 75 20 77 61 6e  |..Set if you wan|
00000b60  74 20 54 41 42 20 74 6f  20 63 6f 6d 70 6c 65 74  |t TAB to complet|
00000b70  65 20 66 69 6c 65 20 6e  61 6d 65 73 20 69 6e 20  |e file names in |
00000b80  74 68 65 20 6d 69 6e 69  62 75 66 66 65 72 0a 62  |the minibuffer.b|
00000b90  31 30 09 09 53 65 74 20  69 66 20 79 6f 75 20 6d  |10..Set if you m|
00000ba0  61 79 20 77 61 6e 74 20  74 6f 20 6b 69 6c 6c 20  |ay want to kill |
00000bb0  74 68 65 20 6d 69 6e 69  62 75 66 66 65 72 20 77  |the minibuffer w|
00000bc0  68 65 6e 20 69 74 20 73  74 61 72 74 73 20 75 70  |hen it starts up|
00000bd0  2e 0a 62 31 31 09 09 53  65 74 20 69 66 20 79 6f  |..b11..Set if yo|
00000be0  75 20 6d 61 79 20 77 61  6e 74 20 6d 69 6e 69 62  |u may want minib|
00000bf0  75 66 66 65 72 20 74 6f  20 72 65 6d 61 69 6e 20  |uffer to remain |
00000c00  6f 70 65 6e 20 77 68 65  6e 20 63 6f 6d 6d 61 6e  |open when comman|
00000c10  64 0a 09 09 68 61 73 20  66 69 6e 69 73 68 65 64  |d...has finished|
00000c20  2e 0a 62 31 32 09 09 53  65 74 20 69 66 20 79 6f  |..b12..Set if yo|
00000c30  75 20 77 69 73 68 20 75  6e 69 76 65 72 73 61 6c  |u wish universal|
00000c40  20 61 72 67 75 6d 65 6e  74 20 74 6f 20 6d 75 6c  | argument to mul|
00000c50  74 69 70 6c 79 20 52 31  20 62 79 20 6e 20 6f 6e  |tiply R1 by n on|
00000c60  0a 09 09 63 61 6c 6c 69  6e 67 20 74 68 65 20 69  |...calling the i|
00000c70  6e 73 74 72 75 63 74 69  6f 6e 20 69 6e 73 74 65  |nstruction inste|
00000c80  61 64 20 6f 66 20 63 61  6c 6c 69 6e 67 20 69 74  |ad of calling it|
00000c90  20 6e 20 74 69 6d 65 73  2e 0a 09 09 49 66 20 74  | n times....If t|
00000ca0  68 65 20 63 6f 6d 6d 61  6e 64 20 74 61 6b 65 73  |he command takes|
00000cb0  20 62 79 74 65 20 6f 72  20 77 6f 72 64 20 6c 69  | byte or word li|
00000cc0  73 74 20 64 61 74 61 20  74 68 65 6e 20 74 68 65  |st data then the|
00000cd0  20 64 61 74 61 0a 09 09  69 73 20 64 75 70 6c 69  | data...is dupli|
00000ce0  63 61 74 65 64 20 74 68  65 20 67 69 76 65 6e 20  |cated the given |
00000cf0  6e 75 6d 62 65 72 20 6f  66 20 74 69 6d 65 73 2e  |number of times.|
00000d00  0a 62 31 33 09 09 52 65  73 65 72 76 65 64 20 66  |.b13..Reserved f|
00000d10  6f 72 20 50 61 75 6c 20  4d 6f 6f 72 65 27 73 20  |or Paul Moore's |
00000d20  73 79 73 74 65 6d 2e 0a  62 31 34 09 09 53 65 74  |system..b14..Set|
00000d30  20 69 66 20 74 68 65 20  63 6f 6d 6d 61 6e 64 20  | if the command |
00000d40  73 68 6f 75 6c 64 20 6e  6f 74 20 62 65 20 65 78  |should not be ex|
00000d50  65 63 75 74 65 64 20 77  68 65 6e 20 6c 6f 61 64  |ecuted when load|
00000d60  69 6e 67 20 61 0a 09 09  66 69 6c 65 20 74 6f 20  |ing a...file to |
00000d70  70 72 65 76 65 6e 74 20  54 72 6f 6a 61 6e 73 2e  |prevent Trojans.|
00000d80  0a 62 31 35 2d 62 33 31  09 09 52 65 73 65 72 76  |.b15-b31..Reserv|
00000d90  65 64 20 2d 20 73 65 74  20 74 6f 20 30 0a 0a 42  |ed - set to 0..B|
00000da0  69 74 73 20 30 2d 32 20  61 72 65 20 75 73 65 64  |its 0-2 are used|
00000db0  20 62 79 20 63 6f 6d 6d  61 6e 64 73 20 77 68 69  | by commands whi|
00000dc0  63 68 20 6d 61 79 20 62  65 20 63 61 6c 6c 65 64  |ch may be called|
00000dd0  20 66 72 6f 6d 20 61 20  6d 65 6e 75 2c 20 61 6e  | from a menu, an|
00000de0  64 20 74 68 75 73 20 6d  61 79 0a 6e 6f 74 20 62  |d thus may.not b|
00000df0  65 20 74 79 70 65 64 2e  20 59 6f 75 20 73 68 6f  |e typed. You sho|
00000e00  75 6c 64 20 6c 65 61 76  65 20 74 68 65 6d 20 61  |uld leave them a|
00000e10  73 20 30 2e 0a 0a 54 68  65 20 65 6e 74 72 79 2f  |s 0...The entry/|
00000e20  65 78 69 74 20 63 6f 6e  64 69 74 69 6f 6e 73 20  |exit conditions |
00000e30  6f 66 20 79 6f 75 72 20  63 6f 6d 6d 61 6e 64 20  |of your command |
00000e40  64 65 70 65 6e 64 20 6f  6e 20 79 6f 75 72 20 66  |depend on your f|
00000e50  6c 61 67 73 20 77 6f 72  64 20 61 73 20 49 20 77  |lags word as I w|
00000e60  69 6c 6c 0a 64 65 74 61  69 6c 20 62 65 6c 6f 77  |ill.detail below|
00000e70  2e 20 59 6f 75 20 61 72  65 20 41 4c 57 41 59 53  |. You are ALWAYS|
00000e80  20 63 61 6c 6c 65 64 20  77 69 74 68 20 74 68 65  | called with the|
00000e90  20 66 6f 6c 6c 6f 77 69  6e 67 20 72 65 67 69 73  | following regis|
00000ea0  74 65 72 73 20 73 65 74  20 75 70 20 6f 6e 0a 65  |ters set up on.e|
00000eb0  6e 74 72 79 3a 0a 0a 09  52 33 20 3d 20 69 6e 66  |ntry:...R3 = inf|
00000ec0  6f 20 66 6c 61 67 73 3a  0a 09 09 62 30 20 53 65  |o flags:...b0 Se|
00000ed0  74 20 3d 3e 20 54 68 65  20 6c 61 73 74 20 63 6f  |t => The last co|
00000ee0  6d 6d 61 6e 64 20 63 61  6c 6c 20 77 61 73 20 74  |mmand call was t|
00000ef0  6f 20 74 68 69 73 20 63  6f 6d 6d 61 6e 64 20 61  |o this command a|
00000f00  73 20 77 65 6c 6c 2e 0a  09 09 09 28 65 67 20 74  |s well.....(eg t|
00000f10  6f 20 73 70 6f 74 20 63  75 6d 75 6c 61 74 69 76  |o spot cumulativ|
00000f20  65 20 63 74 72 6c 20 4b  27 73 2f 59 61 6e 6b 73  |e ctrl K's/Yanks|
00000f30  29 2e 0a 09 09 62 31 2d  62 32 37 20 3d 3e 20 52  |)....b1-b27 => R|
00000f40  65 73 65 72 76 65 64 0a  09 09 62 32 38 2d 62 33  |eserved...b28-b3|
00000f50  31 3d 3e 20 54 6f 70 20  62 69 74 73 20 6f 66 20  |1=> Top bits of |
00000f60  52 32 20 77 68 65 6e 20  63 6f 6d 6d 61 6e 64 20  |R2 when command |
00000f70  63 61 6c 6c 65 64 20 76  69 61 0a 09 09 09 20 20  |called via....  |
00000f80  5a 61 70 5f 50 72 6f 63  65 73 73 43 6f 6d 6d 61  |Zap_ProcessComma|
00000f90  6e 64 2e 0a 09 52 38 20  3d 20 77 69 6e 64 6f 77  |nd...R8 = window|
00000fa0  20 6f 66 20 74 68 65 20  69 6e 70 75 74 20 63 61  | of the input ca|
00000fb0  72 65 74 20 28 73 65 65  20 45 2d 57 69 6e 64 6f  |ret (see E-Windo|
00000fc0  77 73 29 20 28 75 6e 6c  65 73 73 20 66 6c 61 67  |ws) (unless flag|
00000fd0  73 20 62 31 20 73 65 74  29 0a 09 52 39 20 3d 20  |s b1 set)..R9 = |
00000fe0  66 69 6c 65 20 62 6c 6f  63 6b 20 61 73 73 6f 63  |file block assoc|
00000ff0  69 61 74 65 64 20 77 69  74 68 20 52 38 20 28 73  |iated with R8 (s|
00001000  65 65 20 45 2d 46 69 6c  65 29 20 28 66 6c 61 67  |ee E-File) (flag|
00001010  73 20 62 32 3d 30 29 0a  09 52 31 30 20 3d 20 63  |s b2=0)..R10 = c|
00001020  75 72 73 6f 72 20 62 6c  6f 63 6b 20 70 6f 69 6e  |ursor block poin|
00001030  74 65 72 20 6f 66 20 69  6e 70 75 74 20 63 75 72  |ter of input cur|
00001040  73 6f 72 20 28 73 65 65  20 45 2d 43 75 72 73 6f  |sor (see E-Curso|
00001050  72 73 29 20 28 62 33 3d  30 29 0a 09 20 20 20 20  |rs) (b3=0)..    |
00001060  20 20 28 54 68 69 73 20  69 73 20 63 61 72 5f 63  |  (This is car_c|
00001070  75 72 73 6f 72 20 69 66  20 74 68 65 20 63 75 72  |ursor if the cur|
00001080  73 6f 72 73 20 61 72 65  20 63 6f 6d 62 69 6e 65  |sors are combine|
00001090  64 20 61 6e 64 0a 09 20  20 20 20 20 20 20 63 61  |d and..       ca|
000010a0  72 5f 69 6e 70 75 74 20  69 66 20 74 68 65 79 20  |r_input if they |
000010b0  61 72 65 20 73 70 6c 69  74 20 2d 20 73 65 65 20  |are split - see |
000010c0  45 2d 56 61 72 73 29 2e  0a 09 52 31 33 20 3d 20  |E-Vars)...R13 = |
000010d0  73 6d 61 6c 6c 20 46 44  20 73 74 61 63 6b 0a 09  |small FD stack..|
000010e0  0a 41 6e 64 20 69 6e 20  67 65 6e 65 72 61 6c 20  |.And in general |
000010f0  72 65 67 69 73 74 65 72  73 20 52 30 2d 52 32 20  |registers R0-R2 |
00001100  68 61 76 65 20 74 68 65  20 6d 65 61 6e 69 6e 67  |have the meaning|
00001110  3a 0a 0a 09 52 30 20 3d  20 64 61 74 61 20 70 6f  |:...R0 = data po|
00001120  69 6e 74 65 72 20 28 79  6f 75 72 20 69 6e 70 75  |inter (your inpu|
00001130  74 29 0a 09 52 31 20 3d  20 6e 75 6d 62 65 72 20  |t)..R1 = number |
00001140  6f 66 20 74 69 6d 65 73  20 6b 65 79 20 77 61 73  |of times key was|
00001150  20 70 72 65 73 73 65 64  20 28 61 6c 6c 20 6b 65  | pressed (all ke|
00001160  79 20 70 72 65 73 73 65  73 20 61 72 65 20 62 75  |y presses are bu|
00001170  66 66 65 72 65 64 29 0a  09 52 32 20 3d 20 61 63  |ffered)..R2 = ac|
00001180  74 69 6f 6e 20 63 6f 64  65 20 28 69 66 20 79 6f  |tion code (if yo|
00001190  75 20 68 61 76 65 20 61  20 73 74 72 69 6e 67 20  |u have a string |
000011a0  61 72 67 75 6d 65 6e 74  29 0a 0a 4f 6e 20 65 78  |argument)..On ex|
000011b0  69 74 20 66 72 6f 6d 20  61 20 63 6f 6d 6d 61 6e  |it from a comman|
000011c0  64 20 79 6f 75 20 6d 61  79 20 63 6f 72 72 75 70  |d you may corrup|
000011d0  74 20 74 68 65 20 72 65  67 69 73 74 65 72 73 20  |t the registers |
000011e0  52 30 2d 52 31 31 20 61  6e 64 20 74 68 65 20 66  |R0-R11 and the f|
000011f0  6c 61 67 73 2e 0a 59 6f  75 20 73 68 6f 75 6c 64  |lags..You should|
00001200  20 72 65 74 75 72 6e 20  56 20 66 6c 61 67 20 73  | return V flag s|
00001210  65 74 20 61 6e 64 20 52  30 3d 65 72 72 6f 72 20  |et and R0=error |
00001220  62 6c 6f 63 6b 20 6f 6e  20 65 72 72 6f 72 2e 20  |block on error. |
00001230  53 6f 6d 65 20 6f 66 20  74 68 65 0a 6d 69 6e 69  |Some of the.mini|
00001240  62 75 66 66 65 72 20 63  61 6c 6c 73 20 77 69 74  |buffer calls wit|
00001250  68 20 52 32 3c 3e 30 20  72 65 71 75 69 72 65 20  |h R2<>0 require |
00001260  79 6f 75 20 74 6f 20 72  65 74 75 72 6e 20 61 20  |you to return a |
00001270  72 65 73 75 6c 74 20 69  6e 20 52 30 2e 20 54 6f  |result in R0. To|
00001280  20 64 65 74 61 69 6c 0a  74 68 65 20 61 63 74 75  | detail.the actu|
00001290  61 6c 20 6d 65 61 6e 69  6e 67 20 6f 66 20 52 30  |al meaning of R0|
000012a0  2d 52 32 20 49 20 68 61  76 65 20 70 61 72 74 69  |-R2 I have parti|
000012b0  74 69 6f 6e 65 64 20 69  6e 74 6f 20 63 61 73 65  |tioned into case|
000012c0  73 20 62 65 6c 6f 77 2e  20 52 65 67 69 73 74 65  |s below. Registe|
000012d0  72 73 0a 6e 6f 74 20 6d  65 6e 74 69 6f 6e 65 64  |rs.not mentioned|
000012e0  20 61 72 65 20 75 6e 64  65 66 69 6e 65 64 2e 0a  | are undefined..|
000012f0  0a 49 66 20 79 6f 75 20  77 61 6e 74 20 74 6f 20  |.If you want to |
00001300  63 61 6c 6c 20 61 20 63  6f 6d 6d 61 6e 64 20 79  |call a command y|
00001310  6f 75 72 73 65 6c 66 2c  20 74 68 65 6e 20 70 6c  |ourself, then pl|
00001320  65 61 73 65 20 75 73 65  20 74 68 65 20 63 61 6c  |ease use the cal|
00001330  6c 0a 5a 61 70 5f 50 72  6f 63 65 73 73 43 6f 6d  |l.Zap_ProcessCom|
00001340  6d 61 6e 64 20 6f 72 20  5a 61 70 5f 43 6f 6d 6d  |mand or Zap_Comm|
00001350  61 6e 64 53 74 72 69 6e  67 2e 20 41 6c 6c 20 63  |andString. All c|
00001360  61 6c 6c 73 20 66 72 6f  6d 20 5a 61 70 20 61 72  |alls from Zap ar|
00001370  65 20 6d 61 64 65 20 62  79 20 74 68 69 73 0a 6d  |e made by this.m|
00001380  65 74 68 6f 64 2e 20 53  65 65 20 74 68 65 20 66  |ethod. See the f|
00001390  69 6c 65 20 27 43 6f 6d  6d 61 6e 64 73 27 20 66  |ile 'Commands' f|
000013a0  6f 72 20 74 68 65 20 73  79 6e 74 61 78 20 75 73  |or the syntax us|
000013b0  65 64 20 77 68 65 6e 20  74 79 70 69 6e 67 20 61  |ed when typing a|
000013c0  20 63 6f 6d 6d 61 6e 64  0a 69 6e 74 6f 20 74 68  | command.into th|
000013d0  65 20 6b 65 79 73 20 66  69 6c 65 2c 20 6f 72 20  |e keys file, or |
000013e0  73 65 6e 64 69 6e 67 20  69 74 20 74 6f 20 5a 61  |sending it to Za|
000013f0  70 5f 43 6f 6d 6d 61 6e  64 53 74 72 69 6e 67 2e  |p_CommandString.|
00001400  0a 0a 44 61 74 61 20 74  79 70 65 20 3d 20 4e 6f  |..Data type = No|
00001410  6e 65 20 28 30 29 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ne (0).---------|
00001420  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 54 68 65  |-----------..The|
00001430  6e 20 52 31 3d 4e 75 6d  62 65 72 20 6f 66 20 74  |n R1=Number of t|
00001440  69 6d 65 73 20 6b 65 79  20 70 72 65 73 73 65 64  |imes key pressed|
00001450  2c 20 61 6e 64 20 52 30  2c 52 32 20 61 72 65 20  |, and R0,R2 are |
00001460  6e 6f 74 20 75 73 65 64  2e 20 49 66 20 74 68 65  |not used. If the|
00001470  20 73 61 6d 65 0a 63 6f  6d 6d 61 6e 64 20 69 73  | same.command is|
00001480  20 62 6f 75 6e 64 20 74  6f 20 6d 6f 72 65 20 74  | bound to more t|
00001490  68 61 6e 20 6f 6e 65 20  6b 65 79 20 74 68 65 6e  |han one key then|
000014a0  20 61 6c 6c 20 74 68 65  20 62 75 66 66 65 72 65  | all the buffere|
000014b0  64 20 6b 65 79 70 72 65  73 73 65 73 20 6d 61 79  |d keypresses may|
000014c0  0a 6e 6f 74 20 62 65 20  64 75 65 20 74 6f 20 74  |.not be due to t|
000014d0  68 65 20 73 61 6d 65 20  6b 65 79 21 20 45 67 2c  |he same key! Eg,|
000014e0  20 74 68 65 20 63 6f 6d  6d 61 6e 64 20 55 50 2e  | the command UP.|
000014f0  20 49 6e 20 74 68 65 20  6b 65 79 73 20 66 69 6c  | In the keys fil|
00001500  65 20 69 74 20 73 68 6f  75 6c 64 0a 61 70 70 65  |e it should.appe|
00001510  61 72 20 77 69 74 68 20  6e 6f 20 70 61 72 61 6d  |ar with no param|
00001520  65 74 65 72 73 2e 0a 0a  44 61 74 61 20 74 79 70  |eters...Data typ|
00001530  65 20 3d 20 42 79 74 65  20 6c 69 73 74 20 28 31  |e = Byte list (1|
00001540  29 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |).--------------|
00001550  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 54 68 65  |-----------..The|
00001560  6e 20 52 30 3d 50 6f 69  6e 74 65 72 20 74 6f 20  |n R0=Pointer to |
00001570  61 20 6c 69 73 74 20 6f  66 20 62 79 74 65 73 2c  |a list of bytes,|
00001580  20 61 6e 64 20 52 31 3d  4e 75 6d 62 65 72 20 6f  | and R1=Number o|
00001590  66 20 62 79 74 65 73 20  69 6e 20 74 68 65 20 6c  |f bytes in the l|
000015a0  69 73 74 2e 20 45 67 2c  0a 74 68 65 20 63 6f 6d  |ist. Eg,.the com|
000015b0  6d 61 6e 64 20 43 48 41  52 2e 20 49 6e 20 74 68  |mand CHAR. In th|
000015c0  65 20 6b 65 79 73 20 66  69 6c 65 2c 20 74 68 65  |e keys file, the|
000015d0  20 63 6f 6d 6d 61 6e 64  20 73 68 6f 75 6c 64 20  | command should |
000015e0  61 70 70 65 61 72 20 77  69 74 68 20 61 20 62 79  |appear with a by|
000015f0  74 65 20 61 73 0a 70 61  72 61 6d 65 74 65 72 2c  |te as.parameter,|
00001600  20 65 67 20 43 48 41 52  20 31 34 33 20 28 6f 72  | eg CHAR 143 (or|
00001610  20 43 48 41 52 20 6e 20  77 68 65 72 65 20 6e 20  | CHAR n where n |
00001620  69 73 20 73 75 62 73 74  69 74 75 74 65 64 20 66  |is substituted f|
00001630  6f 72 20 74 68 65 20 6b  65 79 20 6e 75 6d 62 65  |or the key numbe|
00001640  72 0a 69 74 20 6c 69 65  73 20 6f 6e 29 2e 20 54  |r.it lies on). T|
00001650  68 75 73 20 69 66 20 74  68 65 20 75 73 65 72 20  |hus if the user |
00001660  74 79 70 65 73 20 41 2c  42 2c 43 20 77 68 69 63  |types A,B,C whic|
00001670  68 20 68 61 76 65 20 74  68 65 20 63 6f 6d 6d 61  |h have the comma|
00001680  6e 64 73 20 43 48 41 52  20 36 35 2c 0a 43 48 41  |nds CHAR 65,.CHA|
00001690  52 20 36 36 2c 20 43 48  41 52 20 36 37 20 61 73  |R 66, CHAR 67 as|
000016a0  73 69 67 6e 65 64 20 74  6f 20 74 68 65 6d 2c 20  |signed to them, |
000016b0  74 68 65 6e 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |then the command|
000016c0  20 77 69 6c 6c 20 62 65  20 63 61 6c 6c 65 64 20  | will be called |
000016d0  6f 6e 63 65 20 77 69 74  68 0a 74 68 65 20 6c 69  |once with.the li|
000016e0  73 74 20 36 35 2c 36 36  2c 36 37 20 69 66 20 74  |st 65,66,67 if t|
000016f0  68 65 20 6b 65 79 70 72  65 73 73 65 73 20 77 65  |he keypresses we|
00001700  72 65 20 62 75 66 66 65  72 65 64 2e 0a 0a 44 61  |re buffered...Da|
00001710  74 61 20 74 79 70 65 20  3d 20 57 6f 72 64 20 6c  |ta type = Word l|
00001720  69 73 74 20 28 32 29 0a  2d 2d 2d 2d 2d 2d 2d 2d  |ist (2).--------|
00001730  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001740  2d 0a 0a 54 68 65 6e 20  52 30 3d 50 6f 69 6e 74  |-..Then R0=Point|
00001750  65 72 20 74 6f 20 61 20  6c 69 73 74 20 6f 66 20  |er to a list of |
00001760  77 6f 72 64 73 2c 20 61  6e 64 20 52 31 3d 4e 75  |words, and R1=Nu|
00001770  6d 62 65 72 20 6f 66 20  77 6f 72 64 73 20 69 6e  |mber of words in|
00001780  20 74 68 65 20 6c 69 73  74 2e 20 54 68 69 73 0a  | the list. This.|
00001790  77 6f 72 6b 73 20 61 73  20 66 6f 72 20 74 68 65  |works as for the|
000017a0  20 62 79 74 65 20 6c 69  73 74 20 64 61 74 61 20  | byte list data |
000017b0  74 79 70 65 20 65 78 63  65 70 74 20 74 68 61 74  |type except that|
000017c0  20 74 68 65 20 63 6f 6d  6d 61 6e 64 20 74 61 6b  | the command tak|
000017d0  65 73 20 61 20 77 6f 72  64 0a 28 34 20 62 79 74  |es a word.(4 byt|
000017e0  65 73 29 20 61 73 20 70  61 72 61 6d 65 74 65 72  |es) as parameter|
000017f0  2e 0a 0a 44 61 74 61 20  74 79 70 65 20 3d 20 53  |...Data type = S|
00001800  74 72 69 6e 67 20 28 33  29 0a 2d 2d 2d 2d 2d 2d  |tring (3).------|
00001810  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001820  0a 0a 41 6c 6c 20 73 74  72 69 6e 67 73 20 69 6e  |..All strings in|
00001830  20 74 68 69 73 20 73 65  63 74 69 6f 6e 20 61 72  | this section ar|
00001840  65 20 7a 65 72 6f 20 74  65 72 6d 69 6e 61 74 65  |e zero terminate|
00001850  64 2e 20 57 68 65 6e 20  79 6f 75 20 61 72 65 20  |d. When you are |
00001860  70 61 73 73 65 64 20 52  30 20 61 73 0a 74 68 65  |passed R0 as.the|
00001870  20 63 6f 6e 74 65 6e 74  73 20 6f 66 20 74 68 65  | contents of the|
00001880  20 6d 69 6e 69 62 75 66  66 65 72 2c 20 74 68 69  | minibuffer, thi|
00001890  73 20 65 78 63 6c 75 64  65 73 20 74 68 65 20 70  |s excludes the p|
000018a0  72 6f 6d 70 74 20 28 73  65 65 20 5a 61 70 5f 4d  |rompt (see Zap_M|
000018b0  69 6e 69 57 72 69 74 65  29 2e 0a 49 6e 20 74 68  |iniWrite)..In th|
000018c0  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 63 61 6c 6c  |e following call|
000018d0  73 2c 20 52 32 20 67 69  76 65 73 20 74 68 65 20  |s, R2 gives the |
000018e0  61 63 74 69 6f 6e 20 63  6f 64 65 20 64 69 73 74  |action code dist|
000018f0  69 6e 67 75 69 73 68 69  6e 67 20 74 68 65 6d 2e  |inguishing them.|
00001900  0a 0a 43 41 53 45 20 31  20 2d 20 41 20 73 74 72  |..CASE 1 - A str|
00001910  69 6e 67 20 69 73 20 73  70 65 63 69 66 69 65 64  |ing is specified|
00001920  20 61 66 74 65 72 20 74  68 65 20 63 6f 6d 6d 61  | after the comma|
00001930  6e 64 20 69 6e 20 74 68  65 20 6b 65 79 73 20 66  |nd in the keys f|
00001940  69 6c 65 20 28 65 67 20  49 4e 53 45 52 54 0a 09  |ile (eg INSERT..|
00001950  22 48 65 6c 6c 6f 22 29  2e 0a 09 0a 09 49 6e 20  |"Hello").....In |
00001960  74 68 69 73 20 63 61 73  65 20 79 6f 75 20 61 72  |this case you ar|
00001970  65 20 63 61 6c 6c 65 64  20 77 69 74 68 20 52 30  |e called with R0|
00001980  3d 70 6f 69 6e 74 65 72  20 74 6f 20 74 68 65 20  |=pointer to the |
00001990  73 74 72 69 6e 67 20 52  31 3d 6e 75 6d 62 65 72  |string R1=number|
000019a0  0a 09 6f 66 20 74 69 6d  65 73 20 74 68 65 20 6b  |..of times the k|
000019b0  65 79 20 77 61 73 20 70  72 65 73 73 65 64 2e 20  |ey was pressed. |
000019c0  52 32 3d 30 2e 0a 09 0a  43 41 53 45 20 32 20 2d  |R2=0....CASE 2 -|
000019d0  20 4e 6f 20 73 74 72 69  6e 67 20 73 70 65 63 69  | No string speci|
000019e0  66 69 65 64 20 69 6e 20  74 68 65 20 6b 65 79 73  |fied in the keys|
000019f0  20 66 69 6c 65 20 28 65  67 20 49 4e 53 45 52 54  | file (eg INSERT|
00001a00  29 2e 0a 09 0a 49 6e 20  74 68 69 73 20 63 61 73  |)....In this cas|
00001a10  65 2c 20 61 20 6d 69 6e  69 62 75 66 66 65 72 20  |e, a minibuffer |
00001a20  69 73 20 6f 70 65 6e 65  64 20 66 6f 72 20 74 68  |is opened for th|
00001a30  65 20 75 73 65 72 20 74  6f 20 74 79 70 65 20 69  |e user to type i|
00001a40  6e 20 74 68 65 20 73 74  72 69 6e 67 20 66 6f 72  |n the string for|
00001a50  0a 74 68 65 20 63 6f 6d  6d 61 6e 64 20 74 6f 20  |.the command to |
00001a60  75 73 65 2e 20 4d 6f 73  74 20 6f 66 20 74 68 65  |use. Most of the|
00001a70  20 66 6c 61 67 73 20 69  6e 20 74 68 65 20 66 6c  | flags in the fl|
00001a80  61 67 73 20 77 6f 72 64  20 63 6f 6e 74 72 6f 6c  |ags word control|
00001a90  20 74 68 65 20 77 61 79  20 74 68 65 0a 6d 69 6e  | the way the.min|
00001aa0  69 62 75 66 66 65 72 20  77 6f 72 6b 73 2e 20 49  |ibuffer works. I|
00001ab0  66 20 74 68 65 20 66 6c  61 67 73 20 69 6e 20 62  |f the flags in b|
00001ac0  69 74 73 20 36 2b 20 61  72 65 20 61 6c 6c 20 63  |its 6+ are all c|
00001ad0  6c 65 61 72 20 74 68 65  6e 20 65 76 65 72 79 74  |lear then everyt|
00001ae0  68 69 6e 67 20 69 73 0a  68 61 6e 64 6c 65 64 20  |hing is.handled |
00001af0  61 75 74 6f 6d 61 74 69  63 61 6c 6c 79 20 66 6f  |automatically fo|
00001b00  72 20 79 6f 75 20 61 6e  64 20 79 6f 75 20 61 72  |r you and you ar|
00001b10  65 20 63 61 6c 6c 65 64  20 77 69 74 68 20 52 32  |e called with R2|
00001b20  3d 31 20 61 6e 64 20 52  30 3d 6d 69 6e 69 62 75  |=1 and R0=minibu|
00001b30  66 66 65 72 0a 63 6f 6e  74 65 6e 74 73 20 77 68  |ffer.contents wh|
00001b40  65 6e 20 74 68 65 20 75  73 65 72 20 74 79 70 65  |en the user type|
00001b50  73 20 52 45 54 55 52 4e  2e 20 54 68 65 20 64 65  |s RETURN. The de|
00001b60  74 61 69 6c 65 64 20 77  6f 72 6b 69 6e 67 73 20  |tailed workings |
00001b70  6f 66 20 74 68 65 20 6d  69 6e 69 62 75 66 66 65  |of the minibuffe|
00001b80  72 0a 61 72 65 20 64 65  73 63 72 69 62 65 64 20  |r.are described |
00001b90  62 65 6c 6f 77 2e 20 50  6c 65 61 73 65 20 73 75  |below. Please su|
00001ba0  70 70 6c 79 20 61 20 70  72 6f 6d 70 74 20 28 75  |pply a prompt (u|
00001bb0  73 65 20 62 36 29 20 77  68 65 72 65 20 70 6f 73  |se b6) where pos|
00001bc0  73 69 62 6c 65 2e 0a 0a  54 68 65 20 66 6f 6c 6c  |sible...The foll|
00001bd0  6f 77 69 6e 67 20 68 61  70 70 65 6e 73 20 62 65  |owing happens be|
00001be0  66 6f 72 65 20 74 68 65  20 6d 69 6e 69 62 75 66  |fore the minibuf|
00001bf0  66 65 72 20 69 73 20 6f  70 65 6e 65 64 20 6f 6e  |fer is opened on|
00001c00  20 73 63 72 65 65 6e 3a  0a 0a 46 69 72 73 74 20  | screen:..First |
00001c10  6f 66 20 61 6c 6c 2c 20  74 68 65 20 6d 69 6e 69  |of all, the mini|
00001c20  62 75 66 66 65 72 20 69  73 20 63 6c 65 61 72 65  |buffer is cleare|
00001c30  64 2e 20 49 66 20 79 6f  75 20 77 69 73 68 20 74  |d. If you wish t|
00001c40  6f 20 62 65 20 63 61 6c  6c 65 64 20 61 74 20 74  |o be called at t|
00001c50  68 69 73 0a 70 6f 69 6e  74 20 28 65 67 20 74 6f  |his.point (eg to|
00001c60  20 61 64 64 20 61 20 70  72 6f 6d 70 74 29 20 74  | add a prompt) t|
00001c70  68 65 6e 20 73 65 74 20  62 36 20 6f 66 20 79 6f  |hen set b6 of yo|
00001c80  75 72 20 66 6c 61 67 73  20 77 6f 72 64 20 61 6e  |ur flags word an|
00001c90  64 20 79 6f 75 20 77 69  6c 6c 20 62 65 0a 63 61  |d you will be.ca|
00001ca0  6c 6c 65 64 20 77 69 74  68 20 52 32 3d 36 20 28  |lled with R2=6 (|
00001cb0  52 30 2c 52 31 20 75 6e  64 65 66 69 6e 65 64 2c  |R0,R1 undefined,|
00001cc0  20 52 38 2d 52 31 30 20  73 65 74 75 70 20 61 73  | R8-R10 setup as|
00001cd0  20 75 73 75 61 6c 29 2e  20 59 6f 75 20 73 68 6f  | usual). You sho|
00001ce0  75 6c 64 20 74 68 65 6e  0a 69 6e 73 65 72 74 20  |uld then.insert |
00001cf0  79 6f 75 72 20 70 72 6f  6d 70 74 20 75 73 69 6e  |your prompt usin|
00001d00  67 20 5a 61 70 5f 4d 69  6e 69 50 72 6f 6d 70 74  |g Zap_MiniPrompt|
00001d10  2e 20 50 6c 65 61 73 65  20 6c 6f 6f 6b 20 61 74  |. Please look at|
00001d20  20 5a 61 70 5f 4d 69 6e  69 57 72 69 74 65 20 66  | Zap_MiniWrite f|
00001d30  6f 72 0a 6f 74 68 65 72  20 77 61 79 73 20 6f 66  |or.other ways of|
00001d40  20 63 68 61 6e 67 69 6e  67 20 74 68 65 20 6d 69  | changing the mi|
00001d50  6e 69 62 75 66 66 65 72  20 63 6f 6e 74 65 6e 74  |nibuffer content|
00001d60  73 2e 20 49 74 20 69 73  20 70 6f 73 73 69 62 6c  |s. It is possibl|
00001d70  65 20 74 68 61 74 20 79  6f 75 20 6d 61 79 0a 77  |e that you may.w|
00001d80  69 73 68 20 74 6f 20 6b  69 6c 6c 20 74 68 65 20  |ish to kill the |
00001d90  6d 69 6e 69 62 75 66 66  65 72 20 61 74 20 74 68  |minibuffer at th|
00001da0  69 73 20 70 6f 69 6e 74  2c 20 62 65 66 6f 72 65  |is point, before|
00001db0  20 69 74 20 69 73 20 6f  70 65 6e 65 64 2c 20 61  | it is opened, a|
00001dc0  73 20 61 6e 20 6e 75 6c  6c 0a 61 72 67 75 6d 65  |s an null.argume|
00001dd0  6e 74 20 6d 61 79 20 73  6f 6d 65 74 69 6d 65 73  |nt may sometimes|
00001de0  20 62 65 20 61 63 63 65  70 74 61 62 6c 65 2e 20  | be acceptable. |
00001df0  46 6f 72 20 65 78 61 6d  70 6c 65 2c 20 74 68 65  |For example, the|
00001e00  20 63 6f 6d 6d 61 6e 64  20 53 41 56 45 46 49 4c  | command SAVEFIL|
00001e10  45 0a 28 45 6d 61 63 73  20 43 54 52 4c 2d 58 20  |E.(Emacs CTRL-X |
00001e20  43 54 52 4c 2d 53 29 20  6f 6e 6c 79 20 77 61 6e  |CTRL-S) only wan|
00001e30  74 73 20 74 6f 20 6f 70  65 6e 20 61 20 6d 69 6e  |ts to open a min|
00001e40  69 62 75 66 66 65 72 20  69 66 20 74 68 65 20 66  |ibuffer if the f|
00001e50  69 6c 65 20 69 73 20 75  6e 74 69 74 6c 65 64 0a  |ile is untitled.|
00001e60  28 64 6f 65 73 20 6e 6f  74 20 68 61 76 65 20 61  |(does not have a|
00001e70  20 66 75 6c 6c 20 70 61  74 68 20 6e 61 6d 65 29  | full path name)|
00001e80  2e 20 54 6f 20 64 6f 20  74 68 69 73 2c 20 73 65  |. To do this, se|
00001e90  74 20 62 31 30 20 6f 66  20 79 6f 75 72 20 66 6c  |t b10 of your fl|
00001ea0  61 67 73 20 77 6f 72 64  20 28 69 6e 0a 61 64 64  |ags word (in.add|
00001eb0  69 74 69 6f 6e 20 74 6f  20 62 36 29 20 61 6e 64  |ition to b6) and|
00001ec0  20 72 65 74 75 72 6e 20  52 30 3d 30 20 74 6f 20  | return R0=0 to |
00001ed0  6f 70 65 6e 20 74 68 65  20 6d 69 6e 69 62 75 66  |open the minibuf|
00001ee0  66 65 72 20 61 73 20 75  73 75 61 6c 2c 20 6f 72  |fer as usual, or|
00001ef0  0a 52 30 3d 70 6f 69 6e  74 65 72 20 74 6f 20 74  |.R0=pointer to t|
00001f00  68 65 20 73 74 72 69 6e  67 20 61 72 67 75 6d 65  |he string argume|
00001f10  6e 74 20 79 6f 75 20 77  61 6e 74 20 74 68 65 20  |nt you want the |
00001f20  63 6f 6d 6d 61 6e 64 20  74 6f 20 62 65 20 65 78  |command to be ex|
00001f30  65 63 75 74 65 64 20 77  69 74 68 2e 0a 59 6f 75  |ecuted with..You|
00001f40  72 20 63 6f 6d 6d 61 6e  64 20 77 69 6c 6c 20 74  |r command will t|
00001f50  68 65 6e 20 62 65 20 63  61 6c 6c 65 64 20 61 67  |hen be called ag|
00001f60  61 69 6e 20 77 69 74 68  20 52 32 3d 30 20 61 6e  |ain with R2=0 an|
00001f70  64 20 52 30 3d 74 68 65  20 70 61 72 61 6d 65 74  |d R0=the paramet|
00001f80  65 72 20 79 6f 75 0a 68  61 76 65 20 70 61 73 73  |er you.have pass|
00001f90  65 64 2e 20 54 68 69 73  20 6d 65 74 68 6f 64 20  |ed. This method |
00001fa0  65 6e 73 75 72 65 73 20  74 68 61 74 20 74 68 65  |ensures that the|
00001fb0  20 63 6f 6d 6d 61 6e 64  20 69 73 20 6c 65 61 72  | command is lear|
00001fc0  6e 74 20 63 6f 72 72 65  63 74 6c 79 2c 20 61 73  |nt correctly, as|
00001fd0  0a 6f 6e 6c 79 20 63 6f  6d 6d 61 6e 64 20 63 61  |.only command ca|
00001fe0  6c 6c 73 20 77 69 74 68  20 52 32 3d 30 20 6f 72  |lls with R2=0 or|
00001ff0  20 52 32 3d 31 20 61 72  65 20 6c 65 61 72 6e 74  | R2=1 are learnt|
00002000  2e 20 4d 69 6e 69 62 75  66 66 65 72 20 73 65 74  |. Minibuffer set|
00002010  75 70 20 63 61 6c 6c 73  20 77 69 74 68 0a 52 32  |up calls with.R2|
00002020  3e 31 20 61 72 65 20 4e  4f 54 20 6c 65 61 72 6e  |>1 are NOT learn|
00002030  74 20 77 68 65 6e 20 79  6f 75 20 61 72 65 20 69  |t when you are i|
00002040  6e 20 27 6c 65 61 72 6e  20 61 20 6b 65 79 20 73  |n 'learn a key s|
00002050  65 71 75 65 6e 63 65 20  6d 6f 64 65 27 2e 0a 0a  |equence mode'...|
00002060  4e 6f 77 20 74 68 65 20  6d 69 6e 69 62 75 66 66  |Now the minibuff|
00002070  65 72 20 69 73 20 6f 70  65 6e 65 64 20 6f 6e 20  |er is opened on |
00002080  73 63 72 65 65 6e 2e 20  54 68 65 20 66 6f 6c 6c  |screen. The foll|
00002090  6f 77 69 6e 67 20 68 61  70 70 65 6e 73 20 77 68  |owing happens wh|
000020a0  65 6e 20 61 20 6b 65 79  20 69 73 0a 74 79 70 65  |en a key is.type|
000020b0  64 20 62 79 20 74 68 65  20 75 73 65 72 3a 0a 0a  |d by the user:..|
000020c0  49 66 20 79 6f 75 20 68  61 76 65 20 62 37 20 61  |If you have b7 a|
000020d0  6e 64 20 62 38 20 63 6c  65 61 72 65 64 20 74 68  |nd b8 cleared th|
000020e0  65 6e 20 74 68 65 20 6b  65 79 20 69 73 20 69 6e  |en the key is in|
000020f0  73 65 72 74 65 64 20 69  6e 74 6f 20 74 68 65 20  |serted into the |
00002100  6d 69 6e 69 62 75 66 66  65 72 0a 61 75 74 6f 6d  |minibuffer.autom|
00002110  61 74 69 63 61 6c 6c 79  2e 20 45 53 43 41 50 45  |atically. ESCAPE|
00002120  20 61 6e 64 20 43 54 52  4c 2d 47 20 63 61 75 73  | and CTRL-G caus|
00002130  65 20 74 68 65 20 6d 69  6e 69 62 75 66 66 65 72  |e the minibuffer|
00002140  20 74 6f 20 63 6c 6f 73  65 20 28 77 69 74 68 6f  | to close (witho|
00002150  75 74 0a 63 61 6c 6c 69  6e 67 20 79 6f 75 29 20  |ut.calling you) |
00002160  61 6e 64 20 52 45 54 55  52 4e 20 63 61 75 73 65  |and RETURN cause|
00002170  73 20 79 6f 75 72 20 63  6f 6d 6d 61 6e 64 20 74  |s your command t|
00002180  6f 20 62 65 20 63 61 6c  6c 65 64 20 61 73 20 64  |o be called as d|
00002190  65 73 63 72 69 62 65 64  0a 62 65 6c 6f 77 2e 0a  |escribed.below..|
000021a0  0a 49 66 20 79 6f 75 20  77 61 6e 74 20 74 6f 20  |.If you want to |
000021b0  69 6e 74 65 72 63 65 70  74 20 6b 65 79 73 20 42  |intercept keys B|
000021c0  45 46 4f 52 45 20 74 68  65 79 20 61 72 65 20 61  |EFORE they are a|
000021d0  63 74 65 64 20 6f 6e 20  74 68 65 6e 20 73 65 74  |cted on then set|
000021e0  20 62 38 20 6f 66 20 79  6f 75 72 0a 66 6c 61 67  | b8 of your.flag|
000021f0  73 20 77 6f 72 64 2e 20  59 6f 75 20 77 69 6c 6c  |s word. You will|
00002200  20 74 68 65 6e 20 62 65  20 63 61 6c 6c 65 64 20  | then be called |
00002210  77 69 74 68 20 52 32 3d  26 38 30 30 30 2b 5a 61  |with R2=&8000+Za|
00002220  70 73 20 69 6e 74 65 72  6e 61 6c 20 6b 65 79 20  |ps internal key |
00002230  6e 75 6d 62 65 72 2c 0a  61 6e 64 20 52 30 3d 74  |number,.and R0=t|
00002240  68 65 20 6d 69 6e 69 62  75 66 66 65 72 20 63 6f  |he minibuffer co|
00002250  6e 74 65 6e 74 73 20 73  74 72 69 6e 67 20 77 68  |ntents string wh|
00002260  65 6e 20 74 68 65 20 6b  65 79 20 69 73 20 74 79  |en the key is ty|
00002270  70 65 64 2e 20 41 66 74  65 72 20 79 6f 75 20 68  |ped. After you h|
00002280  61 76 65 0a 64 65 61 6c  74 20 77 69 74 68 20 74  |ave.dealt with t|
00002290  68 65 20 6b 65 79 2c 20  79 6f 75 20 72 65 74 75  |he key, you retu|
000022a0  72 6e 20 61 20 76 61 6c  75 65 20 69 6e 20 52 30  |rn a value in R0|
000022b0  20 74 6f 20 74 65 6c 6c  20 74 68 65 20 6d 69 6e  | to tell the min|
000022c0  69 62 75 66 66 65 72 20  77 68 61 74 20 74 6f 0a  |ibuffer what to.|
000022d0  64 6f 20 77 69 74 68 20  74 68 65 20 6b 65 79 2e  |do with the key.|
000022e0  20 54 68 65 72 65 20 61  72 65 20 33 20 70 6f 73  | There are 3 pos|
000022f0  73 69 62 6c 65 20 63 61  73 65 73 3a 0a 20 52 30  |sible cases:. R0|
00002300  3d 2d 31 09 09 49 6e 20  74 68 69 73 20 63 61 73  |=-1..In this cas|
00002310  65 20 6e 6f 20 63 68 61  6e 67 65 20 69 73 20 6d  |e no change is m|
00002320  61 64 65 20 74 6f 20 74  68 65 20 6d 69 6e 69 62  |ade to the minib|
00002330  75 66 66 65 72 2e 20 43  6f 6d 6d 61 6e 64 0a 09  |uffer. Command..|
00002340  09 70 72 6f 63 65 73 73  69 6e 67 20 63 6f 6e 74  |.processing cont|
00002350  69 6e 75 65 73 20 61 73  20 6e 6f 72 6d 61 6c 20  |inues as normal |
00002360  28 79 6f 75 20 77 69 6c  6c 20 62 65 20 63 61 6c  |(you will be cal|
00002370  6c 65 64 20 69 66 20 62  37 0a 09 09 6f 66 20 79  |led if b7...of y|
00002380  6f 75 72 20 66 6c 61 67  73 20 77 6f 72 64 20 73  |our flags word s|
00002390  65 74 20 65 74 63 29 2e  0a 20 52 30 3d 6b 65 79  |et etc).. R0=key|
000023a0  20 6e 75 6d 62 65 72 09  54 68 65 6e 20 74 68 65  | number.Then the|
000023b0  20 67 69 76 65 6e 20 6b  65 79 20 69 73 20 61 63  | given key is ac|
000023c0  74 65 64 20 6f 6e 20 61  73 20 69 66 20 69 74 20  |ted on as if it |
000023d0  77 65 72 65 20 74 68 65  20 6f 6e 65 20 74 79 70  |were the one typ|
000023e0  65 64 2e 0a 20 09 09 48  65 6e 63 65 20 79 6f 75  |ed.. ..Hence you|
000023f0  20 77 69 6c 6c 20 75 73  75 61 6c 6c 79 20 65 78  | will usually ex|
00002400  69 74 20 62 79 20 53 55  42 20 52 30 2c 52 32 2c  |it by SUB R0,R2,|
00002410  23 26 38 30 30 30 2e 0a  20 52 30 3d 26 38 30 30  |#&8000.. R0=&800|
00002420  30 09 49 6e 20 74 68 69  73 20 63 61 73 65 2c 20  |0.In this case, |
00002430  74 68 65 20 6d 69 6e 69  62 75 66 66 65 72 20 69  |the minibuffer i|
00002440  73 20 71 75 69 74 74 65  64 20 61 73 20 69 66 20  |s quitted as if |
00002450  52 65 74 75 72 6e 20 68  61 64 0a 20 20 20 20 2b  |Return had.    +|
00002460  6b 65 79 20 6e 75 6d 62  65 72 09 62 65 65 6e 20  |key number.been |
00002470  70 72 65 73 73 65 64 20  28 69 65 20 79 6f 75 20  |pressed (ie you |
00002480  61 72 65 20 63 61 6c 6c  65 64 20 77 69 74 68 20  |are called with |
00002490  52 32 3d 31 20 61 73 20  64 65 73 63 72 69 62 65  |R2=1 as describe|
000024a0  64 0a 09 09 62 65 6c 6f  77 29 2e 20 54 68 65 6e  |d...below). Then|
000024b0  2c 20 41 46 54 45 52 20  74 68 65 20 6d 69 6e 69  |, AFTER the mini|
000024c0  62 75 66 66 65 72 20 68  61 73 20 62 65 65 6e 20  |buffer has been |
000024d0  63 6c 6f 73 65 64 2c 20  74 68 65 0a 09 09 69 6e  |closed, the...in|
000024e0  64 69 63 61 74 65 64 20  6b 65 79 20 77 69 6c 6c  |dicated key will|
000024f0  20 62 65 20 61 63 74 65  64 20 6f 6e 20 61 73 20  | be acted on as |
00002500  69 66 20 74 79 70 65 64  20 69 6e 20 74 68 65 20  |if typed in the |
00002510  65 64 69 74 69 6e 67 0a  09 09 77 69 6e 64 6f 77  |editing...window|
00002520  2e 20 54 68 69 73 20 65  6e 61 62 6c 65 73 20 6b  |. This enables k|
00002530  65 79 62 6f 61 72 64 2d  73 65 61 72 63 68 20 74  |eyboard-search t|
00002540  6f 20 62 65 20 71 75 69  74 74 65 64 20 62 79 2c  |o be quitted by,|
00002550  20 66 6f 72 0a 09 09 65  78 61 6d 70 6c 65 2c 20  | for...example, |
00002560  75 70 20 61 72 72 6f 77  20 6f 72 20 63 74 72 6c  |up arrow or ctrl|
00002570  20 58 2e 0a 20 28 49 66  20 79 6f 75 20 6a 75 73  | X.. (If you jus|
00002580  74 20 77 61 6e 74 20 74  6f 20 71 75 69 74 20 74  |t want to quit t|
00002590  68 65 20 6d 69 6e 69 62  75 66 66 65 72 20 74 68  |he minibuffer th|
000025a0  65 6e 20 72 65 74 75 72  6e 20 52 30 3d 26 31 42  |en return R0=&1B|
000025b0  3d 45 53 43 41 50 45 29  2e 0a 20 4f 6e 65 20 63  |=ESCAPE).. One c|
000025c0  6f 6d 6d 6f 6e 20 75 73  65 20 6f 66 20 74 68 69  |ommon use of thi|
000025d0  73 20 63 61 6c 6c 20 69  73 20 74 6f 20 74 72 61  |s call is to tra|
000025e0  70 20 74 68 65 20 54 41  42 20 6b 65 79 20 66 6f  |p the TAB key fo|
000025f0  72 20 63 6f 6d 70 6c 65  74 69 6e 67 20 61 6e 20  |r completing an |
00002600  65 6e 74 72 79 0a 28 65  67 20 63 6f 6d 6d 61 6e  |entry.(eg comman|
00002610  64 20 6e 61 6d 65 20 6f  72 20 66 69 6c 65 6e 61  |d name or filena|
00002620  6d 65 29 2e 20 49 66 20  79 6f 75 20 73 65 74 20  |me). If you set |
00002630  62 39 20 6f 66 20 79 6f  75 72 20 66 6c 61 67 73  |b9 of your flags|
00002640  20 77 6f 72 64 2c 20 74  68 65 6e 20 5a 61 70 0a  | word, then Zap.|
00002650  61 73 73 75 6d 65 73 20  74 68 65 20 62 75 66 66  |assumes the buff|
00002660  65 72 20 63 6f 6e 74 61  69 6e 73 20 61 20 66 69  |er contains a fi|
00002670  6c 65 20 6e 61 6d 65 20  61 6e 64 20 61 75 74 6f  |le name and auto|
00002680  6d 61 74 69 63 61 6c 6c  79 20 63 6f 6d 70 6c 65  |matically comple|
00002690  74 65 73 20 74 68 65 20  66 69 6c 65 0a 6e 61 6d  |tes the file.nam|
000026a0  65 20 77 68 65 6e 20 54  41 42 20 69 73 20 70 72  |e when TAB is pr|
000026b0  65 73 73 65 64 2c 20 73  61 76 69 6e 67 20 79 6f  |essed, saving yo|
000026c0  75 20 61 6c 6c 20 74 68  65 20 77 6f 72 6b 21 0a  |u all the work!.|
000026d0  0a 49 66 20 79 6f 75 20  77 61 6e 74 20 74 6f 20  |.If you want to |
000026e0  65 78 61 6d 69 6e 65 20  74 68 65 20 6d 69 6e 69  |examine the mini|
000026f0  62 75 66 66 65 72 20 63  6f 6e 74 65 6e 74 73 20  |buffer contents |
00002700  41 46 54 45 52 20 74 68  65 20 63 68 61 72 61 63  |AFTER the charac|
00002710  74 65 72 20 68 61 73 20  62 65 65 6e 0a 65 6e 74  |ter has been.ent|
00002720  65 72 65 64 20 69 6e 74  6f 20 74 68 65 20 6d 69  |ered into the mi|
00002730  6e 69 62 75 66 66 65 72  20 62 79 20 5a 61 70 2c  |nibuffer by Zap,|
00002740  20 79 6f 75 20 73 68 6f  75 6c 64 20 73 65 74 20  | you should set |
00002750  62 37 20 6f 66 20 79 6f  75 72 20 66 6c 61 67 73  |b7 of your flags|
00002760  20 77 6f 72 64 2e 20 59  6f 75 0a 77 69 6c 6c 20  | word. You.will |
00002770  74 68 65 6e 20 62 65 20  63 61 6c 6c 65 64 20 77  |then be called w|
00002780  69 74 68 20 52 30 3d 74  68 65 20 6d 69 6e 69 62  |ith R0=the minib|
00002790  75 66 66 65 72 20 63 6f  6e 74 65 6e 74 73 20 73  |uffer contents s|
000027a0  74 72 69 6e 67 2c 20 61  6e 64 20 52 32 3d 37 2e  |tring, and R2=7.|
000027b0  20 54 68 69 73 0a 63 61  6c 6c 20 28 61 73 20 77  | This.call (as w|
000027c0  69 74 68 20 74 68 65 20  70 72 65 76 69 6f 75 73  |ith the previous|
000027d0  20 6f 6e 65 29 20 69 73  20 6d 61 64 65 20 62 65  | one) is made be|
000027e0  66 6f 72 65 20 74 68 65  20 6d 69 6e 69 62 75 66  |fore the minibuf|
000027f0  66 65 72 20 63 6f 6e 74  65 6e 74 73 20 69 73 0a  |fer contents is.|
00002800  75 70 64 61 74 65 64 20  6f 6e 20 73 63 72 65 65  |updated on scree|
00002810  6e 20 61 6e 64 20 74 68  75 73 20 79 6f 75 20 64  |n and thus you d|
00002820  6f 6e 27 74 20 6e 65 65  64 20 74 6f 20 63 61 6c  |on't need to cal|
00002830  6c 20 5a 61 70 5f 4d 69  6e 69 55 70 64 61 74 65  |l Zap_MiniUpdate|
00002840  20 69 66 20 79 6f 75 20  61 6c 74 65 72 0a 74 68  | if you alter.th|
00002850  65 20 6d 69 6e 69 62 75  66 66 65 72 20 63 6f 6e  |e minibuffer con|
00002860  74 65 6e 74 73 2e 20 46  6f 72 20 65 78 61 6d 70  |tents. For examp|
00002870  6c 65 2c 20 73 65 61 72  63 68 20 61 73 20 79 6f  |le, search as yo|
00002880  75 20 74 79 70 65 20 28  43 54 52 4c 2d 53 29 20  |u type (CTRL-S) |
00002890  75 73 65 73 20 74 68 69  73 0a 63 61 6c 6c 20 74  |uses this.call t|
000028a0  6f 20 6a 75 6d 70 20 74  6f 20 74 68 65 20 6e 65  |o jump to the ne|
000028b0  78 74 20 6d 61 74 63 68  20 61 66 74 65 72 20 65  |xt match after e|
000028c0  76 65 72 79 20 6b 65 79  20 70 72 65 73 73 2e 0a  |very key press..|
000028d0  0a 5a 61 70 20 65 6e 74  65 72 73 20 6b 65 79 73  |.Zap enters keys|
000028e0  20 69 6e 74 6f 20 74 68  65 20 6d 69 6e 69 62 75  | into the minibu|
000028f0  66 66 65 72 20 75 6e 74  69 6c 20 74 68 65 20 75  |ffer until the u|
00002900  73 65 72 20 70 72 65 73  73 65 73 20 45 53 43 41  |ser presses ESCA|
00002910  50 45 2c 20 43 54 52 4c  2d 47 20 6f 72 0a 52 45  |PE, CTRL-G or.RE|
00002920  54 55 52 4e 2e 20 54 68  65 20 66 69 72 73 74 20  |TURN. The first |
00002930  74 77 6f 20 71 75 69 74  20 74 68 65 20 6d 69 6e  |two quit the min|
00002940  69 62 75 66 66 65 72 2e  0a 0a 57 68 65 6e 20 74  |ibuffer...When t|
00002950  68 65 20 75 73 65 72 20  70 72 65 73 73 65 73 20  |he user presses |
00002960  52 45 54 55 52 4e 2c 20  79 6f 75 20 61 72 65 20  |RETURN, you are |
00002970  63 61 6c 6c 65 64 20 77  69 74 68 20 52 30 3d 70  |called with R0=p|
00002980  6f 69 6e 74 65 72 20 74  6f 20 73 74 72 69 6e 67  |ointer to string|
00002990  20 74 79 70 65 64 0a 69  6e 74 6f 20 74 68 65 20  | typed.into the |
000029a0  6d 69 6e 69 62 75 66 66  65 72 2c 20 61 6e 64 20  |minibuffer, and |
000029b0  52 32 3d 31 2e 20 41 73  20 75 73 75 61 6c 2c 20  |R2=1. As usual, |
000029c0  74 68 65 20 73 74 72 69  6e 67 20 70 6f 69 6e 74  |the string point|
000029d0  65 64 20 74 6f 20 62 79  20 52 30 20 64 6f 65 73  |ed to by R0 does|
000029e0  20 6e 6f 74 0a 69 6e 63  6c 75 64 65 20 74 68 65  | not.include the|
000029f0  20 70 72 6f 6d 70 74 2e  20 59 6f 75 20 73 68 6f  | prompt. You sho|
00002a00  75 6c 64 20 74 68 65 6e  20 70 65 72 66 6f 72 6d  |uld then perform|
00002a10  20 74 68 65 20 63 6f 6d  6d 61 6e 64 20 61 63 74  | the command act|
00002a20  69 6f 6e 2c 20 77 69 74  68 20 74 68 69 73 0a 73  |ion, with this.s|
00002a30  74 72 69 6e 67 20 61 73  20 69 6e 70 75 74 2e 20  |tring as input. |
00002a40  55 73 75 61 6c 6c 79 2c  20 74 68 65 20 6d 69 6e  |Usually, the min|
00002a50  69 62 75 66 66 65 72 20  77 69 6c 6c 20 62 65 20  |ibuffer will be |
00002a60  63 6c 6f 73 65 64 20 61  66 74 65 72 20 79 6f 75  |closed after you|
00002a70  72 20 63 6f 6d 6d 61 6e  64 0a 68 61 73 20 66 69  |r command.has fi|
00002a80  6e 69 73 68 65 64 2e 20  49 66 20 79 6f 75 20 77  |nished. If you w|
00002a90  69 73 68 20 69 74 20 74  6f 20 72 65 6d 61 69 6e  |ish it to remain|
00002aa0  20 6f 70 65 6e 20 28 65  67 20 74 68 65 20 43 4f  | open (eg the CO|
00002ab0  4d 4d 41 4e 44 20 63 6f  6d 6d 61 6e 64 29 20 74  |MMAND command) t|
00002ac0  68 65 6e 0a 73 65 74 20  62 31 31 20 6f 66 20 79  |hen.set b11 of y|
00002ad0  6f 75 72 20 63 6f 6d 6d  61 6e 64 20 77 6f 72 64  |our command word|
00002ae0  2c 20 61 6e 64 20 72 65  74 75 72 6e 20 52 30 3d  |, and return R0=|
00002af0  30 20 74 6f 20 63 6c 6f  73 65 20 74 68 65 20 6d  |0 to close the m|
00002b00  69 6e 69 62 75 66 66 65  72 20 61 6e 64 0a 52 30  |inibuffer and.R0|
00002b10  3d 31 20 74 6f 20 6c 65  61 76 65 20 69 74 20 6f  |=1 to leave it o|
00002b20  70 65 6e 20 77 68 65 6e  20 79 6f 75 20 65 78 69  |pen when you exi|
00002b30  74 20 66 72 6f 6d 20 62  65 69 6e 67 20 63 61 6c  |t from being cal|
00002b40  6c 65 64 20 77 69 74 68  20 52 32 3d 31 2e 0a 0a  |led with R2=1...|
00002b50  54 68 65 20 63 6f 64 65  73 20 52 32 3d 31 20 61  |The codes R2=1 a|
00002b60  6e 64 20 52 32 3d 30 20  73 68 6f 75 6c 64 20 63  |nd R2=0 should c|
00002b70  61 75 73 65 20 74 68 65  20 73 61 6d 65 20 61 63  |ause the same ac|
00002b80  74 69 6f 6e 20 74 6f 20  74 61 6b 65 20 70 6c 61  |tion to take pla|
00002b90  63 65 2e 20 54 68 69 73  20 69 73 0a 74 6f 20 65  |ce. This is.to e|
00002ba0  6e 73 75 72 65 20 74 68  65 20 4c 45 41 52 4e 20  |nsure the LEARN |
00002bb0  66 75 6e 63 74 69 6f 6e  20 77 6f 72 6b 73 20 63  |function works c|
00002bc0  6f 72 72 65 63 74 6c 79  2e 20 57 68 65 6e 20 61  |orrectly. When a|
00002bd0  20 6c 65 61 72 6e 74 20  66 75 6e 63 74 69 6f 6e  | learnt function|
00002be0  20 69 73 0a 65 78 65 63  75 74 65 64 2c 20 74 68  | is.executed, th|
00002bf0  65 20 6d 69 6e 69 62 75  66 66 65 72 20 77 69 6c  |e minibuffer wil|
00002c00  6c 20 6e 6f 74 20 62 65  20 6f 70 65 6e 65 64 20  |l not be opened |
00002c10  61 67 61 69 6e 2c 20 62  75 74 20 74 68 65 20 63  |again, but the c|
00002c20  6f 6d 6d 61 6e 64 20 77  69 6c 6c 20 62 65 0a 63  |ommand will be.c|
00002c30  61 6c 6c 65 64 20 77 69  74 68 20 52 32 3d 30 20  |alled with R2=0 |
00002c40  61 6e 64 20 74 68 65 20  70 72 65 76 69 6f 75 73  |and the previous|
00002c50  6c 79 20 74 79 70 65 64  20 73 74 72 69 6e 67 20  |ly typed string |
00002c60  61 73 20 69 6e 70 75 74  20 69 6e 20 52 30 2e 20  |as input in R0. |
00002c70  46 6f 72 20 65 78 61 6d  70 6c 65 2c 0a 69 66 20  |For example,.if |
00002c80  79 6f 75 20 6c 65 61 72  6e 20 74 68 65 20 73 65  |you learn the se|
00002c90  71 75 65 6e 63 65 3a 20  63 74 72 6c 2d 53 20 2c  |quence: ctrl-S ,|
00002ca0  20 22 77 69 62 62 6c 65  22 20 2c 20 52 45 54 55  | "wibble" , RETU|
00002cb0  52 4e 20 74 79 70 65 64  20 69 6e 20 74 68 65 0a  |RN typed in the.|
00002cc0  6d 69 6e 69 62 75 66 66  65 72 2c 20 74 68 65 6e  |minibuffer, then|
00002cd0  20 77 68 65 6e 20 74 68  69 73 20 69 73 20 70 6c  | when this is pl|
00002ce0  61 79 65 64 20 62 61 63  6b 20 74 68 65 20 63 6f  |ayed back the co|
00002cf0  6d 6d 61 6e 64 20 53 45  41 52 43 48 46 4f 52 57  |mmand SEARCHFORW|
00002d00  41 52 44 20 77 69 6c 6c  20 62 65 0a 63 61 6c 6c  |ARD will be.call|
00002d10  65 64 20 77 69 74 68 20  52 32 3d 30 20 61 6e 64  |ed with R2=0 and|
00002d20  20 52 30 3d 22 77 69 62  62 6c 65 22 20 61 73 20  | R0="wibble" as |
00002d30  6f 70 70 6f 73 65 64 20  74 6f 20 6f 70 65 6e 69  |opposed to openi|
00002d40  6e 67 20 74 68 65 20 6d  69 6e 69 62 75 66 66 65  |ng the minibuffe|
00002d50  72 2e 20 4f 6e 6c 79 0a  63 6f 6d 6d 61 6e 64 20  |r. Only.command |
00002d60  63 61 6c 6c 73 20 77 69  74 68 20 52 32 3d 30 20  |calls with R2=0 |
00002d70  6f 72 20 31 20 61 72 65  20 6c 65 61 72 6e 74 2e  |or 1 are learnt.|
00002d80  0a 0a 44 61 74 61 20 74  79 70 65 20 3d 20 42 6c  |..Data type = Bl|
00002d90  6f 63 6b 20 28 34 29 0a  2d 2d 2d 2d 2d 2d 2d 2d  |ock (4).--------|
00002da0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 54  |-------------..T|
00002db0  68 65 6e 20 52 30 20 3d  20 70 6f 69 6e 74 65 72  |hen R0 = pointer|
00002dc0  20 74 6f 20 61 20 64 61  74 61 20 62 6c 6f 63 6b  | to a data block|
00002dd0  20 28 6f 66 20 63 6f 6d  6d 61 6e 64 20 64 65 70  | (of command dep|
00002de0  65 6e 64 61 6e 74 20 66  6f 72 6d 61 74 29 2c 20  |endant format), |
00002df0  61 6e 64 0a 52 31 3d 6e  75 6d 62 65 72 20 6f 66  |and.R1=number of|
00002e00  20 74 69 6d 65 73 20 6b  65 79 20 70 72 65 73 73  | times key press|
00002e10  65 64 2e 20 54 68 69 73  20 61 72 67 75 6d 65 6e  |ed. This argumen|
00002e20  74 20 74 79 70 65 20 69  73 20 75 73 65 64 20 62  |t type is used b|
00002e30  79 20 74 68 65 20 63 6f  6d 6d 61 6e 64 0a 4d 55  |y the command.MU|
00002e40  4c 54 49 43 4f 4d 4d 41  4e 44 20 77 68 69 63 68  |LTICOMMAND which|
00002e50  20 69 73 20 75 73 65 64  20 69 6e 74 65 72 6e 61  | is used interna|
00002e60  6c 6c 79 20 77 69 74 68  69 6e 20 5a 61 70 20 74  |lly within Zap t|
00002e70  6f 20 65 78 65 63 75 74  65 20 61 20 6c 69 73 74  |o execute a list|
00002e80  20 6f 66 20 6f 74 68 65  72 0a 63 6f 6d 6d 61 6e  | of other.comman|
00002e90  64 73 2e 20 46 6f 72 20  65 78 61 6d 70 6c 65 2c  |ds. For example,|
00002ea0  20 77 68 65 6e 20 79 6f  75 20 74 79 70 65 20 61  | when you type a|
00002eb0  20 73 65 71 75 65 6e 63  65 20 6f 66 20 63 6f 6d  | sequence of com|
00002ec0  6d 61 6e 64 73 20 73 65  70 61 72 61 74 65 64 20  |mands separated |
00002ed0  62 79 20 61 0a 22 3a 22  20 69 6e 20 74 68 65 20  |by a.":" in the |
00002ee0  6b 65 79 73 20 66 69 6c  65 2c 20 74 68 65 6e 20  |keys file, then |
00002ef0  74 68 69 73 20 69 73 20  63 6f 6e 76 65 72 74 65  |this is converte|
00002f00  64 20 74 6f 20 74 68 65  20 6f 6e 65 20 63 6f 6d  |d to the one com|
00002f10  6d 61 6e 64 20 4d 55 4c  54 49 43 4f 4d 4d 41 4e  |mand MULTICOMMAN|
00002f20  44 0a 77 69 74 68 20 64  61 74 61 20 62 6c 6f 63  |D.with data bloc|
00002f30  6b 20 61 73 20 61 20 6c  69 73 74 20 6f 66 20 74  |k as a list of t|
00002f40  68 65 20 66 75 6e 63 74  69 6f 6e 73 20 74 6f 20  |he functions to |
00002f50  63 61 6c 6c 2e 20 59 6f  75 20 63 61 6e 6e 6f 74  |call. You cannot|
00002f60  20 70 75 74 20 73 75 63  68 20 61 0a 63 6f 6d 6d  | put such a.comm|
00002f70  61 6e 64 20 69 6e 20 74  68 65 20 6b 65 79 73 20  |and in the keys |
00002f80  66 69 6c 65 20 61 73 20  74 68 65 72 65 20 69 73  |file as there is|
00002f90  20 6e 6f 20 77 61 79 20  6f 66 20 73 70 65 63 69  | no way of speci|
00002fa0  66 79 69 6e 67 20 61 20  64 61 74 61 20 62 6c 6f  |fying a data blo|
00002fb0  63 6b 20 61 73 0a 70 61  72 61 6d 65 74 65 72 2e  |ck as.parameter.|
00002fc0  0a 0a 0a 45 58 41 4d 50  4c 45 0a 2d 2d 2d 2d 2d  |...EXAMPLE.-----|
00002fd0  2d 2d 0a 0a 54 68 65 20  63 6f 64 65 20 62 65 6c  |--..The code bel|
00002fe0  6f 77 20 69 6d 70 6c 65  6d 65 6e 74 73 20 61 20  |ow implements a |
00002ff0  73 69 6d 70 6c 65 20 63  6f 6d 6d 61 6e 64 20 77  |simple command w|
00003000  68 69 63 68 20 61 73 6b  73 20 79 6f 75 20 74 6f  |hich asks you to|
00003010  20 65 6e 74 65 72 20 61  20 6e 75 6d 62 65 72 0a  | enter a number.|
00003020  69 6e 74 6f 20 74 68 65  20 6d 69 6e 69 62 75 66  |into the minibuf|
00003030  66 65 72 20 61 6e 64 20  74 68 65 6e 20 73 77 69  |fer and then swi|
00003040  74 63 68 65 73 20 74 6f  20 74 68 61 74 20 64 69  |tches to that di|
00003050  73 70 6c 61 79 20 6d 6f  64 65 2e 20 46 4e 63 61  |splay mode. FNca|
00003060  6c 6c 20 69 73 20 61 20  6d 61 63 72 6f 0a 77 68  |ll is a macro.wh|
00003070  69 63 68 20 63 61 6c 6c  73 20 74 68 65 20 6e 61  |ich calls the na|
00003080  6d 65 64 20 5a 61 70 20  65 6e 74 72 79 20 70 6f  |med Zap entry po|
00003090  69 6e 74 20 28 73 65 65  20 45 2d 5a 61 70 63 61  |int (see E-Zapca|
000030a0  6c 6c 73 20 66 6f 72 20  69 74 73 20 64 65 66 69  |lls for its defi|
000030b0  6e 69 74 69 6f 6e 29 2e  0a 0a 09 45 51 55 44 20  |nition)....EQUD |
000030c0  28 33 3c 3c 33 29 2b 28  31 3c 3c 36 29 09 09 5c  |(3<<3)+(1<<6)..\|
000030d0  20 73 74 72 69 6e 67 20  61 72 67 75 6d 65 6e 74  | string argument|
000030e0  20 2b 20 61 73 6b 20 66  6f 72 20 70 72 6f 6d 70  | + ask for promp|
000030f0  74 0a 09 2e 63 6f 6d 6d  61 6e 64 5f 73 74 61 72  |t...command_star|
00003100  74 0a 09 53 54 4d 46 44  20 52 31 33 21 2c 7b 52  |t..STMFD R13!,{R|
00003110  31 34 7d 0a 09 54 45 51  20 52 32 2c 23 36 09 09  |14}..TEQ R2,#6..|
00003120  09 5c 20 69 73 20 74 68  65 20 6d 69 6e 69 62 75  |.\ is the minibu|
00003130  66 66 65 72 20 61 62 6f  75 74 20 74 6f 20 6f 70  |ffer about to op|
00003140  65 6e 0a 09 42 45 51 20  61 64 64 5f 70 72 6f 6d  |en..BEQ add_prom|
00003150  70 74 0a 09 46 4e 63 61  6c 6c 28 5a 61 70 5f 4d  |pt..FNcall(Zap_M|
00003160  69 6e 69 45 76 61 6c 29  09 09 5c 20 66 69 6e 64  |iniEval)..\ find|
00003170  20 74 68 65 20 6e 75 6d  62 65 72 20 74 79 70 65  | the number type|
00003180  64 0a 09 4c 44 4d 56 53  46 44 20 52 31 33 21 2c  |d..LDMVSFD R13!,|
00003190  7b 50 43 7d 09 09 5c 20  65 72 72 6f 72 0a 09 4c  |{PC}..\ error..L|
000031a0  44 4d 43 53 46 44 20 52  31 33 21 2c 7b 50 43 7d  |DMCSFD R13!,{PC}|
000031b0  09 09 5c 20 77 61 73 6e  27 74 20 61 20 76 61 6c  |..\ wasn't a val|
000031c0  69 64 20 6e 75 6d 62 65  72 0a 09 46 4e 63 61 6c  |id number..FNcal|
000031d0  6c 28 5a 61 70 5f 4e 65  77 4d 6f 64 65 29 09 09  |l(Zap_NewMode)..|
000031e0  5c 20 63 68 61 6e 67 65  20 6d 6f 64 65 0a 09 4c  |\ change mode..L|
000031f0  44 4d 46 44 20 52 31 33  21 2c 7b 50 43 7d 09 09  |DMFD R13!,{PC}..|
00003200  09 5c 20 66 69 6e 69 73  68 65 64 0a 09 2e 61 64  |.\ finished...ad|
00003210  64 5f 70 72 6f 6d 70 74  0a 09 41 44 52 20 52 30  |d_prompt..ADR R0|
00003220  2c 70 72 6f 6d 70 74 5f  73 74 72 69 6e 67 0a 09  |,prompt_string..|
00003230  46 4e 63 61 6c 6c 28 5a  61 70 5f 4d 69 6e 69 50  |FNcall(Zap_MiniP|
00003240  72 6f 6d 70 74 29 09 09  5c 20 69 6e 73 65 72 74  |rompt)..\ insert|
00003250  20 74 68 65 20 70 72 6f  6d 70 74 20 73 74 72 69  | the prompt stri|
00003260  6e 67 0a 09 4c 44 4d 46  44 20 52 31 33 21 2c 7b  |ng..LDMFD R13!,{|
00003270  50 43 7d 09 09 20 0a 09  2e 70 72 6f 6d 70 74 5f  |PC}.. ...prompt_|
00003280  73 74 72 69 6e 67 0a 09  45 51 55 53 20 22 4e 65  |string..EQUS "Ne|
00003290  77 20 6d 6f 64 65 3a 20  22 0a 09 45 51 55 42 20  |w mode: "..EQUB |
000032a0  30 0a 09 41 4c 49 47 4e  0a 0a 49 74 20 69 73 20  |0..ALIGN..It is |
000032b0  74 68 65 20 6f 66 66 73  65 74 20 6f 66 20 63 6f  |the offset of co|
000032c0  6d 6d 61 6e 64 5f 73 74  61 72 74 20 74 68 61 74  |mmand_start that|
000032d0  20 79 6f 75 20 6d 75 73  74 20 70 6c 61 63 65 20  | you must place |
000032e0  69 6e 20 79 6f 75 72 20  63 6f 6d 6d 61 6e 64 20  |in your command |
000032f0  74 61 62 6c 65 2c 0a 6e  6f 74 20 74 68 65 20 6f  |table,.not the o|
00003300  66 66 73 65 74 20 6f 66  20 74 68 65 20 45 51 55  |ffset of the EQU|
00003310  44 20 66 6c 61 67 73 20  77 6f 72 64 20 62 65 66  |D flags word bef|
00003320  6f 72 65 20 69 74 2e 20  4e 6f 74 65 20 74 68 61  |ore it. Note tha|
00003330  74 20 74 68 65 20 63 6f  6d 6d 61 6e 64 0a 70 65  |t the command.pe|
00003340  72 66 6f 72 6d 73 20 74  68 65 20 73 61 6d 65 20  |rforms the same |
00003350  61 63 74 69 6f 6e 20 72  65 67 61 72 64 6c 65 73  |action regardles|
00003360  73 20 6f 66 20 77 68 65  74 68 65 72 20 52 32 3d  |s of whether R2=|
00003370  30 20 6f 72 20 52 32 3d  31 2e 0a 0a 0a 5a 61 70  |0 or R2=1....Zap|
00003380  20 73 65 72 76 69 63 65  20 63 61 6c 6c 73 0a 2d  | service calls.-|
00003390  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000033a0  0a 0a 49 66 20 74 68 65  20 73 65 63 6f 6e 64 20  |..If the second |
000033b0  77 6f 72 64 20 69 6e 20  79 6f 75 72 20 63 6f 6d  |word in your com|
000033c0  6d 61 6e 64 20 74 61 62  6c 65 20 69 73 20 6e 6f  |mand table is no|
000033d0  6e 20 7a 65 72 6f 20 74  68 65 6e 20 69 74 20 67  |n zero then it g|
000033e0  69 76 65 73 20 74 68 65  0a 6d 6f 64 75 6c 65 20  |ives the.module |
000033f0  6f 66 66 73 65 74 20 6f  66 20 61 20 27 5a 61 70  |offset of a 'Zap|
00003400  20 73 65 72 76 69 63 65  20 63 61 6c 6c 20 68 61  | service call ha|
00003410  6e 64 6c 65 72 27 2e 20  54 68 69 73 20 63 6f 64  |ndler'. This cod|
00003420  65 20 69 73 20 63 61 6c  6c 65 64 20 61 74 0a 76  |e is called at.v|
00003430  61 72 69 6f 75 73 20 70  6f 69 6e 74 73 20 74 6f  |arious points to|
00003440  20 74 65 6c 6c 20 79 6f  75 20 61 62 6f 75 74 20  | tell you about |
00003450  74 68 69 6e 67 73 2e 20  49 6e 20 67 65 6e 65 72  |things. In gener|
00003460  61 6c 20 74 68 65 20 65  6e 74 72 79 2f 65 78 69  |al the entry/exi|
00003470  74 0a 63 6f 6e 64 69 74  69 6f 6e 73 20 61 72 65  |t.conditions are|
00003480  3a 0a 0a 09 5c 45 09 52  31 3d 72 65 61 73 6f 6e  |:...\E.R1=reason|
00003490  20 63 6f 64 65 20 61 6e  64 20 6f 74 68 65 72 20  | code and other |
000034a0  72 65 67 69 73 74 65 72  73 20 6d 61 79 20 68 6f  |registers may ho|
000034b0  6c 64 20 64 61 74 61 2e  0a 09 09 52 31 31 3d 75  |ld data....R11=u|
000034c0  6e 64 65 66 69 6e 65 64  0a 09 09 52 31 32 3d 5a  |ndefined...R12=Z|
000034d0  61 70 73 20 77 6f 72 6b  73 70 61 63 65 20 70 6f  |aps workspace po|
000034e0  69 6e 74 65 72 20 61 73  20 75 73 75 61 6c 2e 0a  |inter as usual..|
000034f0  09 5c 58 09 59 6f 75 20  73 68 6f 75 6c 64 20 70  |.\X.You should p|
00003500  72 65 73 65 72 76 65 20  52 31 2d 52 31 33 20 75  |reserve R1-R13 u|
00003510  6e 6c 65 73 73 20 6f 74  68 65 72 77 69 73 65 20  |nless otherwise |
00003520  73 74 61 74 65 64 2e 0a  09 09 52 30 20 61 6e 64  |stated....R0 and|
00003530  20 66 6c 61 67 73 20 6d  61 79 20 62 65 20 63 6f  | flags may be co|
00003540  72 72 75 70 74 65 64 2e  0a 09 09 0a 54 68 65 20  |rrupted.....The |
00003550  28 63 75 72 72 65 6e 74  29 20 73 65 72 76 69 63  |(current) servic|
00003560  65 20 63 61 6c 6c 73 20  61 72 65 20 6c 69 73 74  |e calls are list|
00003570  65 64 20 62 65 6c 6f 77  2e 20 59 6f 75 20 73 68  |ed below. You sh|
00003580  6f 75 6c 64 20 69 67 6e  6f 72 65 20 75 6e 72 65  |ould ignore unre|
00003590  63 6f 67 6e 69 73 65 64  0a 76 61 6c 75 65 73 20  |cognised.values |
000035a0  69 6e 20 52 31 20 73 6f  20 49 20 63 61 6e 20 61  |in R1 so I can a|
000035b0  64 64 20 6d 6f 72 65 20  69 66 20 6e 65 63 65 73  |dd more if neces|
000035c0  73 61 72 79 2e 0a 0a 52  31 3d 30 0a 5a 61 70 20  |sary...R1=0.Zap |
000035d0  69 73 20 71 75 69 74 74  69 6e 67 20 61 6e 64 20  |is quitting and |
000035e0  61 62 6f 75 74 20 74 6f  20 6b 69 6c 6c 20 79 6f  |about to kill yo|
000035f0  75 72 20 6d 6f 64 75 6c  65 2e 20 52 65 74 75 72  |ur module. Retur|
00003600  6e 20 52 30 3d 2d 31 20  74 6f 20 73 74 6f 70 20  |n R0=-1 to stop |
00003610  69 74 2e 0a 59 6f 75 72  20 6d 6f 64 75 6c 65 20  |it..Your module |
00003620  77 69 6c 6c 20 4e 4f 54  20 62 65 20 61 75 74 6f  |will NOT be auto|
00003630  6d 61 74 69 63 61 6c 6c  79 20 6b 69 6c 6c 65 64  |matically killed|
00003640  20 69 66 20 68 61 76 65  20 6e 6f 20 73 65 72 76  | if have no serv|
00003650  69 63 65 20 63 61 6c 6c  20 68 61 6e 64 6c 65 72  |ice call handler|
00003660  0a 28 66 6f 72 20 62 61  63 6b 77 61 72 64 73 20  |.(for backwards |
00003670  63 6f 6d 70 61 74 69 62  69 6c 69 74 79 29 2e 0a  |compatibility)..|
00003680  0a 52 31 3d 31 0a 5a 61  70 20 68 61 73 20 6a 75  |.R1=1.Zap has ju|
00003690  73 74 20 73 74 61 72 74  65 64 20 62 75 74 20 68  |st started but h|
000036a0  61 73 20 6e 6f 74 20 73  65 74 20 75 70 20 69 74  |as not set up it|
000036b0  73 20 68 65 61 70 20 79  65 74 2e 0a 0a 52 31 3d  |s heap yet...R1=|
000036c0  32 0a 5a 61 70 20 68 61  73 20 73 74 61 72 74 65  |2.Zap has starte|
000036d0  64 20 61 6e 64 20 73 65  74 20 75 70 20 69 74 73  |d and set up its|
000036e0  20 68 65 61 70 2e 20 59  6f 75 20 73 68 6f 75 6c  | heap. You shoul|
000036f0  64 20 75 73 65 20 74 68  69 73 20 63 61 6c 6c 20  |d use this call |
00003700  74 6f 20 63 6c 61 69 6d  20 61 6e 79 0a 77 6f 72  |to claim any.wor|
00003710  6b 73 70 61 63 65 20 76  69 61 20 5a 61 70 5f 43  |kspace via Zap_C|
00003720  6c 61 69 6d 2e 0a 0a 52  31 3d 33 0a 5a 61 70 20  |laim...R1=3.Zap |
00003730  69 73 20 64 65 6c 65 74  69 6e 67 20 61 20 66 69  |is deleting a fi|
00003740  6c 65 2e 20 52 39 3d 66  69 6c 65 20 62 6c 6f 63  |le. R9=file bloc|
00003750  6b 20 6f 66 20 66 69 6c  65 20 62 65 69 6e 67 20  |k of file being |
00003760  64 65 6c 65 74 65 64 2e  20 28 53 65 65 20 45 2d  |deleted. (See E-|
00003770  46 69 6c 65 29 0a 0a 52  31 3d 34 0a 5a 61 70 20  |File)..R1=4.Zap |
00003780  69 73 20 64 65 6c 65 74  69 6e 67 20 61 20 77 69  |is deleting a wi|
00003790  6e 64 6f 77 2e 20 52 38  3d 77 69 6e 64 6f 77 20  |ndow. R8=window |
000037a0  62 6c 6f 63 6b 20 6f 66  20 77 69 6e 64 6f 77 20  |block of window |
000037b0  62 65 69 6e 67 20 64 65  6c 65 74 65 64 2e 0a 28  |being deleted..(|
000037c0  53 65 65 20 45 2d 57 69  6e 64 6f 77 73 29 0a     |See E-Windows).|
000037cf