Home » Archimedes archive » Acorn User » Acorn User - Shareware Collection (1993).adf » Zap » !Zap/Docs/E-Entry

!Zap/Docs/E-Entry

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 » Acorn User » Acorn User - Shareware Collection (1993).adf » Zap
Filename: !Zap/Docs/E-Entry
Read OK:
File size: 4AD5 bytes
Load address: 0000
Exec address: 0000
File contents
*************************************************************************
* >E-Entry	Documents the format of a mode entry point table	*
*************************************************************************

The offsets in the entry point table are given names beginning 'e_'. The
E-Library program will define the offsets for you.

You must fill in the first 8 entries of this table. The rest of the entries
you may leave as 0 (or more simply, set the table length in the 8th word to
32 bytes). The idea of the mode table, is that you specify a BASE mode. For
all the entry points (from the 9th onwards) that are off the end of your
table, or that you have left as 0, the base mode will be called instead.

Hence, the simplest zap extension mode would just set the base mode as 0 (ie,
TEXT) and leave the rest as 0. You will then get a clone of the text mode.

In general the following register conventions are used:

	R2	Current column in characters (see E-Windows)
	R3	Current line in characters (see E-Windows)
	R8	Window block pointer / 0 to change the default config
	R9	File block pointer / 0 to change the default config
	R10	Cursor block pointer
	R11	Your extension mode workspace (private word)
	R12	Zaps workspace (private word)

In general the entry points have entry and exit conditions:

	\E R0-R10=parameters R11=your workspace R13=FD stack R14=return addr
	\X You must save R1-R11 (unless otherwise mentioned).
	   You may corrupt R0 and flags.
	   Set V flag and put R0=error block pointer on an error.

See the E-ZapCalls file for more details on my entry/exit syntax.

All offsets given in the table below must be from the start of the module.
Hence the table is relocatable. Zap finds the start address of your module
via the first table entry (e_module). It uses this and an OS_Module call to
determine the address of your workspace (to pass in R11). All strings should
be 0 terminated.

Entry points for arbitrary modes may be called using Zap_CallMode,
Zap_CallGivenMode or Zap_CallBaseMode. If none of these will do, then use
Zap_ReadMode to find the table entry linked points and the address of the
mode's workspace.

The entries are as follows:

e_module
This gives the table offset from the module start so that the module start
may be calculated by !Zap. Ie, module start = address of table start - this
offset.

e_title
Offset of the mode title string to be used in the 'Mode' menu. It should be
at most 7 chars long. (eg 'BASIC')

e_author
Offset of the author name string (eg 'Dominic Symes').

e_basemode
Gives the mode on which to base null entry points. Current modes are: 0=Text
1=byte 2=word 3=ascii 4=hex 5=basic 11=throwback 12=taskwindow. Needless to
say, if you wish to clone the BASIC mode, you'd better be sure that the
Zap_Basic module initialised before yours!

e_mode
Gives the mode number you would like to be in bits b0-b7. Bits 8-31 contain
flags as follows:
	b8	Set to get raw keyboard input passed to e_chars (&00-&FF).
	b31	Set to overwrite any mode already using this mode number.
	Others bits are reserved and should be set to 0.
	If b31 is not set then you are allocated the next free mode if the
	one you wanted is being used.

e_init
Called at various points when zap is starting up/dying. Note that zap will
automatically kill your module on dying unless you tell it otherwise. You
should use reason code 2 to claim any buffers from zap.
    \E R0=mode assigned to you
       R1=reason code
    \X R0=returned value
	If R1=0 then zap is quitting and about to kill your module
	 Return R0=-1 to stop this (eg if you've more than one mode)
	If R1=1 then zap has just started but not set up its heap yet
	If R1=2 then zap has started and set up its heap. On this call you
	 should check your mode word opt_moden to see if it's zero. If so
	 then you should initialise it to a sensible default value.
	If R1=3 then zap is deleting a file with your mode number
	 in f_cmode. R9=file block. Ie, you are told when Zap is about to
	 delete a file that you own. See E-File.

e_menu
Offset of submenu in zaps format / 0 for none. This menu comes off the
'Mode' menu. See the file E-Menu for details of the menu format.

e_len
Total length of the table data (>=32). (So that only entry points within the
table are called and for forward compatibility). If zap finds an entry point
is off the end of the table then it will call the corresponding base mode
entry point.

If any of the following offsets are 0 then the corresponding offset for the
basemode is called.

e_postload
Called after a file is loaded and has had a window opened for it in your
mode. It is also called after a file in your mode has been saved. It enables
the file contents to be slightly altered before editing. (eg BASIC encrypts
the line numbers and BASTXT detokenises the program).
	\E R8/R9
	
e_presave
Called before the file is saved. It enables file contents to be slightly
altered, undoing the effect of e_postload. (eg BASTXT retokenises the program
prior to saving).
	\E R8/R9

e_loading
This is called when a file is loaded off disc for dropping into a window. The
file data is in a heap block. This enables you to change it before insertion
takes place (eg BASTXT detokenises the file). You are only called if the file
type of the file is claimed by your mode (in the 'keys' file).
	\E R2=data length R3=data address
	\X You may change the data, making it larger if necessary
	   provided that you enlarge the heap block R3. Return
	   updated R2 and R3.

e_start
Called when a window enters your mode (eg via Zap_NewMode). You should
restore the w_flags and w_format options from your allocated mode word
w_moden. See E-Flags. If R8=0 on entry then you should restore the default
opt_flags and opt_format value from opt_moden as the user has switched to
your mode on the iconbar menu.
	\E R8/R9=window / 0 for options menu

e_end
Called when a window leaves your mode (eg via Zap_NewMode). This is similar
to e_start except that you should save the current values in w_format,
w_flags in you mode word. Again if R8=0 then you should save the values of
opt_flags, opt_format in your options mode word (see E-Vars).
	\E R8/R9=window / 0 for iconbar menu

e_width
Called when a window is (re)created to find out the width of the work area in
characters (excluding margin). You should read this from the mode word for
your window. If you support auto width and the auto width flag is set (see
E-Flags) then you should work this width out from the file. Once you have
calculated the width, it is advisable to store it in w_bpl, a variable
reserved for this purpose.
	\E R8/R9
	\X R0=width of work area in characters (excluding margin)

e_linecol
Converts a column offset on screen to file offset. This is called by
Zap_FindOffset and other subs. The start offset of the physical line on which
the column lies has been calculated (usually by e_clnoff).
	\E R0=file offset of physical line start
	   R1=column offset on screen (exc margin) R8/R9
	\X R0=file offset of nearest character on the left
		
e_lineoff
Convert file offset to column on screen. This performs the inverse function
to e_linecol. It is usually called by Zap_OffLineCol. Again the offset of the
start of the physical line has been calculated (usually by e_clnphy). This
call should also return the caret width for this mode.
	\E R0=file offset of physical line start
	   R1=file offset (to convert to a column) R8/R9
	\X R0=column offset on screen (exc margin)
	   R1=caret width

The next 3 subs do the main body of work of converting between screen display
lines and file offsets. A physical line means the actual offset in lines from
the top of the file when displayed. Counting starts at 0. Logical lines can
be interpreted however the mode wishes. In text mode, a logical line is ended
by a return (as opposed to the display wrapping). These are given as offsets
from 0 as the first line. It is important that these routines are OPTIMISED
as much as possible.

e_clnlog
Converts a logical line number to a file offset/physical line. This is not as
important as the other two. It is mainly used by the GOTO window. Ie, user
asks to go to logical line (eg basic line) 500 and zap wants to know the file
offset of this.
	\E R0=logical line number R8/R9
	\X R0=file offset of line start
	   R1=physical line number

e_clnphy
This converts a physical line number to a file offset. This is the most
important of the 3 as it is called when updating a window. For example the
wimp asks zap to redraw a rectangle. The top of the rectangle is at physical
line 100 say. Zap needs to know the file offset of this line to call
e_redrawline. It uses this call. Do NOT start counting from the start of the
file, as the window being updated may be near the end. Instead, use the start
of the w_txt cache as a reference. Ie, use the variables w_cline, w_coff,
w_clogl as your start reference.
	\E R0=physical line number R8/R9
	\X R0=file offset of line start R1=logical line number

e_clnoff
Converts a file offset to a line number and offset. This call is used by
Zap_OffLineCol and when a window is first opened. It should find out which
physical line a file offset lies on. If the file offset is equal to the file
length then it should return the line of an 'imaginary' last character. This
is called when a window is initially opened to work out the w_height value.
As with e_clnphy you should use the cache reference point as a starting
point.
	\E R0=file offset R8/R9
	\X R0=physical line number
	   R1=file offset of physical line start
	   R2=logical line number

e_nextline
This is called during a Zap_DoCommand operation. It is designed to work out
the first line on screen which can be shifted down, following an insertion/
deletion, without being redrawn. On entry you are told the first character
which occurs after the altered region and the amount by which its offset will
change due to the alteration. You must return the file offset of the first
line which may be shifted on the screen without being redrawn. (Usually the
first logical line with start offset > R0). In the case where there is no
such line, return the end of file offset and the physical line containing
this 'imaginary' offset (as for e_clnoff).
	\E R0=file offset of first 'shiftable' character
	   R1=signed change in file offset of this character R8/R9
	\X R0=file offset of first 'shiftable' line
	   R1=physical line number of this line #
	   
e_minus
This is called when the user presses the left arrow key to work out the next
cursor position. The buffering is done for you.
	\E R0=line start file offset
	   R1=cursor file offset
	   R2=cursor column R8/R9
	   R10=cursor caret block
	\X If R2>=0 then R1,R2 given new cursor position on the
	   same physical line.
	   If R2=-1 then R1=new file offset of cursor.
	   If R2=-2 then you have moved the cursor yourself.
	   If R2=-3 then R0,R1=new x,y for cursor.

e_plus		Perform cursor right (\E & \X as for e_minus)
e_sminus	Perform cursor back a word (\E & \X as for e_minus)
e_splus		Perform cursor forward a word (\E & \X as for e_minus)
e_cminus	Move cursor to line start (\E & \X as for e_minus)
e_cplus		Move cursor to line end (\E & \X as for e_minus)

e_redrawline
This is called when your mode is required to redraw one (physical) line of
the display. You are passed the physical line start (calculated via
e_clnphy), and the pointer to an output text buffer of sufficient width to
hold your line (you told zap how wide by e_width). The buffer has be cleared
to spaces. Line numbers have been dealt with. You should fill it with the
ascii chars for this physical line (0-255). You should also update the start
of line offset (e_clnphy is only called for the first line in a group). Note
that R11 will NOT point to your module workspace here. The address passed in
R7 is the actual address of the file character with the buffer splitting
taken into account (see E-File).
	\E R4=w_format
	   R5=apparent buffer start (R7-offset of char in file)
	   R6=address of cache line to draw line in (already blanked)
	   R7=address of start of (source) line
	   R8/R9
	   R10=address of end of this section of the buffer
	   R11=logical line number
	\X R0-R4,R6,R10 may be corrupted
	   R5,R7,R11 must be updated to the start of the next physical line
	�  R8-R9,R12 must be preserved

e_redrawlnum
This is called when the user wishes logical line numbers to be displayed on
the left. You must decide whether the given physical line file offset it at
the start of a logical line. This is called while redrawing the line numbers.
	\E R7=file offset of start of physical line
	   R11=proposed logical line number
	   R8/R9
	\X CC if R7 is at the start of a logical line
	   CS if the line number should be left blank
	   You may corrupt R0-R4

e_char
This is called when the user types a string of ascii chars via the CHAR
command. The characters have been concatenated for you. You should perform
the relevant insertions/deletions via Zap_Command.
	\E R4=w_flags
	   R5=number of bytes typed
	   R6=w_format
	   R7=address of typed data
	   R8-R10=input caret
	\X You may corrupt R0-R11

e_delete
This is called when the user executes the commands DELETE or DELETENEXT. A
sequence of deletes is concatenated for you. You should use Zap_Command to
delete the text. Try and support the line edit mode.
	\E R5=number of times pressed
	   R6=w_format
	   R7=0 for DELETE/1 for DELETENEXT
	   R8-R10=input caret
	\X You may corrupt R0-R11

e_tab
This is called when the user executes the command TAB. As usual, repetitions
are concatenated. Use Zap_Command to perform the function.
	\E R1=number of times pressed
	   R8-R10=input caret
	\X You may corrupt R0-R11

e_return	Called when RETURN executed (\E \X as for e_tab)
e_renumber	Called when RENUMBER executed (\E \X as for e_tab)
e_saveandrun	Called when SAVEANDRUN executed (\E \X as for e_tab)

The next 4 subs are used by the various delete line calls. They each have
	\E R0=current file offset in a line R8/R9
	\X R0=new file offset (see below)
This is how the subs are called:

DELLINE		Deletes from lineprev to linenext offsets.
DELTOEND	Deletes from current offset to lineend unless this is empty
		when it calls JOINLINE (as in emacs ctrl K)
DELTOSTART	Deletes from linestart to current offset unless empty.

e_linestart	Called to find the lines first character.
e_lineend	Called to find the lines last character.
e_linenext	Called to find the lines actual end (eg after &0A)
e_lineprev	Called to find the lines actual start (eg for basic lines)

e_copy
Called when user wishes to copy characters via the COPY key. Is is called for
finding the characters to copy and for inserting the copied characters.
Reason code is in R0. When reading characters you must update the cursor
yourself. Note the source window may be in a different mode to the
destination window!
		\E R0=1 => Fetch characters
		   R1=number of times copy pressed (number of chars to get)
		   R8-R10=copy cursor (car_cursor)
		\X R3=pointer to buffer containing characters to 'type'
		   R2=number of characters to 'type'
		   Copy cursor updated to new position
		OR
		\E R0=2 => Write copied characters
		   R2=number of chars to type
		   R3=pointer to the chars
		   R8-R10=input cursor (car_input)
		\X R0=0 means you've done it all yourself
		   R0=1 means please enter it for me via Zap_Command
		   R0=2 means please enter it for me by calling my e_chars

e_joinline	This is called when Joinline pressed (\E \X as for e_tab)
e_splitline	This is called when Splitline pressed (\E \X as for e_tab)

e_aligncaret
This is called before any commands are executed on a window in your mode.
It serves two purposes. The first is to align the input caret offset to a
sensible position (eg word align in word mode, put after line numbers in
basic). The second is to reset any counters you may have. For example, the
hex mode entry uses a counter to tell how many nibbles have been inserted in
a word. This is cleared on e_aligncaret with the old value being saved. Then
if the command 'insert 9' is executed it can retrieve and restore the saved
value. If any other command is executed (eg LEFT) then the counter will
remain reset.
	\E R8-R10=caret
	\X Input caret offset [R10,#c_off] can be updated.

e_command
This entry point is called whenever anyone issues a Zap_Command call, or
equivalent, to try and alter a file in a window in your mode. The easiest way
to deal with this is to pass the call onto Zap_DoCommand which will perform
the alteration. However, if you support wordwrap, you may wish to 'fiddle'
the data, or even perform additional operations.
	\E As for Zap_Command

e_compile	This is called when Compile pressed	(\E \X as for e_tab)
e_formattext	This is called when Formattext pressed	(\E \X as for e_tab)
e_run		This is called when Run pressed		(\E \X as for e_tab)
e_runandquit	This is called when Runandquit pressed	(\E \X as for e_tab)
e_basic		This is called when Basic pressed	(\E \X as for e_tab)

e_search
This handles string searches in your mode. R1 gives the reason code. It gives
you a chance to 'doctor' the string. Eg, BASIC may tokenise it. It is also
called to check a match is at a valid offset. Eg, BASIC checks it isn't in a
line number.
	\E R1=0 => Starting a search
	   R0=search string after macros replaced (in a heap block).
	\X R0=possibly new search string.
	OR
	\E R1=1 => Found a match
	   R10=match offset
	   R9=file.
	\X Return R0<0 if the offset invalid.

e_replace
This is called when the user wishes to perform a search and replace. The
replacement string has been calculated for you and it is your job to insert
it. Your default action should be to call Zap_ReplaceArea.
	\E R1=file offset (of match)
	   R2=length (of match)
	   R3=replacement data
	   R4=replacement length. R8/R9

e_selection
This handles region selections/saving. You should check the validity of the
selected area, confining it to lines/paragraphs if you wish.
	\E R0=reason code R8/R9=window
	   R0=0 => starting selection
	   	R10=proposed start caret
	   R0=1 => updating selection size
	   	R10=new selection block (car_selection)
	    	You may alter the contents of the selection block.
	   R0=2 => saving selection
	   	R3=data address (a heap block)
	   	R2=data len
           	R4=proposed filetype
	        You may change these provided R3 remains a heap block.
	        (eg BASIC will tokenise it).

e_click
This is called when the user clicks on your window. Default action should be
to call Zap_DefaultClick which will handle R1=0,1 and ignore the rest. Clicks
are registered to any depth.
	\E R1=click depth (0=drag 1=single click 2=double click etc)
	   R2=x column (including margin)
	   R3=y row of click in work area characters
	   R4=buttons (b0=Adjust b2=Select - menus dealt with)
	   R8/R9=window clicked on

e_message
This entry point is called when an unrecognised wimp message is received by
zap. The message is broadcast to all modes. Please IGNORE (ie return) unless
you understand the message number!!
	\E R0=your mode number
	   R1=message block (as sent by wimp)
	   R2=message number (ie R1!16)
	   R3=message type (17 or 19) as returned in R0 by wimp.
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 45  |*********.* >E-E|
00000050  6e 74 72 79 09 44 6f 63  75 6d 65 6e 74 73 20 74  |ntry.Documents t|
00000060  68 65 20 66 6f 72 6d 61  74 20 6f 66 20 61 20 6d  |he format of a m|
00000070  6f 64 65 20 65 6e 74 72  79 20 70 6f 69 6e 74 20  |ode entry point |
00000080  74 61 62 6c 65 09 2a 0a  2a 2a 2a 2a 2a 2a 2a 2a  |table.*.********|
00000090  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000000d0  2a 0a 0a 54 68 65 20 6f  66 66 73 65 74 73 20 69  |*..The offsets i|
000000e0  6e 20 74 68 65 20 65 6e  74 72 79 20 70 6f 69 6e  |n the entry poin|
000000f0  74 20 74 61 62 6c 65 20  61 72 65 20 67 69 76 65  |t table are give|
00000100  6e 20 6e 61 6d 65 73 20  62 65 67 69 6e 6e 69 6e  |n names beginnin|
00000110  67 20 27 65 5f 27 2e 20  54 68 65 0a 45 2d 4c 69  |g 'e_'. The.E-Li|
00000120  62 72 61 72 79 20 70 72  6f 67 72 61 6d 20 77 69  |brary program wi|
00000130  6c 6c 20 64 65 66 69 6e  65 20 74 68 65 20 6f 66  |ll define the of|
00000140  66 73 65 74 73 20 66 6f  72 20 79 6f 75 2e 0a 0a  |fsets for you...|
00000150  59 6f 75 20 6d 75 73 74  20 66 69 6c 6c 20 69 6e  |You must fill in|
00000160  20 74 68 65 20 66 69 72  73 74 20 38 20 65 6e 74  | the first 8 ent|
00000170  72 69 65 73 20 6f 66 20  74 68 69 73 20 74 61 62  |ries of this tab|
00000180  6c 65 2e 20 54 68 65 20  72 65 73 74 20 6f 66 20  |le. The rest of |
00000190  74 68 65 20 65 6e 74 72  69 65 73 0a 79 6f 75 20  |the entries.you |
000001a0  6d 61 79 20 6c 65 61 76  65 20 61 73 20 30 20 28  |may leave as 0 (|
000001b0  6f 72 20 6d 6f 72 65 20  73 69 6d 70 6c 79 2c 20  |or more simply, |
000001c0  73 65 74 20 74 68 65 20  74 61 62 6c 65 20 6c 65  |set the table le|
000001d0  6e 67 74 68 20 69 6e 20  74 68 65 20 38 74 68 20  |ngth in the 8th |
000001e0  77 6f 72 64 20 74 6f 0a  33 32 20 62 79 74 65 73  |word to.32 bytes|
000001f0  29 2e 20 54 68 65 20 69  64 65 61 20 6f 66 20 74  |). The idea of t|
00000200  68 65 20 6d 6f 64 65 20  74 61 62 6c 65 2c 20 69  |he mode table, i|
00000210  73 20 74 68 61 74 20 79  6f 75 20 73 70 65 63 69  |s that you speci|
00000220  66 79 20 61 20 42 41 53  45 20 6d 6f 64 65 2e 20  |fy a BASE mode. |
00000230  46 6f 72 0a 61 6c 6c 20  74 68 65 20 65 6e 74 72  |For.all the entr|
00000240  79 20 70 6f 69 6e 74 73  20 28 66 72 6f 6d 20 74  |y points (from t|
00000250  68 65 20 39 74 68 20 6f  6e 77 61 72 64 73 29 20  |he 9th onwards) |
00000260  74 68 61 74 20 61 72 65  20 6f 66 66 20 74 68 65  |that are off the|
00000270  20 65 6e 64 20 6f 66 20  79 6f 75 72 0a 74 61 62  | end of your.tab|
00000280  6c 65 2c 20 6f 72 20 74  68 61 74 20 79 6f 75 20  |le, or that you |
00000290  68 61 76 65 20 6c 65 66  74 20 61 73 20 30 2c 20  |have left as 0, |
000002a0  74 68 65 20 62 61 73 65  20 6d 6f 64 65 20 77 69  |the base mode wi|
000002b0  6c 6c 20 62 65 20 63 61  6c 6c 65 64 20 69 6e 73  |ll be called ins|
000002c0  74 65 61 64 2e 0a 0a 48  65 6e 63 65 2c 20 74 68  |tead...Hence, th|
000002d0  65 20 73 69 6d 70 6c 65  73 74 20 7a 61 70 20 65  |e simplest zap e|
000002e0  78 74 65 6e 73 69 6f 6e  20 6d 6f 64 65 20 77 6f  |xtension mode wo|
000002f0  75 6c 64 20 6a 75 73 74  20 73 65 74 20 74 68 65  |uld just set the|
00000300  20 62 61 73 65 20 6d 6f  64 65 20 61 73 20 30 20  | base mode as 0 |
00000310  28 69 65 2c 0a 54 45 58  54 29 20 61 6e 64 20 6c  |(ie,.TEXT) and l|
00000320  65 61 76 65 20 74 68 65  20 72 65 73 74 20 61 73  |eave the rest as|
00000330  20 30 2e 20 59 6f 75 20  77 69 6c 6c 20 74 68 65  | 0. You will the|
00000340  6e 20 67 65 74 20 61 20  63 6c 6f 6e 65 20 6f 66  |n get a clone of|
00000350  20 74 68 65 20 74 65 78  74 20 6d 6f 64 65 2e 0a  | the text mode..|
00000360  0a 49 6e 20 67 65 6e 65  72 61 6c 20 74 68 65 20  |.In general the |
00000370  66 6f 6c 6c 6f 77 69 6e  67 20 72 65 67 69 73 74  |following regist|
00000380  65 72 20 63 6f 6e 76 65  6e 74 69 6f 6e 73 20 61  |er conventions a|
00000390  72 65 20 75 73 65 64 3a  0a 0a 09 52 32 09 43 75  |re used:...R2.Cu|
000003a0  72 72 65 6e 74 20 63 6f  6c 75 6d 6e 20 69 6e 20  |rrent column in |
000003b0  63 68 61 72 61 63 74 65  72 73 20 28 73 65 65 20  |characters (see |
000003c0  45 2d 57 69 6e 64 6f 77  73 29 0a 09 52 33 09 43  |E-Windows)..R3.C|
000003d0  75 72 72 65 6e 74 20 6c  69 6e 65 20 69 6e 20 63  |urrent line in c|
000003e0  68 61 72 61 63 74 65 72  73 20 28 73 65 65 20 45  |haracters (see E|
000003f0  2d 57 69 6e 64 6f 77 73  29 0a 09 52 38 09 57 69  |-Windows)..R8.Wi|
00000400  6e 64 6f 77 20 62 6c 6f  63 6b 20 70 6f 69 6e 74  |ndow block point|
00000410  65 72 20 2f 20 30 20 74  6f 20 63 68 61 6e 67 65  |er / 0 to change|
00000420  20 74 68 65 20 64 65 66  61 75 6c 74 20 63 6f 6e  | the default con|
00000430  66 69 67 0a 09 52 39 09  46 69 6c 65 20 62 6c 6f  |fig..R9.File blo|
00000440  63 6b 20 70 6f 69 6e 74  65 72 20 2f 20 30 20 74  |ck pointer / 0 t|
00000450  6f 20 63 68 61 6e 67 65  20 74 68 65 20 64 65 66  |o change the def|
00000460  61 75 6c 74 20 63 6f 6e  66 69 67 0a 09 52 31 30  |ault config..R10|
00000470  09 43 75 72 73 6f 72 20  62 6c 6f 63 6b 20 70 6f  |.Cursor block po|
00000480  69 6e 74 65 72 0a 09 52  31 31 09 59 6f 75 72 20  |inter..R11.Your |
00000490  65 78 74 65 6e 73 69 6f  6e 20 6d 6f 64 65 20 77  |extension mode w|
000004a0  6f 72 6b 73 70 61 63 65  20 28 70 72 69 76 61 74  |orkspace (privat|
000004b0  65 20 77 6f 72 64 29 0a  09 52 31 32 09 5a 61 70  |e word)..R12.Zap|
000004c0  73 20 77 6f 72 6b 73 70  61 63 65 20 28 70 72 69  |s workspace (pri|
000004d0  76 61 74 65 20 77 6f 72  64 29 0a 0a 49 6e 20 67  |vate word)..In g|
000004e0  65 6e 65 72 61 6c 20 74  68 65 20 65 6e 74 72 79  |eneral the entry|
000004f0  20 70 6f 69 6e 74 73 20  68 61 76 65 20 65 6e 74  | points have ent|
00000500  72 79 20 61 6e 64 20 65  78 69 74 20 63 6f 6e 64  |ry and exit cond|
00000510  69 74 69 6f 6e 73 3a 0a  0a 09 5c 45 20 52 30 2d  |itions:...\E R0-|
00000520  52 31 30 3d 70 61 72 61  6d 65 74 65 72 73 20 52  |R10=parameters R|
00000530  31 31 3d 79 6f 75 72 20  77 6f 72 6b 73 70 61 63  |11=your workspac|
00000540  65 20 52 31 33 3d 46 44  20 73 74 61 63 6b 20 52  |e R13=FD stack R|
00000550  31 34 3d 72 65 74 75 72  6e 20 61 64 64 72 0a 09  |14=return addr..|
00000560  5c 58 20 59 6f 75 20 6d  75 73 74 20 73 61 76 65  |\X You must save|
00000570  20 52 31 2d 52 31 31 20  28 75 6e 6c 65 73 73 20  | R1-R11 (unless |
00000580  6f 74 68 65 72 77 69 73  65 20 6d 65 6e 74 69 6f  |otherwise mentio|
00000590  6e 65 64 29 2e 0a 09 20  20 20 59 6f 75 20 6d 61  |ned)...   You ma|
000005a0  79 20 63 6f 72 72 75 70  74 20 52 30 20 61 6e 64  |y corrupt R0 and|
000005b0  20 66 6c 61 67 73 2e 0a  09 20 20 20 53 65 74 20  | flags...   Set |
000005c0  56 20 66 6c 61 67 20 61  6e 64 20 70 75 74 20 52  |V flag and put R|
000005d0  30 3d 65 72 72 6f 72 20  62 6c 6f 63 6b 20 70 6f  |0=error block po|
000005e0  69 6e 74 65 72 20 6f 6e  20 61 6e 20 65 72 72 6f  |inter on an erro|
000005f0  72 2e 0a 0a 53 65 65 20  74 68 65 20 45 2d 5a 61  |r...See the E-Za|
00000600  70 43 61 6c 6c 73 20 66  69 6c 65 20 66 6f 72 20  |pCalls file for |
00000610  6d 6f 72 65 20 64 65 74  61 69 6c 73 20 6f 6e 20  |more details on |
00000620  6d 79 20 65 6e 74 72 79  2f 65 78 69 74 20 73 79  |my entry/exit sy|
00000630  6e 74 61 78 2e 0a 0a 41  6c 6c 20 6f 66 66 73 65  |ntax...All offse|
00000640  74 73 20 67 69 76 65 6e  20 69 6e 20 74 68 65 20  |ts given in the |
00000650  74 61 62 6c 65 20 62 65  6c 6f 77 20 6d 75 73 74  |table below must|
00000660  20 62 65 20 66 72 6f 6d  20 74 68 65 20 73 74 61  | be from the sta|
00000670  72 74 20 6f 66 20 74 68  65 20 6d 6f 64 75 6c 65  |rt of the module|
00000680  2e 0a 48 65 6e 63 65 20  74 68 65 20 74 61 62 6c  |..Hence the tabl|
00000690  65 20 69 73 20 72 65 6c  6f 63 61 74 61 62 6c 65  |e is relocatable|
000006a0  2e 20 5a 61 70 20 66 69  6e 64 73 20 74 68 65 20  |. Zap finds the |
000006b0  73 74 61 72 74 20 61 64  64 72 65 73 73 20 6f 66  |start address of|
000006c0  20 79 6f 75 72 20 6d 6f  64 75 6c 65 0a 76 69 61  | your module.via|
000006d0  20 74 68 65 20 66 69 72  73 74 20 74 61 62 6c 65  | the first table|
000006e0  20 65 6e 74 72 79 20 28  65 5f 6d 6f 64 75 6c 65  | entry (e_module|
000006f0  29 2e 20 49 74 20 75 73  65 73 20 74 68 69 73 20  |). It uses this |
00000700  61 6e 64 20 61 6e 20 4f  53 5f 4d 6f 64 75 6c 65  |and an OS_Module|
00000710  20 63 61 6c 6c 20 74 6f  0a 64 65 74 65 72 6d 69  | call to.determi|
00000720  6e 65 20 74 68 65 20 61  64 64 72 65 73 73 20 6f  |ne the address o|
00000730  66 20 79 6f 75 72 20 77  6f 72 6b 73 70 61 63 65  |f your workspace|
00000740  20 28 74 6f 20 70 61 73  73 20 69 6e 20 52 31 31  | (to pass in R11|
00000750  29 2e 20 41 6c 6c 20 73  74 72 69 6e 67 73 20 73  |). All strings s|
00000760  68 6f 75 6c 64 0a 62 65  20 30 20 74 65 72 6d 69  |hould.be 0 termi|
00000770  6e 61 74 65 64 2e 0a 0a  45 6e 74 72 79 20 70 6f  |nated...Entry po|
00000780  69 6e 74 73 20 66 6f 72  20 61 72 62 69 74 72 61  |ints for arbitra|
00000790  72 79 20 6d 6f 64 65 73  20 6d 61 79 20 62 65 20  |ry modes may be |
000007a0  63 61 6c 6c 65 64 20 75  73 69 6e 67 20 5a 61 70  |called using Zap|
000007b0  5f 43 61 6c 6c 4d 6f 64  65 2c 0a 5a 61 70 5f 43  |_CallMode,.Zap_C|
000007c0  61 6c 6c 47 69 76 65 6e  4d 6f 64 65 20 6f 72 20  |allGivenMode or |
000007d0  5a 61 70 5f 43 61 6c 6c  42 61 73 65 4d 6f 64 65  |Zap_CallBaseMode|
000007e0  2e 20 49 66 20 6e 6f 6e  65 20 6f 66 20 74 68 65  |. If none of the|
000007f0  73 65 20 77 69 6c 6c 20  64 6f 2c 20 74 68 65 6e  |se will do, then|
00000800  20 75 73 65 0a 5a 61 70  5f 52 65 61 64 4d 6f 64  | use.Zap_ReadMod|
00000810  65 20 74 6f 20 66 69 6e  64 20 74 68 65 20 74 61  |e to find the ta|
00000820  62 6c 65 20 65 6e 74 72  79 20 6c 69 6e 6b 65 64  |ble entry linked|
00000830  20 70 6f 69 6e 74 73 20  61 6e 64 20 74 68 65 20  | points and the |
00000840  61 64 64 72 65 73 73 20  6f 66 20 74 68 65 0a 6d  |address of the.m|
00000850  6f 64 65 27 73 20 77 6f  72 6b 73 70 61 63 65 2e  |ode's workspace.|
00000860  0a 0a 54 68 65 20 65 6e  74 72 69 65 73 20 61 72  |..The entries ar|
00000870  65 20 61 73 20 66 6f 6c  6c 6f 77 73 3a 0a 0a 65  |e as follows:..e|
00000880  5f 6d 6f 64 75 6c 65 0a  54 68 69 73 20 67 69 76  |_module.This giv|
00000890  65 73 20 74 68 65 20 74  61 62 6c 65 20 6f 66 66  |es the table off|
000008a0  73 65 74 20 66 72 6f 6d  20 74 68 65 20 6d 6f 64  |set from the mod|
000008b0  75 6c 65 20 73 74 61 72  74 20 73 6f 20 74 68 61  |ule start so tha|
000008c0  74 20 74 68 65 20 6d 6f  64 75 6c 65 20 73 74 61  |t the module sta|
000008d0  72 74 0a 6d 61 79 20 62  65 20 63 61 6c 63 75 6c  |rt.may be calcul|
000008e0  61 74 65 64 20 62 79 20  21 5a 61 70 2e 20 49 65  |ated by !Zap. Ie|
000008f0  2c 20 6d 6f 64 75 6c 65  20 73 74 61 72 74 20 3d  |, module start =|
00000900  20 61 64 64 72 65 73 73  20 6f 66 20 74 61 62 6c  | address of tabl|
00000910  65 20 73 74 61 72 74 20  2d 20 74 68 69 73 0a 6f  |e start - this.o|
00000920  66 66 73 65 74 2e 0a 0a  65 5f 74 69 74 6c 65 0a  |ffset...e_title.|
00000930  4f 66 66 73 65 74 20 6f  66 20 74 68 65 20 6d 6f  |Offset of the mo|
00000940  64 65 20 74 69 74 6c 65  20 73 74 72 69 6e 67 20  |de title string |
00000950  74 6f 20 62 65 20 75 73  65 64 20 69 6e 20 74 68  |to be used in th|
00000960  65 20 27 4d 6f 64 65 27  20 6d 65 6e 75 2e 20 49  |e 'Mode' menu. I|
00000970  74 20 73 68 6f 75 6c 64  20 62 65 0a 61 74 20 6d  |t should be.at m|
00000980  6f 73 74 20 37 20 63 68  61 72 73 20 6c 6f 6e 67  |ost 7 chars long|
00000990  2e 20 28 65 67 20 27 42  41 53 49 43 27 29 0a 0a  |. (eg 'BASIC')..|
000009a0  65 5f 61 75 74 68 6f 72  0a 4f 66 66 73 65 74 20  |e_author.Offset |
000009b0  6f 66 20 74 68 65 20 61  75 74 68 6f 72 20 6e 61  |of the author na|
000009c0  6d 65 20 73 74 72 69 6e  67 20 28 65 67 20 27 44  |me string (eg 'D|
000009d0  6f 6d 69 6e 69 63 20 53  79 6d 65 73 27 29 2e 0a  |ominic Symes')..|
000009e0  0a 65 5f 62 61 73 65 6d  6f 64 65 0a 47 69 76 65  |.e_basemode.Give|
000009f0  73 20 74 68 65 20 6d 6f  64 65 20 6f 6e 20 77 68  |s the mode on wh|
00000a00  69 63 68 20 74 6f 20 62  61 73 65 20 6e 75 6c 6c  |ich to base null|
00000a10  20 65 6e 74 72 79 20 70  6f 69 6e 74 73 2e 20 43  | entry points. C|
00000a20  75 72 72 65 6e 74 20 6d  6f 64 65 73 20 61 72 65  |urrent modes are|
00000a30  3a 20 30 3d 54 65 78 74  0a 31 3d 62 79 74 65 20  |: 0=Text.1=byte |
00000a40  32 3d 77 6f 72 64 20 33  3d 61 73 63 69 69 20 34  |2=word 3=ascii 4|
00000a50  3d 68 65 78 20 35 3d 62  61 73 69 63 20 31 31 3d  |=hex 5=basic 11=|
00000a60  74 68 72 6f 77 62 61 63  6b 20 31 32 3d 74 61 73  |throwback 12=tas|
00000a70  6b 77 69 6e 64 6f 77 2e  20 4e 65 65 64 6c 65 73  |kwindow. Needles|
00000a80  73 20 74 6f 0a 73 61 79  2c 20 69 66 20 79 6f 75  |s to.say, if you|
00000a90  20 77 69 73 68 20 74 6f  20 63 6c 6f 6e 65 20 74  | wish to clone t|
00000aa0  68 65 20 42 41 53 49 43  20 6d 6f 64 65 2c 20 79  |he BASIC mode, y|
00000ab0  6f 75 27 64 20 62 65 74  74 65 72 20 62 65 20 73  |ou'd better be s|
00000ac0  75 72 65 20 74 68 61 74  20 74 68 65 0a 5a 61 70  |ure that the.Zap|
00000ad0  5f 42 61 73 69 63 20 6d  6f 64 75 6c 65 20 69 6e  |_Basic module in|
00000ae0  69 74 69 61 6c 69 73 65  64 20 62 65 66 6f 72 65  |itialised before|
00000af0  20 79 6f 75 72 73 21 0a  0a 65 5f 6d 6f 64 65 0a  | yours!..e_mode.|
00000b00  47 69 76 65 73 20 74 68  65 20 6d 6f 64 65 20 6e  |Gives the mode n|
00000b10  75 6d 62 65 72 20 79 6f  75 20 77 6f 75 6c 64 20  |umber you would |
00000b20  6c 69 6b 65 20 74 6f 20  62 65 20 69 6e 20 62 69  |like to be in bi|
00000b30  74 73 20 62 30 2d 62 37  2e 20 42 69 74 73 20 38  |ts b0-b7. Bits 8|
00000b40  2d 33 31 20 63 6f 6e 74  61 69 6e 0a 66 6c 61 67  |-31 contain.flag|
00000b50  73 20 61 73 20 66 6f 6c  6c 6f 77 73 3a 0a 09 62  |s as follows:..b|
00000b60  38 09 53 65 74 20 74 6f  20 67 65 74 20 72 61 77  |8.Set to get raw|
00000b70  20 6b 65 79 62 6f 61 72  64 20 69 6e 70 75 74 20  | keyboard input |
00000b80  70 61 73 73 65 64 20 74  6f 20 65 5f 63 68 61 72  |passed to e_char|
00000b90  73 20 28 26 30 30 2d 26  46 46 29 2e 0a 09 62 33  |s (&00-&FF)...b3|
00000ba0  31 09 53 65 74 20 74 6f  20 6f 76 65 72 77 72 69  |1.Set to overwri|
00000bb0  74 65 20 61 6e 79 20 6d  6f 64 65 20 61 6c 72 65  |te any mode alre|
00000bc0  61 64 79 20 75 73 69 6e  67 20 74 68 69 73 20 6d  |ady using this m|
00000bd0  6f 64 65 20 6e 75 6d 62  65 72 2e 0a 09 4f 74 68  |ode number...Oth|
00000be0  65 72 73 20 62 69 74 73  20 61 72 65 20 72 65 73  |ers bits are res|
00000bf0  65 72 76 65 64 20 61 6e  64 20 73 68 6f 75 6c 64  |erved and should|
00000c00  20 62 65 20 73 65 74 20  74 6f 20 30 2e 0a 09 49  | be set to 0...I|
00000c10  66 20 62 33 31 20 69 73  20 6e 6f 74 20 73 65 74  |f b31 is not set|
00000c20  20 74 68 65 6e 20 79 6f  75 20 61 72 65 20 61 6c  | then you are al|
00000c30  6c 6f 63 61 74 65 64 20  74 68 65 20 6e 65 78 74  |located the next|
00000c40  20 66 72 65 65 20 6d 6f  64 65 20 69 66 20 74 68  | free mode if th|
00000c50  65 0a 09 6f 6e 65 20 79  6f 75 20 77 61 6e 74 65  |e..one you wante|
00000c60  64 20 69 73 20 62 65 69  6e 67 20 75 73 65 64 2e  |d is being used.|
00000c70  0a 0a 65 5f 69 6e 69 74  0a 43 61 6c 6c 65 64 20  |..e_init.Called |
00000c80  61 74 20 76 61 72 69 6f  75 73 20 70 6f 69 6e 74  |at various point|
00000c90  73 20 77 68 65 6e 20 7a  61 70 20 69 73 20 73 74  |s when zap is st|
00000ca0  61 72 74 69 6e 67 20 75  70 2f 64 79 69 6e 67 2e  |arting up/dying.|
00000cb0  20 4e 6f 74 65 20 74 68  61 74 20 7a 61 70 20 77  | Note that zap w|
00000cc0  69 6c 6c 0a 61 75 74 6f  6d 61 74 69 63 61 6c 6c  |ill.automaticall|
00000cd0  79 20 6b 69 6c 6c 20 79  6f 75 72 20 6d 6f 64 75  |y kill your modu|
00000ce0  6c 65 20 6f 6e 20 64 79  69 6e 67 20 75 6e 6c 65  |le on dying unle|
00000cf0  73 73 20 79 6f 75 20 74  65 6c 6c 20 69 74 20 6f  |ss you tell it o|
00000d00  74 68 65 72 77 69 73 65  2e 20 59 6f 75 0a 73 68  |therwise. You.sh|
00000d10  6f 75 6c 64 20 75 73 65  20 72 65 61 73 6f 6e 20  |ould use reason |
00000d20  63 6f 64 65 20 32 20 74  6f 20 63 6c 61 69 6d 20  |code 2 to claim |
00000d30  61 6e 79 20 62 75 66 66  65 72 73 20 66 72 6f 6d  |any buffers from|
00000d40  20 7a 61 70 2e 0a 20 20  20 20 5c 45 20 52 30 3d  | zap..    \E R0=|
00000d50  6d 6f 64 65 20 61 73 73  69 67 6e 65 64 20 74 6f  |mode assigned to|
00000d60  20 79 6f 75 0a 20 20 20  20 20 20 20 52 31 3d 72  | you.       R1=r|
00000d70  65 61 73 6f 6e 20 63 6f  64 65 0a 20 20 20 20 5c  |eason code.    \|
00000d80  58 20 52 30 3d 72 65 74  75 72 6e 65 64 20 76 61  |X R0=returned va|
00000d90  6c 75 65 0a 09 49 66 20  52 31 3d 30 20 74 68 65  |lue..If R1=0 the|
00000da0  6e 20 7a 61 70 20 69 73  20 71 75 69 74 74 69 6e  |n zap is quittin|
00000db0  67 20 61 6e 64 20 61 62  6f 75 74 20 74 6f 20 6b  |g and about to k|
00000dc0  69 6c 6c 20 79 6f 75 72  20 6d 6f 64 75 6c 65 0a  |ill your module.|
00000dd0  09 20 52 65 74 75 72 6e  20 52 30 3d 2d 31 20 74  |. Return R0=-1 t|
00000de0  6f 20 73 74 6f 70 20 74  68 69 73 20 28 65 67 20  |o stop this (eg |
00000df0  69 66 20 79 6f 75 27 76  65 20 6d 6f 72 65 20 74  |if you've more t|
00000e00  68 61 6e 20 6f 6e 65 20  6d 6f 64 65 29 0a 09 49  |han one mode)..I|
00000e10  66 20 52 31 3d 31 20 74  68 65 6e 20 7a 61 70 20  |f R1=1 then zap |
00000e20  68 61 73 20 6a 75 73 74  20 73 74 61 72 74 65 64  |has just started|
00000e30  20 62 75 74 20 6e 6f 74  20 73 65 74 20 75 70 20  | but not set up |
00000e40  69 74 73 20 68 65 61 70  20 79 65 74 0a 09 49 66  |its heap yet..If|
00000e50  20 52 31 3d 32 20 74 68  65 6e 20 7a 61 70 20 68  | R1=2 then zap h|
00000e60  61 73 20 73 74 61 72 74  65 64 20 61 6e 64 20 73  |as started and s|
00000e70  65 74 20 75 70 20 69 74  73 20 68 65 61 70 2e 20  |et up its heap. |
00000e80  4f 6e 20 74 68 69 73 20  63 61 6c 6c 20 79 6f 75  |On this call you|
00000e90  0a 09 20 73 68 6f 75 6c  64 20 63 68 65 63 6b 20  |.. should check |
00000ea0  79 6f 75 72 20 6d 6f 64  65 20 77 6f 72 64 20 6f  |your mode word o|
00000eb0  70 74 5f 6d 6f 64 65 6e  20 74 6f 20 73 65 65 20  |pt_moden to see |
00000ec0  69 66 20 69 74 27 73 20  7a 65 72 6f 2e 20 49 66  |if it's zero. If|
00000ed0  20 73 6f 0a 09 20 74 68  65 6e 20 79 6f 75 20 73  | so.. then you s|
00000ee0  68 6f 75 6c 64 20 69 6e  69 74 69 61 6c 69 73 65  |hould initialise|
00000ef0  20 69 74 20 74 6f 20 61  20 73 65 6e 73 69 62 6c  | it to a sensibl|
00000f00  65 20 64 65 66 61 75 6c  74 20 76 61 6c 75 65 2e  |e default value.|
00000f10  0a 09 49 66 20 52 31 3d  33 20 74 68 65 6e 20 7a  |..If R1=3 then z|
00000f20  61 70 20 69 73 20 64 65  6c 65 74 69 6e 67 20 61  |ap is deleting a|
00000f30  20 66 69 6c 65 20 77 69  74 68 20 79 6f 75 72 20  | file with your |
00000f40  6d 6f 64 65 20 6e 75 6d  62 65 72 0a 09 20 69 6e  |mode number.. in|
00000f50  20 66 5f 63 6d 6f 64 65  2e 20 52 39 3d 66 69 6c  | f_cmode. R9=fil|
00000f60  65 20 62 6c 6f 63 6b 2e  20 49 65 2c 20 79 6f 75  |e block. Ie, you|
00000f70  20 61 72 65 20 74 6f 6c  64 20 77 68 65 6e 20 5a  | are told when Z|
00000f80  61 70 20 69 73 20 61 62  6f 75 74 20 74 6f 0a 09  |ap is about to..|
00000f90  20 64 65 6c 65 74 65 20  61 20 66 69 6c 65 20 74  | delete a file t|
00000fa0  68 61 74 20 79 6f 75 20  6f 77 6e 2e 20 53 65 65  |hat you own. See|
00000fb0  20 45 2d 46 69 6c 65 2e  0a 0a 65 5f 6d 65 6e 75  | E-File...e_menu|
00000fc0  0a 4f 66 66 73 65 74 20  6f 66 20 73 75 62 6d 65  |.Offset of subme|
00000fd0  6e 75 20 69 6e 20 7a 61  70 73 20 66 6f 72 6d 61  |nu in zaps forma|
00000fe0  74 20 2f 20 30 20 66 6f  72 20 6e 6f 6e 65 2e 20  |t / 0 for none. |
00000ff0  54 68 69 73 20 6d 65 6e  75 20 63 6f 6d 65 73 20  |This menu comes |
00001000  6f 66 66 20 74 68 65 0a  27 4d 6f 64 65 27 20 6d  |off the.'Mode' m|
00001010  65 6e 75 2e 20 53 65 65  20 74 68 65 20 66 69 6c  |enu. See the fil|
00001020  65 20 45 2d 4d 65 6e 75  20 66 6f 72 20 64 65 74  |e E-Menu for det|
00001030  61 69 6c 73 20 6f 66 20  74 68 65 20 6d 65 6e 75  |ails of the menu|
00001040  20 66 6f 72 6d 61 74 2e  0a 0a 65 5f 6c 65 6e 0a  | format...e_len.|
00001050  54 6f 74 61 6c 20 6c 65  6e 67 74 68 20 6f 66 20  |Total length of |
00001060  74 68 65 20 74 61 62 6c  65 20 64 61 74 61 20 28  |the table data (|
00001070  3e 3d 33 32 29 2e 20 28  53 6f 20 74 68 61 74 20  |>=32). (So that |
00001080  6f 6e 6c 79 20 65 6e 74  72 79 20 70 6f 69 6e 74  |only entry point|
00001090  73 20 77 69 74 68 69 6e  20 74 68 65 0a 74 61 62  |s within the.tab|
000010a0  6c 65 20 61 72 65 20 63  61 6c 6c 65 64 20 61 6e  |le are called an|
000010b0  64 20 66 6f 72 20 66 6f  72 77 61 72 64 20 63 6f  |d for forward co|
000010c0  6d 70 61 74 69 62 69 6c  69 74 79 29 2e 20 49 66  |mpatibility). If|
000010d0  20 7a 61 70 20 66 69 6e  64 73 20 61 6e 20 65 6e  | zap finds an en|
000010e0  74 72 79 20 70 6f 69 6e  74 0a 69 73 20 6f 66 66  |try point.is off|
000010f0  20 74 68 65 20 65 6e 64  20 6f 66 20 74 68 65 20  | the end of the |
00001100  74 61 62 6c 65 20 74 68  65 6e 20 69 74 20 77 69  |table then it wi|
00001110  6c 6c 20 63 61 6c 6c 20  74 68 65 20 63 6f 72 72  |ll call the corr|
00001120  65 73 70 6f 6e 64 69 6e  67 20 62 61 73 65 20 6d  |esponding base m|
00001130  6f 64 65 0a 65 6e 74 72  79 20 70 6f 69 6e 74 2e  |ode.entry point.|
00001140  0a 0a 49 66 20 61 6e 79  20 6f 66 20 74 68 65 20  |..If any of the |
00001150  66 6f 6c 6c 6f 77 69 6e  67 20 6f 66 66 73 65 74  |following offset|
00001160  73 20 61 72 65 20 30 20  74 68 65 6e 20 74 68 65  |s are 0 then the|
00001170  20 63 6f 72 72 65 73 70  6f 6e 64 69 6e 67 20 6f  | corresponding o|
00001180  66 66 73 65 74 20 66 6f  72 20 74 68 65 0a 62 61  |ffset for the.ba|
00001190  73 65 6d 6f 64 65 20 69  73 20 63 61 6c 6c 65 64  |semode is called|
000011a0  2e 0a 0a 65 5f 70 6f 73  74 6c 6f 61 64 0a 43 61  |...e_postload.Ca|
000011b0  6c 6c 65 64 20 61 66 74  65 72 20 61 20 66 69 6c  |lled after a fil|
000011c0  65 20 69 73 20 6c 6f 61  64 65 64 20 61 6e 64 20  |e is loaded and |
000011d0  68 61 73 20 68 61 64 20  61 20 77 69 6e 64 6f 77  |has had a window|
000011e0  20 6f 70 65 6e 65 64 20  66 6f 72 20 69 74 20 69  | opened for it i|
000011f0  6e 20 79 6f 75 72 0a 6d  6f 64 65 2e 20 49 74 20  |n your.mode. It |
00001200  69 73 20 61 6c 73 6f 20  63 61 6c 6c 65 64 20 61  |is also called a|
00001210  66 74 65 72 20 61 20 66  69 6c 65 20 69 6e 20 79  |fter a file in y|
00001220  6f 75 72 20 6d 6f 64 65  20 68 61 73 20 62 65 65  |our mode has bee|
00001230  6e 20 73 61 76 65 64 2e  20 49 74 20 65 6e 61 62  |n saved. It enab|
00001240  6c 65 73 0a 74 68 65 20  66 69 6c 65 20 63 6f 6e  |les.the file con|
00001250  74 65 6e 74 73 20 74 6f  20 62 65 20 73 6c 69 67  |tents to be slig|
00001260  68 74 6c 79 20 61 6c 74  65 72 65 64 20 62 65 66  |htly altered bef|
00001270  6f 72 65 20 65 64 69 74  69 6e 67 2e 20 28 65 67  |ore editing. (eg|
00001280  20 42 41 53 49 43 20 65  6e 63 72 79 70 74 73 0a  | BASIC encrypts.|
00001290  74 68 65 20 6c 69 6e 65  20 6e 75 6d 62 65 72 73  |the line numbers|
000012a0  20 61 6e 64 20 42 41 53  54 58 54 20 64 65 74 6f  | and BASTXT deto|
000012b0  6b 65 6e 69 73 65 73 20  74 68 65 20 70 72 6f 67  |kenises the prog|
000012c0  72 61 6d 29 2e 0a 09 5c  45 20 52 38 2f 52 39 0a  |ram)...\E R8/R9.|
000012d0  09 0a 65 5f 70 72 65 73  61 76 65 0a 43 61 6c 6c  |..e_presave.Call|
000012e0  65 64 20 62 65 66 6f 72  65 20 74 68 65 20 66 69  |ed before the fi|
000012f0  6c 65 20 69 73 20 73 61  76 65 64 2e 20 49 74 20  |le is saved. It |
00001300  65 6e 61 62 6c 65 73 20  66 69 6c 65 20 63 6f 6e  |enables file con|
00001310  74 65 6e 74 73 20 74 6f  20 62 65 20 73 6c 69 67  |tents to be slig|
00001320  68 74 6c 79 0a 61 6c 74  65 72 65 64 2c 20 75 6e  |htly.altered, un|
00001330  64 6f 69 6e 67 20 74 68  65 20 65 66 66 65 63 74  |doing the effect|
00001340  20 6f 66 20 65 5f 70 6f  73 74 6c 6f 61 64 2e 20  | of e_postload. |
00001350  28 65 67 20 42 41 53 54  58 54 20 72 65 74 6f 6b  |(eg BASTXT retok|
00001360  65 6e 69 73 65 73 20 74  68 65 20 70 72 6f 67 72  |enises the progr|
00001370  61 6d 0a 70 72 69 6f 72  20 74 6f 20 73 61 76 69  |am.prior to savi|
00001380  6e 67 29 2e 0a 09 5c 45  20 52 38 2f 52 39 0a 0a  |ng)...\E R8/R9..|
00001390  65 5f 6c 6f 61 64 69 6e  67 0a 54 68 69 73 20 69  |e_loading.This i|
000013a0  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 61 20  |s called when a |
000013b0  66 69 6c 65 20 69 73 20  6c 6f 61 64 65 64 20 6f  |file is loaded o|
000013c0  66 66 20 64 69 73 63 20  66 6f 72 20 64 72 6f 70  |ff disc for drop|
000013d0  70 69 6e 67 20 69 6e 74  6f 20 61 20 77 69 6e 64  |ping into a wind|
000013e0  6f 77 2e 20 54 68 65 0a  66 69 6c 65 20 64 61 74  |ow. The.file dat|
000013f0  61 20 69 73 20 69 6e 20  61 20 68 65 61 70 20 62  |a is in a heap b|
00001400  6c 6f 63 6b 2e 20 54 68  69 73 20 65 6e 61 62 6c  |lock. This enabl|
00001410  65 73 20 79 6f 75 20 74  6f 20 63 68 61 6e 67 65  |es you to change|
00001420  20 69 74 20 62 65 66 6f  72 65 20 69 6e 73 65 72  | it before inser|
00001430  74 69 6f 6e 0a 74 61 6b  65 73 20 70 6c 61 63 65  |tion.takes place|
00001440  20 28 65 67 20 42 41 53  54 58 54 20 64 65 74 6f  | (eg BASTXT deto|
00001450  6b 65 6e 69 73 65 73 20  74 68 65 20 66 69 6c 65  |kenises the file|
00001460  29 2e 20 59 6f 75 20 61  72 65 20 6f 6e 6c 79 20  |). You are only |
00001470  63 61 6c 6c 65 64 20 69  66 20 74 68 65 20 66 69  |called if the fi|
00001480  6c 65 0a 74 79 70 65 20  6f 66 20 74 68 65 20 66  |le.type of the f|
00001490  69 6c 65 20 69 73 20 63  6c 61 69 6d 65 64 20 62  |ile is claimed b|
000014a0  79 20 79 6f 75 72 20 6d  6f 64 65 20 28 69 6e 20  |y your mode (in |
000014b0  74 68 65 20 27 6b 65 79  73 27 20 66 69 6c 65 29  |the 'keys' file)|
000014c0  2e 0a 09 5c 45 20 52 32  3d 64 61 74 61 20 6c 65  |...\E R2=data le|
000014d0  6e 67 74 68 20 52 33 3d  64 61 74 61 20 61 64 64  |ngth R3=data add|
000014e0  72 65 73 73 0a 09 5c 58  20 59 6f 75 20 6d 61 79  |ress..\X You may|
000014f0  20 63 68 61 6e 67 65 20  74 68 65 20 64 61 74 61  | change the data|
00001500  2c 20 6d 61 6b 69 6e 67  20 69 74 20 6c 61 72 67  |, making it larg|
00001510  65 72 20 69 66 20 6e 65  63 65 73 73 61 72 79 0a  |er if necessary.|
00001520  09 20 20 20 70 72 6f 76  69 64 65 64 20 74 68 61  |.   provided tha|
00001530  74 20 79 6f 75 20 65 6e  6c 61 72 67 65 20 74 68  |t you enlarge th|
00001540  65 20 68 65 61 70 20 62  6c 6f 63 6b 20 52 33 2e  |e heap block R3.|
00001550  20 52 65 74 75 72 6e 0a  09 20 20 20 75 70 64 61  | Return..   upda|
00001560  74 65 64 20 52 32 20 61  6e 64 20 52 33 2e 0a 0a  |ted R2 and R3...|
00001570  65 5f 73 74 61 72 74 0a  43 61 6c 6c 65 64 20 77  |e_start.Called w|
00001580  68 65 6e 20 61 20 77 69  6e 64 6f 77 20 65 6e 74  |hen a window ent|
00001590  65 72 73 20 79 6f 75 72  20 6d 6f 64 65 20 28 65  |ers your mode (e|
000015a0  67 20 76 69 61 20 5a 61  70 5f 4e 65 77 4d 6f 64  |g via Zap_NewMod|
000015b0  65 29 2e 20 59 6f 75 20  73 68 6f 75 6c 64 0a 72  |e). You should.r|
000015c0  65 73 74 6f 72 65 20 74  68 65 20 77 5f 66 6c 61  |estore the w_fla|
000015d0  67 73 20 61 6e 64 20 77  5f 66 6f 72 6d 61 74 20  |gs and w_format |
000015e0  6f 70 74 69 6f 6e 73 20  66 72 6f 6d 20 79 6f 75  |options from you|
000015f0  72 20 61 6c 6c 6f 63 61  74 65 64 20 6d 6f 64 65  |r allocated mode|
00001600  20 77 6f 72 64 0a 77 5f  6d 6f 64 65 6e 2e 20 53  | word.w_moden. S|
00001610  65 65 20 45 2d 46 6c 61  67 73 2e 20 49 66 20 52  |ee E-Flags. If R|
00001620  38 3d 30 20 6f 6e 20 65  6e 74 72 79 20 74 68 65  |8=0 on entry the|
00001630  6e 20 79 6f 75 20 73 68  6f 75 6c 64 20 72 65 73  |n you should res|
00001640  74 6f 72 65 20 74 68 65  20 64 65 66 61 75 6c 74  |tore the default|
00001650  0a 6f 70 74 5f 66 6c 61  67 73 20 61 6e 64 20 6f  |.opt_flags and o|
00001660  70 74 5f 66 6f 72 6d 61  74 20 76 61 6c 75 65 20  |pt_format value |
00001670  66 72 6f 6d 20 6f 70 74  5f 6d 6f 64 65 6e 20 61  |from opt_moden a|
00001680  73 20 74 68 65 20 75 73  65 72 20 68 61 73 20 73  |s the user has s|
00001690  77 69 74 63 68 65 64 20  74 6f 0a 79 6f 75 72 20  |witched to.your |
000016a0  6d 6f 64 65 20 6f 6e 20  74 68 65 20 69 63 6f 6e  |mode on the icon|
000016b0  62 61 72 20 6d 65 6e 75  2e 0a 09 5c 45 20 52 38  |bar menu...\E R8|
000016c0  2f 52 39 3d 77 69 6e 64  6f 77 20 2f 20 30 20 66  |/R9=window / 0 f|
000016d0  6f 72 20 6f 70 74 69 6f  6e 73 20 6d 65 6e 75 0a  |or options menu.|
000016e0  0a 65 5f 65 6e 64 0a 43  61 6c 6c 65 64 20 77 68  |.e_end.Called wh|
000016f0  65 6e 20 61 20 77 69 6e  64 6f 77 20 6c 65 61 76  |en a window leav|
00001700  65 73 20 79 6f 75 72 20  6d 6f 64 65 20 28 65 67  |es your mode (eg|
00001710  20 76 69 61 20 5a 61 70  5f 4e 65 77 4d 6f 64 65  | via Zap_NewMode|
00001720  29 2e 20 54 68 69 73 20  69 73 20 73 69 6d 69 6c  |). This is simil|
00001730  61 72 0a 74 6f 20 65 5f  73 74 61 72 74 20 65 78  |ar.to e_start ex|
00001740  63 65 70 74 20 74 68 61  74 20 79 6f 75 20 73 68  |cept that you sh|
00001750  6f 75 6c 64 20 73 61 76  65 20 74 68 65 20 63 75  |ould save the cu|
00001760  72 72 65 6e 74 20 76 61  6c 75 65 73 20 69 6e 20  |rrent values in |
00001770  77 5f 66 6f 72 6d 61 74  2c 0a 77 5f 66 6c 61 67  |w_format,.w_flag|
00001780  73 20 69 6e 20 79 6f 75  20 6d 6f 64 65 20 77 6f  |s in you mode wo|
00001790  72 64 2e 20 41 67 61 69  6e 20 69 66 20 52 38 3d  |rd. Again if R8=|
000017a0  30 20 74 68 65 6e 20 79  6f 75 20 73 68 6f 75 6c  |0 then you shoul|
000017b0  64 20 73 61 76 65 20 74  68 65 20 76 61 6c 75 65  |d save the value|
000017c0  73 20 6f 66 0a 6f 70 74  5f 66 6c 61 67 73 2c 20  |s of.opt_flags, |
000017d0  6f 70 74 5f 66 6f 72 6d  61 74 20 69 6e 20 79 6f  |opt_format in yo|
000017e0  75 72 20 6f 70 74 69 6f  6e 73 20 6d 6f 64 65 20  |ur options mode |
000017f0  77 6f 72 64 20 28 73 65  65 20 45 2d 56 61 72 73  |word (see E-Vars|
00001800  29 2e 0a 09 5c 45 20 52  38 2f 52 39 3d 77 69 6e  |)...\E R8/R9=win|
00001810  64 6f 77 20 2f 20 30 20  66 6f 72 20 69 63 6f 6e  |dow / 0 for icon|
00001820  62 61 72 20 6d 65 6e 75  0a 0a 65 5f 77 69 64 74  |bar menu..e_widt|
00001830  68 0a 43 61 6c 6c 65 64  20 77 68 65 6e 20 61 20  |h.Called when a |
00001840  77 69 6e 64 6f 77 20 69  73 20 28 72 65 29 63 72  |window is (re)cr|
00001850  65 61 74 65 64 20 74 6f  20 66 69 6e 64 20 6f 75  |eated to find ou|
00001860  74 20 74 68 65 20 77 69  64 74 68 20 6f 66 20 74  |t the width of t|
00001870  68 65 20 77 6f 72 6b 20  61 72 65 61 20 69 6e 0a  |he work area in.|
00001880  63 68 61 72 61 63 74 65  72 73 20 28 65 78 63 6c  |characters (excl|
00001890  75 64 69 6e 67 20 6d 61  72 67 69 6e 29 2e 20 59  |uding margin). Y|
000018a0  6f 75 20 73 68 6f 75 6c  64 20 72 65 61 64 20 74  |ou should read t|
000018b0  68 69 73 20 66 72 6f 6d  20 74 68 65 20 6d 6f 64  |his from the mod|
000018c0  65 20 77 6f 72 64 20 66  6f 72 0a 79 6f 75 72 20  |e word for.your |
000018d0  77 69 6e 64 6f 77 2e 20  49 66 20 79 6f 75 20 73  |window. If you s|
000018e0  75 70 70 6f 72 74 20 61  75 74 6f 20 77 69 64 74  |upport auto widt|
000018f0  68 20 61 6e 64 20 74 68  65 20 61 75 74 6f 20 77  |h and the auto w|
00001900  69 64 74 68 20 66 6c 61  67 20 69 73 20 73 65 74  |idth flag is set|
00001910  20 28 73 65 65 0a 45 2d  46 6c 61 67 73 29 20 74  | (see.E-Flags) t|
00001920  68 65 6e 20 79 6f 75 20  73 68 6f 75 6c 64 20 77  |hen you should w|
00001930  6f 72 6b 20 74 68 69 73  20 77 69 64 74 68 20 6f  |ork this width o|
00001940  75 74 20 66 72 6f 6d 20  74 68 65 20 66 69 6c 65  |ut from the file|
00001950  2e 20 4f 6e 63 65 20 79  6f 75 20 68 61 76 65 0a  |. Once you have.|
00001960  63 61 6c 63 75 6c 61 74  65 64 20 74 68 65 20 77  |calculated the w|
00001970  69 64 74 68 2c 20 69 74  20 69 73 20 61 64 76 69  |idth, it is advi|
00001980  73 61 62 6c 65 20 74 6f  20 73 74 6f 72 65 20 69  |sable to store i|
00001990  74 20 69 6e 20 77 5f 62  70 6c 2c 20 61 20 76 61  |t in w_bpl, a va|
000019a0  72 69 61 62 6c 65 0a 72  65 73 65 72 76 65 64 20  |riable.reserved |
000019b0  66 6f 72 20 74 68 69 73  20 70 75 72 70 6f 73 65  |for this purpose|
000019c0  2e 0a 09 5c 45 20 52 38  2f 52 39 0a 09 5c 58 20  |...\E R8/R9..\X |
000019d0  52 30 3d 77 69 64 74 68  20 6f 66 20 77 6f 72 6b  |R0=width of work|
000019e0  20 61 72 65 61 20 69 6e  20 63 68 61 72 61 63 74  | area in charact|
000019f0  65 72 73 20 28 65 78 63  6c 75 64 69 6e 67 20 6d  |ers (excluding m|
00001a00  61 72 67 69 6e 29 0a 0a  65 5f 6c 69 6e 65 63 6f  |argin)..e_lineco|
00001a10  6c 0a 43 6f 6e 76 65 72  74 73 20 61 20 63 6f 6c  |l.Converts a col|
00001a20  75 6d 6e 20 6f 66 66 73  65 74 20 6f 6e 20 73 63  |umn offset on sc|
00001a30  72 65 65 6e 20 74 6f 20  66 69 6c 65 20 6f 66 66  |reen to file off|
00001a40  73 65 74 2e 20 54 68 69  73 20 69 73 20 63 61 6c  |set. This is cal|
00001a50  6c 65 64 20 62 79 0a 5a  61 70 5f 46 69 6e 64 4f  |led by.Zap_FindO|
00001a60  66 66 73 65 74 20 61 6e  64 20 6f 74 68 65 72 20  |ffset and other |
00001a70  73 75 62 73 2e 20 54 68  65 20 73 74 61 72 74 20  |subs. The start |
00001a80  6f 66 66 73 65 74 20 6f  66 20 74 68 65 20 70 68  |offset of the ph|
00001a90  79 73 69 63 61 6c 20 6c  69 6e 65 20 6f 6e 20 77  |ysical line on w|
00001aa0  68 69 63 68 0a 74 68 65  20 63 6f 6c 75 6d 6e 20  |hich.the column |
00001ab0  6c 69 65 73 20 68 61 73  20 62 65 65 6e 20 63 61  |lies has been ca|
00001ac0  6c 63 75 6c 61 74 65 64  20 28 75 73 75 61 6c 6c  |lculated (usuall|
00001ad0  79 20 62 79 20 65 5f 63  6c 6e 6f 66 66 29 2e 0a  |y by e_clnoff)..|
00001ae0  09 5c 45 20 52 30 3d 66  69 6c 65 20 6f 66 66 73  |.\E R0=file offs|
00001af0  65 74 20 6f 66 20 70 68  79 73 69 63 61 6c 20 6c  |et of physical l|
00001b00  69 6e 65 20 73 74 61 72  74 0a 09 20 20 20 52 31  |ine start..   R1|
00001b10  3d 63 6f 6c 75 6d 6e 20  6f 66 66 73 65 74 20 6f  |=column offset o|
00001b20  6e 20 73 63 72 65 65 6e  20 28 65 78 63 20 6d 61  |n screen (exc ma|
00001b30  72 67 69 6e 29 20 52 38  2f 52 39 0a 09 5c 58 20  |rgin) R8/R9..\X |
00001b40  52 30 3d 66 69 6c 65 20  6f 66 66 73 65 74 20 6f  |R0=file offset o|
00001b50  66 20 6e 65 61 72 65 73  74 20 63 68 61 72 61 63  |f nearest charac|
00001b60  74 65 72 20 6f 6e 20 74  68 65 20 6c 65 66 74 0a  |ter on the left.|
00001b70  09 09 0a 65 5f 6c 69 6e  65 6f 66 66 0a 43 6f 6e  |...e_lineoff.Con|
00001b80  76 65 72 74 20 66 69 6c  65 20 6f 66 66 73 65 74  |vert file offset|
00001b90  20 74 6f 20 63 6f 6c 75  6d 6e 20 6f 6e 20 73 63  | to column on sc|
00001ba0  72 65 65 6e 2e 20 54 68  69 73 20 70 65 72 66 6f  |reen. This perfo|
00001bb0  72 6d 73 20 74 68 65 20  69 6e 76 65 72 73 65 20  |rms the inverse |
00001bc0  66 75 6e 63 74 69 6f 6e  0a 74 6f 20 65 5f 6c 69  |function.to e_li|
00001bd0  6e 65 63 6f 6c 2e 20 49  74 20 69 73 20 75 73 75  |necol. It is usu|
00001be0  61 6c 6c 79 20 63 61 6c  6c 65 64 20 62 79 20 5a  |ally called by Z|
00001bf0  61 70 5f 4f 66 66 4c 69  6e 65 43 6f 6c 2e 20 41  |ap_OffLineCol. A|
00001c00  67 61 69 6e 20 74 68 65  20 6f 66 66 73 65 74 20  |gain the offset |
00001c10  6f 66 20 74 68 65 0a 73  74 61 72 74 20 6f 66 20  |of the.start of |
00001c20  74 68 65 20 70 68 79 73  69 63 61 6c 20 6c 69 6e  |the physical lin|
00001c30  65 20 68 61 73 20 62 65  65 6e 20 63 61 6c 63 75  |e has been calcu|
00001c40  6c 61 74 65 64 20 28 75  73 75 61 6c 6c 79 20 62  |lated (usually b|
00001c50  79 20 65 5f 63 6c 6e 70  68 79 29 2e 20 54 68 69  |y e_clnphy). Thi|
00001c60  73 0a 63 61 6c 6c 20 73  68 6f 75 6c 64 20 61 6c  |s.call should al|
00001c70  73 6f 20 72 65 74 75 72  6e 20 74 68 65 20 63 61  |so return the ca|
00001c80  72 65 74 20 77 69 64 74  68 20 66 6f 72 20 74 68  |ret width for th|
00001c90  69 73 20 6d 6f 64 65 2e  0a 09 5c 45 20 52 30 3d  |is mode...\E R0=|
00001ca0  66 69 6c 65 20 6f 66 66  73 65 74 20 6f 66 20 70  |file offset of p|
00001cb0  68 79 73 69 63 61 6c 20  6c 69 6e 65 20 73 74 61  |hysical line sta|
00001cc0  72 74 0a 09 20 20 20 52  31 3d 66 69 6c 65 20 6f  |rt..   R1=file o|
00001cd0  66 66 73 65 74 20 28 74  6f 20 63 6f 6e 76 65 72  |ffset (to conver|
00001ce0  74 20 74 6f 20 61 20 63  6f 6c 75 6d 6e 29 20 52  |t to a column) R|
00001cf0  38 2f 52 39 0a 09 5c 58  20 52 30 3d 63 6f 6c 75  |8/R9..\X R0=colu|
00001d00  6d 6e 20 6f 66 66 73 65  74 20 6f 6e 20 73 63 72  |mn offset on scr|
00001d10  65 65 6e 20 28 65 78 63  20 6d 61 72 67 69 6e 29  |een (exc margin)|
00001d20  0a 09 20 20 20 52 31 3d  63 61 72 65 74 20 77 69  |..   R1=caret wi|
00001d30  64 74 68 0a 0a 54 68 65  20 6e 65 78 74 20 33 20  |dth..The next 3 |
00001d40  73 75 62 73 20 64 6f 20  74 68 65 20 6d 61 69 6e  |subs do the main|
00001d50  20 62 6f 64 79 20 6f 66  20 77 6f 72 6b 20 6f 66  | body of work of|
00001d60  20 63 6f 6e 76 65 72 74  69 6e 67 20 62 65 74 77  | converting betw|
00001d70  65 65 6e 20 73 63 72 65  65 6e 20 64 69 73 70 6c  |een screen displ|
00001d80  61 79 0a 6c 69 6e 65 73  20 61 6e 64 20 66 69 6c  |ay.lines and fil|
00001d90  65 20 6f 66 66 73 65 74  73 2e 20 41 20 70 68 79  |e offsets. A phy|
00001da0  73 69 63 61 6c 20 6c 69  6e 65 20 6d 65 61 6e 73  |sical line means|
00001db0  20 74 68 65 20 61 63 74  75 61 6c 20 6f 66 66 73  | the actual offs|
00001dc0  65 74 20 69 6e 20 6c 69  6e 65 73 20 66 72 6f 6d  |et in lines from|
00001dd0  0a 74 68 65 20 74 6f 70  20 6f 66 20 74 68 65 20  |.the top of the |
00001de0  66 69 6c 65 20 77 68 65  6e 20 64 69 73 70 6c 61  |file when displa|
00001df0  79 65 64 2e 20 43 6f 75  6e 74 69 6e 67 20 73 74  |yed. Counting st|
00001e00  61 72 74 73 20 61 74 20  30 2e 20 4c 6f 67 69 63  |arts at 0. Logic|
00001e10  61 6c 20 6c 69 6e 65 73  20 63 61 6e 0a 62 65 20  |al lines can.be |
00001e20  69 6e 74 65 72 70 72 65  74 65 64 20 68 6f 77 65  |interpreted howe|
00001e30  76 65 72 20 74 68 65 20  6d 6f 64 65 20 77 69 73  |ver the mode wis|
00001e40  68 65 73 2e 20 49 6e 20  74 65 78 74 20 6d 6f 64  |hes. In text mod|
00001e50  65 2c 20 61 20 6c 6f 67  69 63 61 6c 20 6c 69 6e  |e, a logical lin|
00001e60  65 20 69 73 20 65 6e 64  65 64 0a 62 79 20 61 20  |e is ended.by a |
00001e70  72 65 74 75 72 6e 20 28  61 73 20 6f 70 70 6f 73  |return (as oppos|
00001e80  65 64 20 74 6f 20 74 68  65 20 64 69 73 70 6c 61  |ed to the displa|
00001e90  79 20 77 72 61 70 70 69  6e 67 29 2e 20 54 68 65  |y wrapping). The|
00001ea0  73 65 20 61 72 65 20 67  69 76 65 6e 20 61 73 20  |se are given as |
00001eb0  6f 66 66 73 65 74 73 0a  66 72 6f 6d 20 30 20 61  |offsets.from 0 a|
00001ec0  73 20 74 68 65 20 66 69  72 73 74 20 6c 69 6e 65  |s the first line|
00001ed0  2e 20 49 74 20 69 73 20  69 6d 70 6f 72 74 61 6e  |. It is importan|
00001ee0  74 20 74 68 61 74 20 74  68 65 73 65 20 72 6f 75  |t that these rou|
00001ef0  74 69 6e 65 73 20 61 72  65 20 4f 50 54 49 4d 49  |tines are OPTIMI|
00001f00  53 45 44 0a 61 73 20 6d  75 63 68 20 61 73 20 70  |SED.as much as p|
00001f10  6f 73 73 69 62 6c 65 2e  0a 0a 65 5f 63 6c 6e 6c  |ossible...e_clnl|
00001f20  6f 67 0a 43 6f 6e 76 65  72 74 73 20 61 20 6c 6f  |og.Converts a lo|
00001f30  67 69 63 61 6c 20 6c 69  6e 65 20 6e 75 6d 62 65  |gical line numbe|
00001f40  72 20 74 6f 20 61 20 66  69 6c 65 20 6f 66 66 73  |r to a file offs|
00001f50  65 74 2f 70 68 79 73 69  63 61 6c 20 6c 69 6e 65  |et/physical line|
00001f60  2e 20 54 68 69 73 20 69  73 20 6e 6f 74 20 61 73  |. This is not as|
00001f70  0a 69 6d 70 6f 72 74 61  6e 74 20 61 73 20 74 68  |.important as th|
00001f80  65 20 6f 74 68 65 72 20  74 77 6f 2e 20 49 74 20  |e other two. It |
00001f90  69 73 20 6d 61 69 6e 6c  79 20 75 73 65 64 20 62  |is mainly used b|
00001fa0  79 20 74 68 65 20 47 4f  54 4f 20 77 69 6e 64 6f  |y the GOTO windo|
00001fb0  77 2e 20 49 65 2c 20 75  73 65 72 0a 61 73 6b 73  |w. Ie, user.asks|
00001fc0  20 74 6f 20 67 6f 20 74  6f 20 6c 6f 67 69 63 61  | to go to logica|
00001fd0  6c 20 6c 69 6e 65 20 28  65 67 20 62 61 73 69 63  |l line (eg basic|
00001fe0  20 6c 69 6e 65 29 20 35  30 30 20 61 6e 64 20 7a  | line) 500 and z|
00001ff0  61 70 20 77 61 6e 74 73  20 74 6f 20 6b 6e 6f 77  |ap wants to know|
00002000  20 74 68 65 20 66 69 6c  65 0a 6f 66 66 73 65 74  | the file.offset|
00002010  20 6f 66 20 74 68 69 73  2e 0a 09 5c 45 20 52 30  | of this...\E R0|
00002020  3d 6c 6f 67 69 63 61 6c  20 6c 69 6e 65 20 6e 75  |=logical line nu|
00002030  6d 62 65 72 20 52 38 2f  52 39 0a 09 5c 58 20 52  |mber R8/R9..\X R|
00002040  30 3d 66 69 6c 65 20 6f  66 66 73 65 74 20 6f 66  |0=file offset of|
00002050  20 6c 69 6e 65 20 73 74  61 72 74 0a 09 20 20 20  | line start..   |
00002060  52 31 3d 70 68 79 73 69  63 61 6c 20 6c 69 6e 65  |R1=physical line|
00002070  20 6e 75 6d 62 65 72 0a  0a 65 5f 63 6c 6e 70 68  | number..e_clnph|
00002080  79 0a 54 68 69 73 20 63  6f 6e 76 65 72 74 73 20  |y.This converts |
00002090  61 20 70 68 79 73 69 63  61 6c 20 6c 69 6e 65 20  |a physical line |
000020a0  6e 75 6d 62 65 72 20 74  6f 20 61 20 66 69 6c 65  |number to a file|
000020b0  20 6f 66 66 73 65 74 2e  20 54 68 69 73 20 69 73  | offset. This is|
000020c0  20 74 68 65 20 6d 6f 73  74 0a 69 6d 70 6f 72 74  | the most.import|
000020d0  61 6e 74 20 6f 66 20 74  68 65 20 33 20 61 73 20  |ant of the 3 as |
000020e0  69 74 20 69 73 20 63 61  6c 6c 65 64 20 77 68 65  |it is called whe|
000020f0  6e 20 75 70 64 61 74 69  6e 67 20 61 20 77 69 6e  |n updating a win|
00002100  64 6f 77 2e 20 46 6f 72  20 65 78 61 6d 70 6c 65  |dow. For example|
00002110  20 74 68 65 0a 77 69 6d  70 20 61 73 6b 73 20 7a  | the.wimp asks z|
00002120  61 70 20 74 6f 20 72 65  64 72 61 77 20 61 20 72  |ap to redraw a r|
00002130  65 63 74 61 6e 67 6c 65  2e 20 54 68 65 20 74 6f  |ectangle. The to|
00002140  70 20 6f 66 20 74 68 65  20 72 65 63 74 61 6e 67  |p of the rectang|
00002150  6c 65 20 69 73 20 61 74  20 70 68 79 73 69 63 61  |le is at physica|
00002160  6c 0a 6c 69 6e 65 20 31  30 30 20 73 61 79 2e 20  |l.line 100 say. |
00002170  5a 61 70 20 6e 65 65 64  73 20 74 6f 20 6b 6e 6f  |Zap needs to kno|
00002180  77 20 74 68 65 20 66 69  6c 65 20 6f 66 66 73 65  |w the file offse|
00002190  74 20 6f 66 20 74 68 69  73 20 6c 69 6e 65 20 74  |t of this line t|
000021a0  6f 20 63 61 6c 6c 0a 65  5f 72 65 64 72 61 77 6c  |o call.e_redrawl|
000021b0  69 6e 65 2e 20 49 74 20  75 73 65 73 20 74 68 69  |ine. It uses thi|
000021c0  73 20 63 61 6c 6c 2e 20  44 6f 20 4e 4f 54 20 73  |s call. Do NOT s|
000021d0  74 61 72 74 20 63 6f 75  6e 74 69 6e 67 20 66 72  |tart counting fr|
000021e0  6f 6d 20 74 68 65 20 73  74 61 72 74 20 6f 66 20  |om the start of |
000021f0  74 68 65 0a 66 69 6c 65  2c 20 61 73 20 74 68 65  |the.file, as the|
00002200  20 77 69 6e 64 6f 77 20  62 65 69 6e 67 20 75 70  | window being up|
00002210  64 61 74 65 64 20 6d 61  79 20 62 65 20 6e 65 61  |dated may be nea|
00002220  72 20 74 68 65 20 65 6e  64 2e 20 49 6e 73 74 65  |r the end. Inste|
00002230  61 64 2c 20 75 73 65 20  74 68 65 20 73 74 61 72  |ad, use the star|
00002240  74 0a 6f 66 20 74 68 65  20 77 5f 74 78 74 20 63  |t.of the w_txt c|
00002250  61 63 68 65 20 61 73 20  61 20 72 65 66 65 72 65  |ache as a refere|
00002260  6e 63 65 2e 20 49 65 2c  20 75 73 65 20 74 68 65  |nce. Ie, use the|
00002270  20 76 61 72 69 61 62 6c  65 73 20 77 5f 63 6c 69  | variables w_cli|
00002280  6e 65 2c 20 77 5f 63 6f  66 66 2c 0a 77 5f 63 6c  |ne, w_coff,.w_cl|
00002290  6f 67 6c 20 61 73 20 79  6f 75 72 20 73 74 61 72  |ogl as your star|
000022a0  74 20 72 65 66 65 72 65  6e 63 65 2e 0a 09 5c 45  |t reference...\E|
000022b0  20 52 30 3d 70 68 79 73  69 63 61 6c 20 6c 69 6e  | R0=physical lin|
000022c0  65 20 6e 75 6d 62 65 72  20 52 38 2f 52 39 0a 09  |e number R8/R9..|
000022d0  5c 58 20 52 30 3d 66 69  6c 65 20 6f 66 66 73 65  |\X R0=file offse|
000022e0  74 20 6f 66 20 6c 69 6e  65 20 73 74 61 72 74 20  |t of line start |
000022f0  52 31 3d 6c 6f 67 69 63  61 6c 20 6c 69 6e 65 20  |R1=logical line |
00002300  6e 75 6d 62 65 72 0a 0a  65 5f 63 6c 6e 6f 66 66  |number..e_clnoff|
00002310  0a 43 6f 6e 76 65 72 74  73 20 61 20 66 69 6c 65  |.Converts a file|
00002320  20 6f 66 66 73 65 74 20  74 6f 20 61 20 6c 69 6e  | offset to a lin|
00002330  65 20 6e 75 6d 62 65 72  20 61 6e 64 20 6f 66 66  |e number and off|
00002340  73 65 74 2e 20 54 68 69  73 20 63 61 6c 6c 20 69  |set. This call i|
00002350  73 20 75 73 65 64 20 62  79 0a 5a 61 70 5f 4f 66  |s used by.Zap_Of|
00002360  66 4c 69 6e 65 43 6f 6c  20 61 6e 64 20 77 68 65  |fLineCol and whe|
00002370  6e 20 61 20 77 69 6e 64  6f 77 20 69 73 20 66 69  |n a window is fi|
00002380  72 73 74 20 6f 70 65 6e  65 64 2e 20 49 74 20 73  |rst opened. It s|
00002390  68 6f 75 6c 64 20 66 69  6e 64 20 6f 75 74 20 77  |hould find out w|
000023a0  68 69 63 68 0a 70 68 79  73 69 63 61 6c 20 6c 69  |hich.physical li|
000023b0  6e 65 20 61 20 66 69 6c  65 20 6f 66 66 73 65 74  |ne a file offset|
000023c0  20 6c 69 65 73 20 6f 6e  2e 20 49 66 20 74 68 65  | lies on. If the|
000023d0  20 66 69 6c 65 20 6f 66  66 73 65 74 20 69 73 20  | file offset is |
000023e0  65 71 75 61 6c 20 74 6f  20 74 68 65 20 66 69 6c  |equal to the fil|
000023f0  65 0a 6c 65 6e 67 74 68  20 74 68 65 6e 20 69 74  |e.length then it|
00002400  20 73 68 6f 75 6c 64 20  72 65 74 75 72 6e 20 74  | should return t|
00002410  68 65 20 6c 69 6e 65 20  6f 66 20 61 6e 20 27 69  |he line of an 'i|
00002420  6d 61 67 69 6e 61 72 79  27 20 6c 61 73 74 20 63  |maginary' last c|
00002430  68 61 72 61 63 74 65 72  2e 20 54 68 69 73 0a 69  |haracter. This.i|
00002440  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 61 20  |s called when a |
00002450  77 69 6e 64 6f 77 20 69  73 20 69 6e 69 74 69 61  |window is initia|
00002460  6c 6c 79 20 6f 70 65 6e  65 64 20 74 6f 20 77 6f  |lly opened to wo|
00002470  72 6b 20 6f 75 74 20 74  68 65 20 77 5f 68 65 69  |rk out the w_hei|
00002480  67 68 74 20 76 61 6c 75  65 2e 0a 41 73 20 77 69  |ght value..As wi|
00002490  74 68 20 65 5f 63 6c 6e  70 68 79 20 79 6f 75 20  |th e_clnphy you |
000024a0  73 68 6f 75 6c 64 20 75  73 65 20 74 68 65 20 63  |should use the c|
000024b0  61 63 68 65 20 72 65 66  65 72 65 6e 63 65 20 70  |ache reference p|
000024c0  6f 69 6e 74 20 61 73 20  61 20 73 74 61 72 74 69  |oint as a starti|
000024d0  6e 67 0a 70 6f 69 6e 74  2e 0a 09 5c 45 20 52 30  |ng.point...\E R0|
000024e0  3d 66 69 6c 65 20 6f 66  66 73 65 74 20 52 38 2f  |=file offset R8/|
000024f0  52 39 0a 09 5c 58 20 52  30 3d 70 68 79 73 69 63  |R9..\X R0=physic|
00002500  61 6c 20 6c 69 6e 65 20  6e 75 6d 62 65 72 0a 09  |al line number..|
00002510  20 20 20 52 31 3d 66 69  6c 65 20 6f 66 66 73 65  |   R1=file offse|
00002520  74 20 6f 66 20 70 68 79  73 69 63 61 6c 20 6c 69  |t of physical li|
00002530  6e 65 20 73 74 61 72 74  0a 09 20 20 20 52 32 3d  |ne start..   R2=|
00002540  6c 6f 67 69 63 61 6c 20  6c 69 6e 65 20 6e 75 6d  |logical line num|
00002550  62 65 72 0a 0a 65 5f 6e  65 78 74 6c 69 6e 65 0a  |ber..e_nextline.|
00002560  54 68 69 73 20 69 73 20  63 61 6c 6c 65 64 20 64  |This is called d|
00002570  75 72 69 6e 67 20 61 20  5a 61 70 5f 44 6f 43 6f  |uring a Zap_DoCo|
00002580  6d 6d 61 6e 64 20 6f 70  65 72 61 74 69 6f 6e 2e  |mmand operation.|
00002590  20 49 74 20 69 73 20 64  65 73 69 67 6e 65 64 20  | It is designed |
000025a0  74 6f 20 77 6f 72 6b 20  6f 75 74 0a 74 68 65 20  |to work out.the |
000025b0  66 69 72 73 74 20 6c 69  6e 65 20 6f 6e 20 73 63  |first line on sc|
000025c0  72 65 65 6e 20 77 68 69  63 68 20 63 61 6e 20 62  |reen which can b|
000025d0  65 20 73 68 69 66 74 65  64 20 64 6f 77 6e 2c 20  |e shifted down, |
000025e0  66 6f 6c 6c 6f 77 69 6e  67 20 61 6e 20 69 6e 73  |following an ins|
000025f0  65 72 74 69 6f 6e 2f 0a  64 65 6c 65 74 69 6f 6e  |ertion/.deletion|
00002600  2c 20 77 69 74 68 6f 75  74 20 62 65 69 6e 67 20  |, without being |
00002610  72 65 64 72 61 77 6e 2e  20 4f 6e 20 65 6e 74 72  |redrawn. On entr|
00002620  79 20 79 6f 75 20 61 72  65 20 74 6f 6c 64 20 74  |y you are told t|
00002630  68 65 20 66 69 72 73 74  20 63 68 61 72 61 63 74  |he first charact|
00002640  65 72 0a 77 68 69 63 68  20 6f 63 63 75 72 73 20  |er.which occurs |
00002650  61 66 74 65 72 20 74 68  65 20 61 6c 74 65 72 65  |after the altere|
00002660  64 20 72 65 67 69 6f 6e  20 61 6e 64 20 74 68 65  |d region and the|
00002670  20 61 6d 6f 75 6e 74 20  62 79 20 77 68 69 63 68  | amount by which|
00002680  20 69 74 73 20 6f 66 66  73 65 74 20 77 69 6c 6c  | its offset will|
00002690  0a 63 68 61 6e 67 65 20  64 75 65 20 74 6f 20 74  |.change due to t|
000026a0  68 65 20 61 6c 74 65 72  61 74 69 6f 6e 2e 20 59  |he alteration. Y|
000026b0  6f 75 20 6d 75 73 74 20  72 65 74 75 72 6e 20 74  |ou must return t|
000026c0  68 65 20 66 69 6c 65 20  6f 66 66 73 65 74 20 6f  |he file offset o|
000026d0  66 20 74 68 65 20 66 69  72 73 74 0a 6c 69 6e 65  |f the first.line|
000026e0  20 77 68 69 63 68 20 6d  61 79 20 62 65 20 73 68  | which may be sh|
000026f0  69 66 74 65 64 20 6f 6e  20 74 68 65 20 73 63 72  |ifted on the scr|
00002700  65 65 6e 20 77 69 74 68  6f 75 74 20 62 65 69 6e  |een without bein|
00002710  67 20 72 65 64 72 61 77  6e 2e 20 28 55 73 75 61  |g redrawn. (Usua|
00002720  6c 6c 79 20 74 68 65 0a  66 69 72 73 74 20 6c 6f  |lly the.first lo|
00002730  67 69 63 61 6c 20 6c 69  6e 65 20 77 69 74 68 20  |gical line with |
00002740  73 74 61 72 74 20 6f 66  66 73 65 74 20 3e 20 52  |start offset > R|
00002750  30 29 2e 20 49 6e 20 74  68 65 20 63 61 73 65 20  |0). In the case |
00002760  77 68 65 72 65 20 74 68  65 72 65 20 69 73 20 6e  |where there is n|
00002770  6f 0a 73 75 63 68 20 6c  69 6e 65 2c 20 72 65 74  |o.such line, ret|
00002780  75 72 6e 20 74 68 65 20  65 6e 64 20 6f 66 20 66  |urn the end of f|
00002790  69 6c 65 20 6f 66 66 73  65 74 20 61 6e 64 20 74  |ile offset and t|
000027a0  68 65 20 70 68 79 73 69  63 61 6c 20 6c 69 6e 65  |he physical line|
000027b0  20 63 6f 6e 74 61 69 6e  69 6e 67 0a 74 68 69 73  | containing.this|
000027c0  20 27 69 6d 61 67 69 6e  61 72 79 27 20 6f 66 66  | 'imaginary' off|
000027d0  73 65 74 20 28 61 73 20  66 6f 72 20 65 5f 63 6c  |set (as for e_cl|
000027e0  6e 6f 66 66 29 2e 0a 09  5c 45 20 52 30 3d 66 69  |noff)...\E R0=fi|
000027f0  6c 65 20 6f 66 66 73 65  74 20 6f 66 20 66 69 72  |le offset of fir|
00002800  73 74 20 27 73 68 69 66  74 61 62 6c 65 27 20 63  |st 'shiftable' c|
00002810  68 61 72 61 63 74 65 72  0a 09 20 20 20 52 31 3d  |haracter..   R1=|
00002820  73 69 67 6e 65 64 20 63  68 61 6e 67 65 20 69 6e  |signed change in|
00002830  20 66 69 6c 65 20 6f 66  66 73 65 74 20 6f 66 20  | file offset of |
00002840  74 68 69 73 20 63 68 61  72 61 63 74 65 72 20 52  |this character R|
00002850  38 2f 52 39 0a 09 5c 58  20 52 30 3d 66 69 6c 65  |8/R9..\X R0=file|
00002860  20 6f 66 66 73 65 74 20  6f 66 20 66 69 72 73 74  | offset of first|
00002870  20 27 73 68 69 66 74 61  62 6c 65 27 20 6c 69 6e  | 'shiftable' lin|
00002880  65 0a 09 20 20 20 52 31  3d 70 68 79 73 69 63 61  |e..   R1=physica|
00002890  6c 20 6c 69 6e 65 20 6e  75 6d 62 65 72 20 6f 66  |l line number of|
000028a0  20 74 68 69 73 20 6c 69  6e 65 20 23 0a 09 20 20  | this line #..  |
000028b0  20 0a 65 5f 6d 69 6e 75  73 0a 54 68 69 73 20 69  | .e_minus.This i|
000028c0  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 74 68  |s called when th|
000028d0  65 20 75 73 65 72 20 70  72 65 73 73 65 73 20 74  |e user presses t|
000028e0  68 65 20 6c 65 66 74 20  61 72 72 6f 77 20 6b 65  |he left arrow ke|
000028f0  79 20 74 6f 20 77 6f 72  6b 20 6f 75 74 20 74 68  |y to work out th|
00002900  65 20 6e 65 78 74 0a 63  75 72 73 6f 72 20 70 6f  |e next.cursor po|
00002910  73 69 74 69 6f 6e 2e 20  54 68 65 20 62 75 66 66  |sition. The buff|
00002920  65 72 69 6e 67 20 69 73  20 64 6f 6e 65 20 66 6f  |ering is done fo|
00002930  72 20 79 6f 75 2e 0a 09  5c 45 20 52 30 3d 6c 69  |r you...\E R0=li|
00002940  6e 65 20 73 74 61 72 74  20 66 69 6c 65 20 6f 66  |ne start file of|
00002950  66 73 65 74 0a 09 20 20  20 52 31 3d 63 75 72 73  |fset..   R1=curs|
00002960  6f 72 20 66 69 6c 65 20  6f 66 66 73 65 74 0a 09  |or file offset..|
00002970  20 20 20 52 32 3d 63 75  72 73 6f 72 20 63 6f 6c  |   R2=cursor col|
00002980  75 6d 6e 20 52 38 2f 52  39 0a 09 20 20 20 52 31  |umn R8/R9..   R1|
00002990  30 3d 63 75 72 73 6f 72  20 63 61 72 65 74 20 62  |0=cursor caret b|
000029a0  6c 6f 63 6b 0a 09 5c 58  20 49 66 20 52 32 3e 3d  |lock..\X If R2>=|
000029b0  30 20 74 68 65 6e 20 52  31 2c 52 32 20 67 69 76  |0 then R1,R2 giv|
000029c0  65 6e 20 6e 65 77 20 63  75 72 73 6f 72 20 70 6f  |en new cursor po|
000029d0  73 69 74 69 6f 6e 20 6f  6e 20 74 68 65 0a 09 20  |sition on the.. |
000029e0  20 20 73 61 6d 65 20 70  68 79 73 69 63 61 6c 20  |  same physical |
000029f0  6c 69 6e 65 2e 0a 09 20  20 20 49 66 20 52 32 3d  |line...   If R2=|
00002a00  2d 31 20 74 68 65 6e 20  52 31 3d 6e 65 77 20 66  |-1 then R1=new f|
00002a10  69 6c 65 20 6f 66 66 73  65 74 20 6f 66 20 63 75  |ile offset of cu|
00002a20  72 73 6f 72 2e 0a 09 20  20 20 49 66 20 52 32 3d  |rsor...   If R2=|
00002a30  2d 32 20 74 68 65 6e 20  79 6f 75 20 68 61 76 65  |-2 then you have|
00002a40  20 6d 6f 76 65 64 20 74  68 65 20 63 75 72 73 6f  | moved the curso|
00002a50  72 20 79 6f 75 72 73 65  6c 66 2e 0a 09 20 20 20  |r yourself...   |
00002a60  49 66 20 52 32 3d 2d 33  20 74 68 65 6e 20 52 30  |If R2=-3 then R0|
00002a70  2c 52 31 3d 6e 65 77 20  78 2c 79 20 66 6f 72 20  |,R1=new x,y for |
00002a80  63 75 72 73 6f 72 2e 0a  0a 65 5f 70 6c 75 73 09  |cursor...e_plus.|
00002a90  09 50 65 72 66 6f 72 6d  20 63 75 72 73 6f 72 20  |.Perform cursor |
00002aa0  72 69 67 68 74 20 28 5c  45 20 26 20 5c 58 20 61  |right (\E & \X a|
00002ab0  73 20 66 6f 72 20 65 5f  6d 69 6e 75 73 29 0a 65  |s for e_minus).e|
00002ac0  5f 73 6d 69 6e 75 73 09  50 65 72 66 6f 72 6d 20  |_sminus.Perform |
00002ad0  63 75 72 73 6f 72 20 62  61 63 6b 20 61 20 77 6f  |cursor back a wo|
00002ae0  72 64 20 28 5c 45 20 26  20 5c 58 20 61 73 20 66  |rd (\E & \X as f|
00002af0  6f 72 20 65 5f 6d 69 6e  75 73 29 0a 65 5f 73 70  |or e_minus).e_sp|
00002b00  6c 75 73 09 09 50 65 72  66 6f 72 6d 20 63 75 72  |lus..Perform cur|
00002b10  73 6f 72 20 66 6f 72 77  61 72 64 20 61 20 77 6f  |sor forward a wo|
00002b20  72 64 20 28 5c 45 20 26  20 5c 58 20 61 73 20 66  |rd (\E & \X as f|
00002b30  6f 72 20 65 5f 6d 69 6e  75 73 29 0a 65 5f 63 6d  |or e_minus).e_cm|
00002b40  69 6e 75 73 09 4d 6f 76  65 20 63 75 72 73 6f 72  |inus.Move cursor|
00002b50  20 74 6f 20 6c 69 6e 65  20 73 74 61 72 74 20 28  | to line start (|
00002b60  5c 45 20 26 20 5c 58 20  61 73 20 66 6f 72 20 65  |\E & \X as for e|
00002b70  5f 6d 69 6e 75 73 29 0a  65 5f 63 70 6c 75 73 09  |_minus).e_cplus.|
00002b80  09 4d 6f 76 65 20 63 75  72 73 6f 72 20 74 6f 20  |.Move cursor to |
00002b90  6c 69 6e 65 20 65 6e 64  20 28 5c 45 20 26 20 5c  |line end (\E & \|
00002ba0  58 20 61 73 20 66 6f 72  20 65 5f 6d 69 6e 75 73  |X as for e_minus|
00002bb0  29 0a 0a 65 5f 72 65 64  72 61 77 6c 69 6e 65 0a  |)..e_redrawline.|
00002bc0  54 68 69 73 20 69 73 20  63 61 6c 6c 65 64 20 77  |This is called w|
00002bd0  68 65 6e 20 79 6f 75 72  20 6d 6f 64 65 20 69 73  |hen your mode is|
00002be0  20 72 65 71 75 69 72 65  64 20 74 6f 20 72 65 64  | required to red|
00002bf0  72 61 77 20 6f 6e 65 20  28 70 68 79 73 69 63 61  |raw one (physica|
00002c00  6c 29 20 6c 69 6e 65 20  6f 66 0a 74 68 65 20 64  |l) line of.the d|
00002c10  69 73 70 6c 61 79 2e 20  59 6f 75 20 61 72 65 20  |isplay. You are |
00002c20  70 61 73 73 65 64 20 74  68 65 20 70 68 79 73 69  |passed the physi|
00002c30  63 61 6c 20 6c 69 6e 65  20 73 74 61 72 74 20 28  |cal line start (|
00002c40  63 61 6c 63 75 6c 61 74  65 64 20 76 69 61 0a 65  |calculated via.e|
00002c50  5f 63 6c 6e 70 68 79 29  2c 20 61 6e 64 20 74 68  |_clnphy), and th|
00002c60  65 20 70 6f 69 6e 74 65  72 20 74 6f 20 61 6e 20  |e pointer to an |
00002c70  6f 75 74 70 75 74 20 74  65 78 74 20 62 75 66 66  |output text buff|
00002c80  65 72 20 6f 66 20 73 75  66 66 69 63 69 65 6e 74  |er of sufficient|
00002c90  20 77 69 64 74 68 20 74  6f 0a 68 6f 6c 64 20 79  | width to.hold y|
00002ca0  6f 75 72 20 6c 69 6e 65  20 28 79 6f 75 20 74 6f  |our line (you to|
00002cb0  6c 64 20 7a 61 70 20 68  6f 77 20 77 69 64 65 20  |ld zap how wide |
00002cc0  62 79 20 65 5f 77 69 64  74 68 29 2e 20 54 68 65  |by e_width). The|
00002cd0  20 62 75 66 66 65 72 20  68 61 73 20 62 65 20 63  | buffer has be c|
00002ce0  6c 65 61 72 65 64 0a 74  6f 20 73 70 61 63 65 73  |leared.to spaces|
00002cf0  2e 20 4c 69 6e 65 20 6e  75 6d 62 65 72 73 20 68  |. Line numbers h|
00002d00  61 76 65 20 62 65 65 6e  20 64 65 61 6c 74 20 77  |ave been dealt w|
00002d10  69 74 68 2e 20 59 6f 75  20 73 68 6f 75 6c 64 20  |ith. You should |
00002d20  66 69 6c 6c 20 69 74 20  77 69 74 68 20 74 68 65  |fill it with the|
00002d30  0a 61 73 63 69 69 20 63  68 61 72 73 20 66 6f 72  |.ascii chars for|
00002d40  20 74 68 69 73 20 70 68  79 73 69 63 61 6c 20 6c  | this physical l|
00002d50  69 6e 65 20 28 30 2d 32  35 35 29 2e 20 59 6f 75  |ine (0-255). You|
00002d60  20 73 68 6f 75 6c 64 20  61 6c 73 6f 20 75 70 64  | should also upd|
00002d70  61 74 65 20 74 68 65 20  73 74 61 72 74 0a 6f 66  |ate the start.of|
00002d80  20 6c 69 6e 65 20 6f 66  66 73 65 74 20 28 65 5f  | line offset (e_|
00002d90  63 6c 6e 70 68 79 20 69  73 20 6f 6e 6c 79 20 63  |clnphy is only c|
00002da0  61 6c 6c 65 64 20 66 6f  72 20 74 68 65 20 66 69  |alled for the fi|
00002db0  72 73 74 20 6c 69 6e 65  20 69 6e 20 61 20 67 72  |rst line in a gr|
00002dc0  6f 75 70 29 2e 20 4e 6f  74 65 0a 74 68 61 74 20  |oup). Note.that |
00002dd0  52 31 31 20 77 69 6c 6c  20 4e 4f 54 20 70 6f 69  |R11 will NOT poi|
00002de0  6e 74 20 74 6f 20 79 6f  75 72 20 6d 6f 64 75 6c  |nt to your modul|
00002df0  65 20 77 6f 72 6b 73 70  61 63 65 20 68 65 72 65  |e workspace here|
00002e00  2e 20 54 68 65 20 61 64  64 72 65 73 73 20 70 61  |. The address pa|
00002e10  73 73 65 64 20 69 6e 0a  52 37 20 69 73 20 74 68  |ssed in.R7 is th|
00002e20  65 20 61 63 74 75 61 6c  20 61 64 64 72 65 73 73  |e actual address|
00002e30  20 6f 66 20 74 68 65 20  66 69 6c 65 20 63 68 61  | of the file cha|
00002e40  72 61 63 74 65 72 20 77  69 74 68 20 74 68 65 20  |racter with the |
00002e50  62 75 66 66 65 72 20 73  70 6c 69 74 74 69 6e 67  |buffer splitting|
00002e60  0a 74 61 6b 65 6e 20 69  6e 74 6f 20 61 63 63 6f  |.taken into acco|
00002e70  75 6e 74 20 28 73 65 65  20 45 2d 46 69 6c 65 29  |unt (see E-File)|
00002e80  2e 0a 09 5c 45 20 52 34  3d 77 5f 66 6f 72 6d 61  |...\E R4=w_forma|
00002e90  74 0a 09 20 20 20 52 35  3d 61 70 70 61 72 65 6e  |t..   R5=apparen|
00002ea0  74 20 62 75 66 66 65 72  20 73 74 61 72 74 20 28  |t buffer start (|
00002eb0  52 37 2d 6f 66 66 73 65  74 20 6f 66 20 63 68 61  |R7-offset of cha|
00002ec0  72 20 69 6e 20 66 69 6c  65 29 0a 09 20 20 20 52  |r in file)..   R|
00002ed0  36 3d 61 64 64 72 65 73  73 20 6f 66 20 63 61 63  |6=address of cac|
00002ee0  68 65 20 6c 69 6e 65 20  74 6f 20 64 72 61 77 20  |he line to draw |
00002ef0  6c 69 6e 65 20 69 6e 20  28 61 6c 72 65 61 64 79  |line in (already|
00002f00  20 62 6c 61 6e 6b 65 64  29 0a 09 20 20 20 52 37  | blanked)..   R7|
00002f10  3d 61 64 64 72 65 73 73  20 6f 66 20 73 74 61 72  |=address of star|
00002f20  74 20 6f 66 20 28 73 6f  75 72 63 65 29 20 6c 69  |t of (source) li|
00002f30  6e 65 0a 09 20 20 20 52  38 2f 52 39 0a 09 20 20  |ne..   R8/R9..  |
00002f40  20 52 31 30 3d 61 64 64  72 65 73 73 20 6f 66 20  | R10=address of |
00002f50  65 6e 64 20 6f 66 20 74  68 69 73 20 73 65 63 74  |end of this sect|
00002f60  69 6f 6e 20 6f 66 20 74  68 65 20 62 75 66 66 65  |ion of the buffe|
00002f70  72 0a 09 20 20 20 52 31  31 3d 6c 6f 67 69 63 61  |r..   R11=logica|
00002f80  6c 20 6c 69 6e 65 20 6e  75 6d 62 65 72 0a 09 5c  |l line number..\|
00002f90  58 20 52 30 2d 52 34 2c  52 36 2c 52 31 30 20 6d  |X R0-R4,R6,R10 m|
00002fa0  61 79 20 62 65 20 63 6f  72 72 75 70 74 65 64 0a  |ay be corrupted.|
00002fb0  09 20 20 20 52 35 2c 52  37 2c 52 31 31 20 6d 75  |.   R5,R7,R11 mu|
00002fc0  73 74 20 62 65 20 75 70  64 61 74 65 64 20 74 6f  |st be updated to|
00002fd0  20 74 68 65 20 73 74 61  72 74 20 6f 66 20 74 68  | the start of th|
00002fe0  65 20 6e 65 78 74 20 70  68 79 73 69 63 61 6c 20  |e next physical |
00002ff0  6c 69 6e 65 0a 09 a0 20  20 52 38 2d 52 39 2c 52  |line...  R8-R9,R|
00003000  31 32 20 6d 75 73 74 20  62 65 20 70 72 65 73 65  |12 must be prese|
00003010  72 76 65 64 0a 0a 65 5f  72 65 64 72 61 77 6c 6e  |rved..e_redrawln|
00003020  75 6d 0a 54 68 69 73 20  69 73 20 63 61 6c 6c 65  |um.This is calle|
00003030  64 20 77 68 65 6e 20 74  68 65 20 75 73 65 72 20  |d when the user |
00003040  77 69 73 68 65 73 20 6c  6f 67 69 63 61 6c 20 6c  |wishes logical l|
00003050  69 6e 65 20 6e 75 6d 62  65 72 73 20 74 6f 20 62  |ine numbers to b|
00003060  65 20 64 69 73 70 6c 61  79 65 64 20 6f 6e 0a 74  |e displayed on.t|
00003070  68 65 20 6c 65 66 74 2e  20 59 6f 75 20 6d 75 73  |he left. You mus|
00003080  74 20 64 65 63 69 64 65  20 77 68 65 74 68 65 72  |t decide whether|
00003090  20 74 68 65 20 67 69 76  65 6e 20 70 68 79 73 69  | the given physi|
000030a0  63 61 6c 20 6c 69 6e 65  20 66 69 6c 65 20 6f 66  |cal line file of|
000030b0  66 73 65 74 20 69 74 20  61 74 0a 74 68 65 20 73  |fset it at.the s|
000030c0  74 61 72 74 20 6f 66 20  61 20 6c 6f 67 69 63 61  |tart of a logica|
000030d0  6c 20 6c 69 6e 65 2e 20  54 68 69 73 20 69 73 20  |l line. This is |
000030e0  63 61 6c 6c 65 64 20 77  68 69 6c 65 20 72 65 64  |called while red|
000030f0  72 61 77 69 6e 67 20 74  68 65 20 6c 69 6e 65 20  |rawing the line |
00003100  6e 75 6d 62 65 72 73 2e  0a 09 5c 45 20 52 37 3d  |numbers...\E R7=|
00003110  66 69 6c 65 20 6f 66 66  73 65 74 20 6f 66 20 73  |file offset of s|
00003120  74 61 72 74 20 6f 66 20  70 68 79 73 69 63 61 6c  |tart of physical|
00003130  20 6c 69 6e 65 0a 09 20  20 20 52 31 31 3d 70 72  | line..   R11=pr|
00003140  6f 70 6f 73 65 64 20 6c  6f 67 69 63 61 6c 20 6c  |oposed logical l|
00003150  69 6e 65 20 6e 75 6d 62  65 72 0a 09 20 20 20 52  |ine number..   R|
00003160  38 2f 52 39 0a 09 5c 58  20 43 43 20 69 66 20 52  |8/R9..\X CC if R|
00003170  37 20 69 73 20 61 74 20  74 68 65 20 73 74 61 72  |7 is at the star|
00003180  74 20 6f 66 20 61 20 6c  6f 67 69 63 61 6c 20 6c  |t of a logical l|
00003190  69 6e 65 0a 09 20 20 20  43 53 20 69 66 20 74 68  |ine..   CS if th|
000031a0  65 20 6c 69 6e 65 20 6e  75 6d 62 65 72 20 73 68  |e line number sh|
000031b0  6f 75 6c 64 20 62 65 20  6c 65 66 74 20 62 6c 61  |ould be left bla|
000031c0  6e 6b 0a 09 20 20 20 59  6f 75 20 6d 61 79 20 63  |nk..   You may c|
000031d0  6f 72 72 75 70 74 20 52  30 2d 52 34 0a 0a 65 5f  |orrupt R0-R4..e_|
000031e0  63 68 61 72 0a 54 68 69  73 20 69 73 20 63 61 6c  |char.This is cal|
000031f0  6c 65 64 20 77 68 65 6e  20 74 68 65 20 75 73 65  |led when the use|
00003200  72 20 74 79 70 65 73 20  61 20 73 74 72 69 6e 67  |r types a string|
00003210  20 6f 66 20 61 73 63 69  69 20 63 68 61 72 73 20  | of ascii chars |
00003220  76 69 61 20 74 68 65 20  43 48 41 52 0a 63 6f 6d  |via the CHAR.com|
00003230  6d 61 6e 64 2e 20 54 68  65 20 63 68 61 72 61 63  |mand. The charac|
00003240  74 65 72 73 20 68 61 76  65 20 62 65 65 6e 20 63  |ters have been c|
00003250  6f 6e 63 61 74 65 6e 61  74 65 64 20 66 6f 72 20  |oncatenated for |
00003260  79 6f 75 2e 20 59 6f 75  20 73 68 6f 75 6c 64 20  |you. You should |
00003270  70 65 72 66 6f 72 6d 0a  74 68 65 20 72 65 6c 65  |perform.the rele|
00003280  76 61 6e 74 20 69 6e 73  65 72 74 69 6f 6e 73 2f  |vant insertions/|
00003290  64 65 6c 65 74 69 6f 6e  73 20 76 69 61 20 5a 61  |deletions via Za|
000032a0  70 5f 43 6f 6d 6d 61 6e  64 2e 0a 09 5c 45 20 52  |p_Command...\E R|
000032b0  34 3d 77 5f 66 6c 61 67  73 0a 09 20 20 20 52 35  |4=w_flags..   R5|
000032c0  3d 6e 75 6d 62 65 72 20  6f 66 20 62 79 74 65 73  |=number of bytes|
000032d0  20 74 79 70 65 64 0a 09  20 20 20 52 36 3d 77 5f  | typed..   R6=w_|
000032e0  66 6f 72 6d 61 74 0a 09  20 20 20 52 37 3d 61 64  |format..   R7=ad|
000032f0  64 72 65 73 73 20 6f 66  20 74 79 70 65 64 20 64  |dress of typed d|
00003300  61 74 61 0a 09 20 20 20  52 38 2d 52 31 30 3d 69  |ata..   R8-R10=i|
00003310  6e 70 75 74 20 63 61 72  65 74 0a 09 5c 58 20 59  |nput caret..\X Y|
00003320  6f 75 20 6d 61 79 20 63  6f 72 72 75 70 74 20 52  |ou may corrupt R|
00003330  30 2d 52 31 31 0a 0a 65  5f 64 65 6c 65 74 65 0a  |0-R11..e_delete.|
00003340  54 68 69 73 20 69 73 20  63 61 6c 6c 65 64 20 77  |This is called w|
00003350  68 65 6e 20 74 68 65 20  75 73 65 72 20 65 78 65  |hen the user exe|
00003360  63 75 74 65 73 20 74 68  65 20 63 6f 6d 6d 61 6e  |cutes the comman|
00003370  64 73 20 44 45 4c 45 54  45 20 6f 72 20 44 45 4c  |ds DELETE or DEL|
00003380  45 54 45 4e 45 58 54 2e  20 41 0a 73 65 71 75 65  |ETENEXT. A.seque|
00003390  6e 63 65 20 6f 66 20 64  65 6c 65 74 65 73 20 69  |nce of deletes i|
000033a0  73 20 63 6f 6e 63 61 74  65 6e 61 74 65 64 20 66  |s concatenated f|
000033b0  6f 72 20 79 6f 75 2e 20  59 6f 75 20 73 68 6f 75  |or you. You shou|
000033c0  6c 64 20 75 73 65 20 5a  61 70 5f 43 6f 6d 6d 61  |ld use Zap_Comma|
000033d0  6e 64 20 74 6f 0a 64 65  6c 65 74 65 20 74 68 65  |nd to.delete the|
000033e0  20 74 65 78 74 2e 20 54  72 79 20 61 6e 64 20 73  | text. Try and s|
000033f0  75 70 70 6f 72 74 20 74  68 65 20 6c 69 6e 65 20  |upport the line |
00003400  65 64 69 74 20 6d 6f 64  65 2e 0a 09 5c 45 20 52  |edit mode...\E R|
00003410  35 3d 6e 75 6d 62 65 72  20 6f 66 20 74 69 6d 65  |5=number of time|
00003420  73 20 70 72 65 73 73 65  64 0a 09 20 20 20 52 36  |s pressed..   R6|
00003430  3d 77 5f 66 6f 72 6d 61  74 0a 09 20 20 20 52 37  |=w_format..   R7|
00003440  3d 30 20 66 6f 72 20 44  45 4c 45 54 45 2f 31 20  |=0 for DELETE/1 |
00003450  66 6f 72 20 44 45 4c 45  54 45 4e 45 58 54 0a 09  |for DELETENEXT..|
00003460  20 20 20 52 38 2d 52 31  30 3d 69 6e 70 75 74 20  |   R8-R10=input |
00003470  63 61 72 65 74 0a 09 5c  58 20 59 6f 75 20 6d 61  |caret..\X You ma|
00003480  79 20 63 6f 72 72 75 70  74 20 52 30 2d 52 31 31  |y corrupt R0-R11|
00003490  0a 0a 65 5f 74 61 62 0a  54 68 69 73 20 69 73 20  |..e_tab.This is |
000034a0  63 61 6c 6c 65 64 20 77  68 65 6e 20 74 68 65 20  |called when the |
000034b0  75 73 65 72 20 65 78 65  63 75 74 65 73 20 74 68  |user executes th|
000034c0  65 20 63 6f 6d 6d 61 6e  64 20 54 41 42 2e 20 41  |e command TAB. A|
000034d0  73 20 75 73 75 61 6c 2c  20 72 65 70 65 74 69 74  |s usual, repetit|
000034e0  69 6f 6e 73 0a 61 72 65  20 63 6f 6e 63 61 74 65  |ions.are concate|
000034f0  6e 61 74 65 64 2e 20 55  73 65 20 5a 61 70 5f 43  |nated. Use Zap_C|
00003500  6f 6d 6d 61 6e 64 20 74  6f 20 70 65 72 66 6f 72  |ommand to perfor|
00003510  6d 20 74 68 65 20 66 75  6e 63 74 69 6f 6e 2e 0a  |m the function..|
00003520  09 5c 45 20 52 31 3d 6e  75 6d 62 65 72 20 6f 66  |.\E R1=number of|
00003530  20 74 69 6d 65 73 20 70  72 65 73 73 65 64 0a 09  | times pressed..|
00003540  20 20 20 52 38 2d 52 31  30 3d 69 6e 70 75 74 20  |   R8-R10=input |
00003550  63 61 72 65 74 0a 09 5c  58 20 59 6f 75 20 6d 61  |caret..\X You ma|
00003560  79 20 63 6f 72 72 75 70  74 20 52 30 2d 52 31 31  |y corrupt R0-R11|
00003570  0a 0a 65 5f 72 65 74 75  72 6e 09 43 61 6c 6c 65  |..e_return.Calle|
00003580  64 20 77 68 65 6e 20 52  45 54 55 52 4e 20 65 78  |d when RETURN ex|
00003590  65 63 75 74 65 64 20 28  5c 45 20 5c 58 20 61 73  |ecuted (\E \X as|
000035a0  20 66 6f 72 20 65 5f 74  61 62 29 0a 65 5f 72 65  | for e_tab).e_re|
000035b0  6e 75 6d 62 65 72 09 43  61 6c 6c 65 64 20 77 68  |number.Called wh|
000035c0  65 6e 20 52 45 4e 55 4d  42 45 52 20 65 78 65 63  |en RENUMBER exec|
000035d0  75 74 65 64 20 28 5c 45  20 5c 58 20 61 73 20 66  |uted (\E \X as f|
000035e0  6f 72 20 65 5f 74 61 62  29 0a 65 5f 73 61 76 65  |or e_tab).e_save|
000035f0  61 6e 64 72 75 6e 09 43  61 6c 6c 65 64 20 77 68  |andrun.Called wh|
00003600  65 6e 20 53 41 56 45 41  4e 44 52 55 4e 20 65 78  |en SAVEANDRUN ex|
00003610  65 63 75 74 65 64 20 28  5c 45 20 5c 58 20 61 73  |ecuted (\E \X as|
00003620  20 66 6f 72 20 65 5f 74  61 62 29 0a 0a 54 68 65  | for e_tab)..The|
00003630  20 6e 65 78 74 20 34 20  73 75 62 73 20 61 72 65  | next 4 subs are|
00003640  20 75 73 65 64 20 62 79  20 74 68 65 20 76 61 72  | used by the var|
00003650  69 6f 75 73 20 64 65 6c  65 74 65 20 6c 69 6e 65  |ious delete line|
00003660  20 63 61 6c 6c 73 2e 20  54 68 65 79 20 65 61 63  | calls. They eac|
00003670  68 20 68 61 76 65 0a 09  5c 45 20 52 30 3d 63 75  |h have..\E R0=cu|
00003680  72 72 65 6e 74 20 66 69  6c 65 20 6f 66 66 73 65  |rrent file offse|
00003690  74 20 69 6e 20 61 20 6c  69 6e 65 20 52 38 2f 52  |t in a line R8/R|
000036a0  39 0a 09 5c 58 20 52 30  3d 6e 65 77 20 66 69 6c  |9..\X R0=new fil|
000036b0  65 20 6f 66 66 73 65 74  20 28 73 65 65 20 62 65  |e offset (see be|
000036c0  6c 6f 77 29 0a 54 68 69  73 20 69 73 20 68 6f 77  |low).This is how|
000036d0  20 74 68 65 20 73 75 62  73 20 61 72 65 20 63 61  | the subs are ca|
000036e0  6c 6c 65 64 3a 0a 0a 44  45 4c 4c 49 4e 45 09 09  |lled:..DELLINE..|
000036f0  44 65 6c 65 74 65 73 20  66 72 6f 6d 20 6c 69 6e  |Deletes from lin|
00003700  65 70 72 65 76 20 74 6f  20 6c 69 6e 65 6e 65 78  |eprev to linenex|
00003710  74 20 6f 66 66 73 65 74  73 2e 0a 44 45 4c 54 4f  |t offsets..DELTO|
00003720  45 4e 44 09 44 65 6c 65  74 65 73 20 66 72 6f 6d  |END.Deletes from|
00003730  20 63 75 72 72 65 6e 74  20 6f 66 66 73 65 74 20  | current offset |
00003740  74 6f 20 6c 69 6e 65 65  6e 64 20 75 6e 6c 65 73  |to lineend unles|
00003750  73 20 74 68 69 73 20 69  73 20 65 6d 70 74 79 0a  |s this is empty.|
00003760  09 09 77 68 65 6e 20 69  74 20 63 61 6c 6c 73 20  |..when it calls |
00003770  4a 4f 49 4e 4c 49 4e 45  20 28 61 73 20 69 6e 20  |JOINLINE (as in |
00003780  65 6d 61 63 73 20 63 74  72 6c 20 4b 29 0a 44 45  |emacs ctrl K).DE|
00003790  4c 54 4f 53 54 41 52 54  09 44 65 6c 65 74 65 73  |LTOSTART.Deletes|
000037a0  20 66 72 6f 6d 20 6c 69  6e 65 73 74 61 72 74 20  | from linestart |
000037b0  74 6f 20 63 75 72 72 65  6e 74 20 6f 66 66 73 65  |to current offse|
000037c0  74 20 75 6e 6c 65 73 73  20 65 6d 70 74 79 2e 0a  |t unless empty..|
000037d0  0a 65 5f 6c 69 6e 65 73  74 61 72 74 09 43 61 6c  |.e_linestart.Cal|
000037e0  6c 65 64 20 74 6f 20 66  69 6e 64 20 74 68 65 20  |led to find the |
000037f0  6c 69 6e 65 73 20 66 69  72 73 74 20 63 68 61 72  |lines first char|
00003800  61 63 74 65 72 2e 0a 65  5f 6c 69 6e 65 65 6e 64  |acter..e_lineend|
00003810  09 43 61 6c 6c 65 64 20  74 6f 20 66 69 6e 64 20  |.Called to find |
00003820  74 68 65 20 6c 69 6e 65  73 20 6c 61 73 74 20 63  |the lines last c|
00003830  68 61 72 61 63 74 65 72  2e 0a 65 5f 6c 69 6e 65  |haracter..e_line|
00003840  6e 65 78 74 09 43 61 6c  6c 65 64 20 74 6f 20 66  |next.Called to f|
00003850  69 6e 64 20 74 68 65 20  6c 69 6e 65 73 20 61 63  |ind the lines ac|
00003860  74 75 61 6c 20 65 6e 64  20 28 65 67 20 61 66 74  |tual end (eg aft|
00003870  65 72 20 26 30 41 29 0a  65 5f 6c 69 6e 65 70 72  |er &0A).e_linepr|
00003880  65 76 09 43 61 6c 6c 65  64 20 74 6f 20 66 69 6e  |ev.Called to fin|
00003890  64 20 74 68 65 20 6c 69  6e 65 73 20 61 63 74 75  |d the lines actu|
000038a0  61 6c 20 73 74 61 72 74  20 28 65 67 20 66 6f 72  |al start (eg for|
000038b0  20 62 61 73 69 63 20 6c  69 6e 65 73 29 0a 0a 65  | basic lines)..e|
000038c0  5f 63 6f 70 79 0a 43 61  6c 6c 65 64 20 77 68 65  |_copy.Called whe|
000038d0  6e 20 75 73 65 72 20 77  69 73 68 65 73 20 74 6f  |n user wishes to|
000038e0  20 63 6f 70 79 20 63 68  61 72 61 63 74 65 72 73  | copy characters|
000038f0  20 76 69 61 20 74 68 65  20 43 4f 50 59 20 6b 65  | via the COPY ke|
00003900  79 2e 20 49 73 20 69 73  20 63 61 6c 6c 65 64 20  |y. Is is called |
00003910  66 6f 72 0a 66 69 6e 64  69 6e 67 20 74 68 65 20  |for.finding the |
00003920  63 68 61 72 61 63 74 65  72 73 20 74 6f 20 63 6f  |characters to co|
00003930  70 79 20 61 6e 64 20 66  6f 72 20 69 6e 73 65 72  |py and for inser|
00003940  74 69 6e 67 20 74 68 65  20 63 6f 70 69 65 64 20  |ting the copied |
00003950  63 68 61 72 61 63 74 65  72 73 2e 0a 52 65 61 73  |characters..Reas|
00003960  6f 6e 20 63 6f 64 65 20  69 73 20 69 6e 20 52 30  |on code is in R0|
00003970  2e 20 57 68 65 6e 20 72  65 61 64 69 6e 67 20 63  |. When reading c|
00003980  68 61 72 61 63 74 65 72  73 20 79 6f 75 20 6d 75  |haracters you mu|
00003990  73 74 20 75 70 64 61 74  65 20 74 68 65 20 63 75  |st update the cu|
000039a0  72 73 6f 72 0a 79 6f 75  72 73 65 6c 66 2e 20 4e  |rsor.yourself. N|
000039b0  6f 74 65 20 74 68 65 20  73 6f 75 72 63 65 20 77  |ote the source w|
000039c0  69 6e 64 6f 77 20 6d 61  79 20 62 65 20 69 6e 20  |indow may be in |
000039d0  61 20 64 69 66 66 65 72  65 6e 74 20 6d 6f 64 65  |a different mode|
000039e0  20 74 6f 20 74 68 65 0a  64 65 73 74 69 6e 61 74  | to the.destinat|
000039f0  69 6f 6e 20 77 69 6e 64  6f 77 21 0a 09 09 5c 45  |ion window!...\E|
00003a00  20 52 30 3d 31 20 3d 3e  20 46 65 74 63 68 20 63  | R0=1 => Fetch c|
00003a10  68 61 72 61 63 74 65 72  73 0a 09 09 20 20 20 52  |haracters...   R|
00003a20  31 3d 6e 75 6d 62 65 72  20 6f 66 20 74 69 6d 65  |1=number of time|
00003a30  73 20 63 6f 70 79 20 70  72 65 73 73 65 64 20 28  |s copy pressed (|
00003a40  6e 75 6d 62 65 72 20 6f  66 20 63 68 61 72 73 20  |number of chars |
00003a50  74 6f 20 67 65 74 29 0a  09 09 20 20 20 52 38 2d  |to get)...   R8-|
00003a60  52 31 30 3d 63 6f 70 79  20 63 75 72 73 6f 72 20  |R10=copy cursor |
00003a70  28 63 61 72 5f 63 75 72  73 6f 72 29 0a 09 09 5c  |(car_cursor)...\|
00003a80  58 20 52 33 3d 70 6f 69  6e 74 65 72 20 74 6f 20  |X R3=pointer to |
00003a90  62 75 66 66 65 72 20 63  6f 6e 74 61 69 6e 69 6e  |buffer containin|
00003aa0  67 20 63 68 61 72 61 63  74 65 72 73 20 74 6f 20  |g characters to |
00003ab0  27 74 79 70 65 27 0a 09  09 20 20 20 52 32 3d 6e  |'type'...   R2=n|
00003ac0  75 6d 62 65 72 20 6f 66  20 63 68 61 72 61 63 74  |umber of charact|
00003ad0  65 72 73 20 74 6f 20 27  74 79 70 65 27 0a 09 09  |ers to 'type'...|
00003ae0  20 20 20 43 6f 70 79 20  63 75 72 73 6f 72 20 75  |   Copy cursor u|
00003af0  70 64 61 74 65 64 20 74  6f 20 6e 65 77 20 70 6f  |pdated to new po|
00003b00  73 69 74 69 6f 6e 0a 09  09 4f 52 0a 09 09 5c 45  |sition...OR...\E|
00003b10  20 52 30 3d 32 20 3d 3e  20 57 72 69 74 65 20 63  | R0=2 => Write c|
00003b20  6f 70 69 65 64 20 63 68  61 72 61 63 74 65 72 73  |opied characters|
00003b30  0a 09 09 20 20 20 52 32  3d 6e 75 6d 62 65 72 20  |...   R2=number |
00003b40  6f 66 20 63 68 61 72 73  20 74 6f 20 74 79 70 65  |of chars to type|
00003b50  0a 09 09 20 20 20 52 33  3d 70 6f 69 6e 74 65 72  |...   R3=pointer|
00003b60  20 74 6f 20 74 68 65 20  63 68 61 72 73 0a 09 09  | to the chars...|
00003b70  20 20 20 52 38 2d 52 31  30 3d 69 6e 70 75 74 20  |   R8-R10=input |
00003b80  63 75 72 73 6f 72 20 28  63 61 72 5f 69 6e 70 75  |cursor (car_inpu|
00003b90  74 29 0a 09 09 5c 58 20  52 30 3d 30 20 6d 65 61  |t)...\X R0=0 mea|
00003ba0  6e 73 20 79 6f 75 27 76  65 20 64 6f 6e 65 20 69  |ns you've done i|
00003bb0  74 20 61 6c 6c 20 79 6f  75 72 73 65 6c 66 0a 09  |t all yourself..|
00003bc0  09 20 20 20 52 30 3d 31  20 6d 65 61 6e 73 20 70  |.   R0=1 means p|
00003bd0  6c 65 61 73 65 20 65 6e  74 65 72 20 69 74 20 66  |lease enter it f|
00003be0  6f 72 20 6d 65 20 76 69  61 20 5a 61 70 5f 43 6f  |or me via Zap_Co|
00003bf0  6d 6d 61 6e 64 0a 09 09  20 20 20 52 30 3d 32 20  |mmand...   R0=2 |
00003c00  6d 65 61 6e 73 20 70 6c  65 61 73 65 20 65 6e 74  |means please ent|
00003c10  65 72 20 69 74 20 66 6f  72 20 6d 65 20 62 79 20  |er it for me by |
00003c20  63 61 6c 6c 69 6e 67 20  6d 79 20 65 5f 63 68 61  |calling my e_cha|
00003c30  72 73 0a 0a 65 5f 6a 6f  69 6e 6c 69 6e 65 09 54  |rs..e_joinline.T|
00003c40  68 69 73 20 69 73 20 63  61 6c 6c 65 64 20 77 68  |his is called wh|
00003c50  65 6e 20 4a 6f 69 6e 6c  69 6e 65 20 70 72 65 73  |en Joinline pres|
00003c60  73 65 64 20 28 5c 45 20  5c 58 20 61 73 20 66 6f  |sed (\E \X as fo|
00003c70  72 20 65 5f 74 61 62 29  0a 65 5f 73 70 6c 69 74  |r e_tab).e_split|
00003c80  6c 69 6e 65 09 54 68 69  73 20 69 73 20 63 61 6c  |line.This is cal|
00003c90  6c 65 64 20 77 68 65 6e  20 53 70 6c 69 74 6c 69  |led when Splitli|
00003ca0  6e 65 20 70 72 65 73 73  65 64 20 28 5c 45 20 5c  |ne pressed (\E \|
00003cb0  58 20 61 73 20 66 6f 72  20 65 5f 74 61 62 29 0a  |X as for e_tab).|
00003cc0  0a 65 5f 61 6c 69 67 6e  63 61 72 65 74 0a 54 68  |.e_aligncaret.Th|
00003cd0  69 73 20 69 73 20 63 61  6c 6c 65 64 20 62 65 66  |is is called bef|
00003ce0  6f 72 65 20 61 6e 79 20  63 6f 6d 6d 61 6e 64 73  |ore any commands|
00003cf0  20 61 72 65 20 65 78 65  63 75 74 65 64 20 6f 6e  | are executed on|
00003d00  20 61 20 77 69 6e 64 6f  77 20 69 6e 20 79 6f 75  | a window in you|
00003d10  72 20 6d 6f 64 65 2e 0a  49 74 20 73 65 72 76 65  |r mode..It serve|
00003d20  73 20 74 77 6f 20 70 75  72 70 6f 73 65 73 2e 20  |s two purposes. |
00003d30  54 68 65 20 66 69 72 73  74 20 69 73 20 74 6f 20  |The first is to |
00003d40  61 6c 69 67 6e 20 74 68  65 20 69 6e 70 75 74 20  |align the input |
00003d50  63 61 72 65 74 20 6f 66  66 73 65 74 20 74 6f 20  |caret offset to |
00003d60  61 0a 73 65 6e 73 69 62  6c 65 20 70 6f 73 69 74  |a.sensible posit|
00003d70  69 6f 6e 20 28 65 67 20  77 6f 72 64 20 61 6c 69  |ion (eg word ali|
00003d80  67 6e 20 69 6e 20 77 6f  72 64 20 6d 6f 64 65 2c  |gn in word mode,|
00003d90  20 70 75 74 20 61 66 74  65 72 20 6c 69 6e 65 20  | put after line |
00003da0  6e 75 6d 62 65 72 73 20  69 6e 0a 62 61 73 69 63  |numbers in.basic|
00003db0  29 2e 20 54 68 65 20 73  65 63 6f 6e 64 20 69 73  |). The second is|
00003dc0  20 74 6f 20 72 65 73 65  74 20 61 6e 79 20 63 6f  | to reset any co|
00003dd0  75 6e 74 65 72 73 20 79  6f 75 20 6d 61 79 20 68  |unters you may h|
00003de0  61 76 65 2e 20 46 6f 72  20 65 78 61 6d 70 6c 65  |ave. For example|
00003df0  2c 20 74 68 65 0a 68 65  78 20 6d 6f 64 65 20 65  |, the.hex mode e|
00003e00  6e 74 72 79 20 75 73 65  73 20 61 20 63 6f 75 6e  |ntry uses a coun|
00003e10  74 65 72 20 74 6f 20 74  65 6c 6c 20 68 6f 77 20  |ter to tell how |
00003e20  6d 61 6e 79 20 6e 69 62  62 6c 65 73 20 68 61 76  |many nibbles hav|
00003e30  65 20 62 65 65 6e 20 69  6e 73 65 72 74 65 64 20  |e been inserted |
00003e40  69 6e 0a 61 20 77 6f 72  64 2e 20 54 68 69 73 20  |in.a word. This |
00003e50  69 73 20 63 6c 65 61 72  65 64 20 6f 6e 20 65 5f  |is cleared on e_|
00003e60  61 6c 69 67 6e 63 61 72  65 74 20 77 69 74 68 20  |aligncaret with |
00003e70  74 68 65 20 6f 6c 64 20  76 61 6c 75 65 20 62 65  |the old value be|
00003e80  69 6e 67 20 73 61 76 65  64 2e 20 54 68 65 6e 0a  |ing saved. Then.|
00003e90  69 66 20 74 68 65 20 63  6f 6d 6d 61 6e 64 20 27  |if the command '|
00003ea0  69 6e 73 65 72 74 20 39  27 20 69 73 20 65 78 65  |insert 9' is exe|
00003eb0  63 75 74 65 64 20 69 74  20 63 61 6e 20 72 65 74  |cuted it can ret|
00003ec0  72 69 65 76 65 20 61 6e  64 20 72 65 73 74 6f 72  |rieve and restor|
00003ed0  65 20 74 68 65 20 73 61  76 65 64 0a 76 61 6c 75  |e the saved.valu|
00003ee0  65 2e 20 49 66 20 61 6e  79 20 6f 74 68 65 72 20  |e. If any other |
00003ef0  63 6f 6d 6d 61 6e 64 20  69 73 20 65 78 65 63 75  |command is execu|
00003f00  74 65 64 20 28 65 67 20  4c 45 46 54 29 20 74 68  |ted (eg LEFT) th|
00003f10  65 6e 20 74 68 65 20 63  6f 75 6e 74 65 72 20 77  |en the counter w|
00003f20  69 6c 6c 0a 72 65 6d 61  69 6e 20 72 65 73 65 74  |ill.remain reset|
00003f30  2e 0a 09 5c 45 20 52 38  2d 52 31 30 3d 63 61 72  |...\E R8-R10=car|
00003f40  65 74 0a 09 5c 58 20 49  6e 70 75 74 20 63 61 72  |et..\X Input car|
00003f50  65 74 20 6f 66 66 73 65  74 20 5b 52 31 30 2c 23  |et offset [R10,#|
00003f60  63 5f 6f 66 66 5d 20 63  61 6e 20 62 65 20 75 70  |c_off] can be up|
00003f70  64 61 74 65 64 2e 0a 0a  65 5f 63 6f 6d 6d 61 6e  |dated...e_comman|
00003f80  64 0a 54 68 69 73 20 65  6e 74 72 79 20 70 6f 69  |d.This entry poi|
00003f90  6e 74 20 69 73 20 63 61  6c 6c 65 64 20 77 68 65  |nt is called whe|
00003fa0  6e 65 76 65 72 20 61 6e  79 6f 6e 65 20 69 73 73  |never anyone iss|
00003fb0  75 65 73 20 61 20 5a 61  70 5f 43 6f 6d 6d 61 6e  |ues a Zap_Comman|
00003fc0  64 20 63 61 6c 6c 2c 20  6f 72 0a 65 71 75 69 76  |d call, or.equiv|
00003fd0  61 6c 65 6e 74 2c 20 74  6f 20 74 72 79 20 61 6e  |alent, to try an|
00003fe0  64 20 61 6c 74 65 72 20  61 20 66 69 6c 65 20 69  |d alter a file i|
00003ff0  6e 20 61 20 77 69 6e 64  6f 77 20 69 6e 20 79 6f  |n a window in yo|
00004000  75 72 20 6d 6f 64 65 2e  20 54 68 65 20 65 61 73  |ur mode. The eas|
00004010  69 65 73 74 20 77 61 79  0a 74 6f 20 64 65 61 6c  |iest way.to deal|
00004020  20 77 69 74 68 20 74 68  69 73 20 69 73 20 74 6f  | with this is to|
00004030  20 70 61 73 73 20 74 68  65 20 63 61 6c 6c 20 6f  | pass the call o|
00004040  6e 74 6f 20 5a 61 70 5f  44 6f 43 6f 6d 6d 61 6e  |nto Zap_DoComman|
00004050  64 20 77 68 69 63 68 20  77 69 6c 6c 20 70 65 72  |d which will per|
00004060  66 6f 72 6d 0a 74 68 65  20 61 6c 74 65 72 61 74  |form.the alterat|
00004070  69 6f 6e 2e 20 48 6f 77  65 76 65 72 2c 20 69 66  |ion. However, if|
00004080  20 79 6f 75 20 73 75 70  70 6f 72 74 20 77 6f 72  | you support wor|
00004090  64 77 72 61 70 2c 20 79  6f 75 20 6d 61 79 20 77  |dwrap, you may w|
000040a0  69 73 68 20 74 6f 20 27  66 69 64 64 6c 65 27 0a  |ish to 'fiddle'.|
000040b0  74 68 65 20 64 61 74 61  2c 20 6f 72 20 65 76 65  |the data, or eve|
000040c0  6e 20 70 65 72 66 6f 72  6d 20 61 64 64 69 74 69  |n perform additi|
000040d0  6f 6e 61 6c 20 6f 70 65  72 61 74 69 6f 6e 73 2e  |onal operations.|
000040e0  0a 09 5c 45 20 41 73 20  66 6f 72 20 5a 61 70 5f  |..\E As for Zap_|
000040f0  43 6f 6d 6d 61 6e 64 0a  0a 65 5f 63 6f 6d 70 69  |Command..e_compi|
00004100  6c 65 09 54 68 69 73 20  69 73 20 63 61 6c 6c 65  |le.This is calle|
00004110  64 20 77 68 65 6e 20 43  6f 6d 70 69 6c 65 20 70  |d when Compile p|
00004120  72 65 73 73 65 64 09 28  5c 45 20 5c 58 20 61 73  |ressed.(\E \X as|
00004130  20 66 6f 72 20 65 5f 74  61 62 29 0a 65 5f 66 6f  | for e_tab).e_fo|
00004140  72 6d 61 74 74 65 78 74  09 54 68 69 73 20 69 73  |rmattext.This is|
00004150  20 63 61 6c 6c 65 64 20  77 68 65 6e 20 46 6f 72  | called when For|
00004160  6d 61 74 74 65 78 74 20  70 72 65 73 73 65 64 09  |mattext pressed.|
00004170  28 5c 45 20 5c 58 20 61  73 20 66 6f 72 20 65 5f  |(\E \X as for e_|
00004180  74 61 62 29 0a 65 5f 72  75 6e 09 09 54 68 69 73  |tab).e_run..This|
00004190  20 69 73 20 63 61 6c 6c  65 64 20 77 68 65 6e 20  | is called when |
000041a0  52 75 6e 20 70 72 65 73  73 65 64 09 09 28 5c 45  |Run pressed..(\E|
000041b0  20 5c 58 20 61 73 20 66  6f 72 20 65 5f 74 61 62  | \X as for e_tab|
000041c0  29 0a 65 5f 72 75 6e 61  6e 64 71 75 69 74 09 54  |).e_runandquit.T|
000041d0  68 69 73 20 69 73 20 63  61 6c 6c 65 64 20 77 68  |his is called wh|
000041e0  65 6e 20 52 75 6e 61 6e  64 71 75 69 74 20 70 72  |en Runandquit pr|
000041f0  65 73 73 65 64 09 28 5c  45 20 5c 58 20 61 73 20  |essed.(\E \X as |
00004200  66 6f 72 20 65 5f 74 61  62 29 0a 65 5f 62 61 73  |for e_tab).e_bas|
00004210  69 63 09 09 54 68 69 73  20 69 73 20 63 61 6c 6c  |ic..This is call|
00004220  65 64 20 77 68 65 6e 20  42 61 73 69 63 20 70 72  |ed when Basic pr|
00004230  65 73 73 65 64 09 28 5c  45 20 5c 58 20 61 73 20  |essed.(\E \X as |
00004240  66 6f 72 20 65 5f 74 61  62 29 0a 0a 65 5f 73 65  |for e_tab)..e_se|
00004250  61 72 63 68 0a 54 68 69  73 20 68 61 6e 64 6c 65  |arch.This handle|
00004260  73 20 73 74 72 69 6e 67  20 73 65 61 72 63 68 65  |s string searche|
00004270  73 20 69 6e 20 79 6f 75  72 20 6d 6f 64 65 2e 20  |s in your mode. |
00004280  52 31 20 67 69 76 65 73  20 74 68 65 20 72 65 61  |R1 gives the rea|
00004290  73 6f 6e 20 63 6f 64 65  2e 20 49 74 20 67 69 76  |son code. It giv|
000042a0  65 73 0a 79 6f 75 20 61  20 63 68 61 6e 63 65 20  |es.you a chance |
000042b0  74 6f 20 27 64 6f 63 74  6f 72 27 20 74 68 65 20  |to 'doctor' the |
000042c0  73 74 72 69 6e 67 2e 20  45 67 2c 20 42 41 53 49  |string. Eg, BASI|
000042d0  43 20 6d 61 79 20 74 6f  6b 65 6e 69 73 65 20 69  |C may tokenise i|
000042e0  74 2e 20 49 74 20 69 73  20 61 6c 73 6f 0a 63 61  |t. It is also.ca|
000042f0  6c 6c 65 64 20 74 6f 20  63 68 65 63 6b 20 61 20  |lled to check a |
00004300  6d 61 74 63 68 20 69 73  20 61 74 20 61 20 76 61  |match is at a va|
00004310  6c 69 64 20 6f 66 66 73  65 74 2e 20 45 67 2c 20  |lid offset. Eg, |
00004320  42 41 53 49 43 20 63 68  65 63 6b 73 20 69 74 20  |BASIC checks it |
00004330  69 73 6e 27 74 20 69 6e  20 61 0a 6c 69 6e 65 20  |isn't in a.line |
00004340  6e 75 6d 62 65 72 2e 0a  09 5c 45 20 52 31 3d 30  |number...\E R1=0|
00004350  20 3d 3e 20 53 74 61 72  74 69 6e 67 20 61 20 73  | => Starting a s|
00004360  65 61 72 63 68 0a 09 20  20 20 52 30 3d 73 65 61  |earch..   R0=sea|
00004370  72 63 68 20 73 74 72 69  6e 67 20 61 66 74 65 72  |rch string after|
00004380  20 6d 61 63 72 6f 73 20  72 65 70 6c 61 63 65 64  | macros replaced|
00004390  20 28 69 6e 20 61 20 68  65 61 70 20 62 6c 6f 63  | (in a heap bloc|
000043a0  6b 29 2e 0a 09 5c 58 20  52 30 3d 70 6f 73 73 69  |k)...\X R0=possi|
000043b0  62 6c 79 20 6e 65 77 20  73 65 61 72 63 68 20 73  |bly new search s|
000043c0  74 72 69 6e 67 2e 0a 09  4f 52 0a 09 5c 45 20 52  |tring...OR..\E R|
000043d0  31 3d 31 20 3d 3e 20 46  6f 75 6e 64 20 61 20 6d  |1=1 => Found a m|
000043e0  61 74 63 68 0a 09 20 20  20 52 31 30 3d 6d 61 74  |atch..   R10=mat|
000043f0  63 68 20 6f 66 66 73 65  74 0a 09 20 20 20 52 39  |ch offset..   R9|
00004400  3d 66 69 6c 65 2e 0a 09  5c 58 20 52 65 74 75 72  |=file...\X Retur|
00004410  6e 20 52 30 3c 30 20 69  66 20 74 68 65 20 6f 66  |n R0<0 if the of|
00004420  66 73 65 74 20 69 6e 76  61 6c 69 64 2e 0a 0a 65  |fset invalid...e|
00004430  5f 72 65 70 6c 61 63 65  0a 54 68 69 73 20 69 73  |_replace.This is|
00004440  20 63 61 6c 6c 65 64 20  77 68 65 6e 20 74 68 65  | called when the|
00004450  20 75 73 65 72 20 77 69  73 68 65 73 20 74 6f 20  | user wishes to |
00004460  70 65 72 66 6f 72 6d 20  61 20 73 65 61 72 63 68  |perform a search|
00004470  20 61 6e 64 20 72 65 70  6c 61 63 65 2e 20 54 68  | and replace. Th|
00004480  65 0a 72 65 70 6c 61 63  65 6d 65 6e 74 20 73 74  |e.replacement st|
00004490  72 69 6e 67 20 68 61 73  20 62 65 65 6e 20 63 61  |ring has been ca|
000044a0  6c 63 75 6c 61 74 65 64  20 66 6f 72 20 79 6f 75  |lculated for you|
000044b0  20 61 6e 64 20 69 74 20  69 73 20 79 6f 75 72 20  | and it is your |
000044c0  6a 6f 62 20 74 6f 20 69  6e 73 65 72 74 0a 69 74  |job to insert.it|
000044d0  2e 20 59 6f 75 72 20 64  65 66 61 75 6c 74 20 61  |. Your default a|
000044e0  63 74 69 6f 6e 20 73 68  6f 75 6c 64 20 62 65 20  |ction should be |
000044f0  74 6f 20 63 61 6c 6c 20  5a 61 70 5f 52 65 70 6c  |to call Zap_Repl|
00004500  61 63 65 41 72 65 61 2e  0a 09 5c 45 20 52 31 3d  |aceArea...\E R1=|
00004510  66 69 6c 65 20 6f 66 66  73 65 74 20 28 6f 66 20  |file offset (of |
00004520  6d 61 74 63 68 29 0a 09  20 20 20 52 32 3d 6c 65  |match)..   R2=le|
00004530  6e 67 74 68 20 28 6f 66  20 6d 61 74 63 68 29 0a  |ngth (of match).|
00004540  09 20 20 20 52 33 3d 72  65 70 6c 61 63 65 6d 65  |.   R3=replaceme|
00004550  6e 74 20 64 61 74 61 0a  09 20 20 20 52 34 3d 72  |nt data..   R4=r|
00004560  65 70 6c 61 63 65 6d 65  6e 74 20 6c 65 6e 67 74  |eplacement lengt|
00004570  68 2e 20 52 38 2f 52 39  0a 0a 65 5f 73 65 6c 65  |h. R8/R9..e_sele|
00004580  63 74 69 6f 6e 0a 54 68  69 73 20 68 61 6e 64 6c  |ction.This handl|
00004590  65 73 20 72 65 67 69 6f  6e 20 73 65 6c 65 63 74  |es region select|
000045a0  69 6f 6e 73 2f 73 61 76  69 6e 67 2e 20 59 6f 75  |ions/saving. You|
000045b0  20 73 68 6f 75 6c 64 20  63 68 65 63 6b 20 74 68  | should check th|
000045c0  65 20 76 61 6c 69 64 69  74 79 20 6f 66 20 74 68  |e validity of th|
000045d0  65 0a 73 65 6c 65 63 74  65 64 20 61 72 65 61 2c  |e.selected area,|
000045e0  20 63 6f 6e 66 69 6e 69  6e 67 20 69 74 20 74 6f  | confining it to|
000045f0  20 6c 69 6e 65 73 2f 70  61 72 61 67 72 61 70 68  | lines/paragraph|
00004600  73 20 69 66 20 79 6f 75  20 77 69 73 68 2e 0a 09  |s if you wish...|
00004610  5c 45 20 52 30 3d 72 65  61 73 6f 6e 20 63 6f 64  |\E R0=reason cod|
00004620  65 20 52 38 2f 52 39 3d  77 69 6e 64 6f 77 0a 09  |e R8/R9=window..|
00004630  20 20 20 52 30 3d 30 20  3d 3e 20 73 74 61 72 74  |   R0=0 => start|
00004640  69 6e 67 20 73 65 6c 65  63 74 69 6f 6e 0a 09 20  |ing selection.. |
00004650  20 20 09 52 31 30 3d 70  72 6f 70 6f 73 65 64 20  |  .R10=proposed |
00004660  73 74 61 72 74 20 63 61  72 65 74 0a 09 20 20 20  |start caret..   |
00004670  52 30 3d 31 20 3d 3e 20  75 70 64 61 74 69 6e 67  |R0=1 => updating|
00004680  20 73 65 6c 65 63 74 69  6f 6e 20 73 69 7a 65 0a  | selection size.|
00004690  09 20 20 20 09 52 31 30  3d 6e 65 77 20 73 65 6c  |.   .R10=new sel|
000046a0  65 63 74 69 6f 6e 20 62  6c 6f 63 6b 20 28 63 61  |ection block (ca|
000046b0  72 5f 73 65 6c 65 63 74  69 6f 6e 29 0a 09 20 20  |r_selection)..  |
000046c0  20 20 09 59 6f 75 20 6d  61 79 20 61 6c 74 65 72  |  .You may alter|
000046d0  20 74 68 65 20 63 6f 6e  74 65 6e 74 73 20 6f 66  | the contents of|
000046e0  20 74 68 65 20 73 65 6c  65 63 74 69 6f 6e 20 62  | the selection b|
000046f0  6c 6f 63 6b 2e 0a 09 20  20 20 52 30 3d 32 20 3d  |lock...   R0=2 =|
00004700  3e 20 73 61 76 69 6e 67  20 73 65 6c 65 63 74 69  |> saving selecti|
00004710  6f 6e 0a 09 20 20 20 09  52 33 3d 64 61 74 61 20  |on..   .R3=data |
00004720  61 64 64 72 65 73 73 20  28 61 20 68 65 61 70 20  |address (a heap |
00004730  62 6c 6f 63 6b 29 0a 09  20 20 20 09 52 32 3d 64  |block)..   .R2=d|
00004740  61 74 61 20 6c 65 6e 0a  20 20 20 20 20 20 20 20  |ata len.        |
00004750  20 20 20 09 52 34 3d 70  72 6f 70 6f 73 65 64 20  |   .R4=proposed |
00004760  66 69 6c 65 74 79 70 65  0a 09 20 20 20 20 20 20  |filetype..      |
00004770  20 20 59 6f 75 20 6d 61  79 20 63 68 61 6e 67 65  |  You may change|
00004780  20 74 68 65 73 65 20 70  72 6f 76 69 64 65 64 20  | these provided |
00004790  52 33 20 72 65 6d 61 69  6e 73 20 61 20 68 65 61  |R3 remains a hea|
000047a0  70 20 62 6c 6f 63 6b 2e  0a 09 20 20 20 20 20 20  |p block...      |
000047b0  20 20 28 65 67 20 42 41  53 49 43 20 77 69 6c 6c  |  (eg BASIC will|
000047c0  20 74 6f 6b 65 6e 69 73  65 20 69 74 29 2e 0a 0a  | tokenise it)...|
000047d0  65 5f 63 6c 69 63 6b 0a  54 68 69 73 20 69 73 20  |e_click.This is |
000047e0  63 61 6c 6c 65 64 20 77  68 65 6e 20 74 68 65 20  |called when the |
000047f0  75 73 65 72 20 63 6c 69  63 6b 73 20 6f 6e 20 79  |user clicks on y|
00004800  6f 75 72 20 77 69 6e 64  6f 77 2e 20 44 65 66 61  |our window. Defa|
00004810  75 6c 74 20 61 63 74 69  6f 6e 20 73 68 6f 75 6c  |ult action shoul|
00004820  64 20 62 65 0a 74 6f 20  63 61 6c 6c 20 5a 61 70  |d be.to call Zap|
00004830  5f 44 65 66 61 75 6c 74  43 6c 69 63 6b 20 77 68  |_DefaultClick wh|
00004840  69 63 68 20 77 69 6c 6c  20 68 61 6e 64 6c 65 20  |ich will handle |
00004850  52 31 3d 30 2c 31 20 61  6e 64 20 69 67 6e 6f 72  |R1=0,1 and ignor|
00004860  65 20 74 68 65 20 72 65  73 74 2e 20 43 6c 69 63  |e the rest. Clic|
00004870  6b 73 0a 61 72 65 20 72  65 67 69 73 74 65 72 65  |ks.are registere|
00004880  64 20 74 6f 20 61 6e 79  20 64 65 70 74 68 2e 0a  |d to any depth..|
00004890  09 5c 45 20 52 31 3d 63  6c 69 63 6b 20 64 65 70  |.\E R1=click dep|
000048a0  74 68 20 28 30 3d 64 72  61 67 20 31 3d 73 69 6e  |th (0=drag 1=sin|
000048b0  67 6c 65 20 63 6c 69 63  6b 20 32 3d 64 6f 75 62  |gle click 2=doub|
000048c0  6c 65 20 63 6c 69 63 6b  20 65 74 63 29 0a 09 20  |le click etc).. |
000048d0  20 20 52 32 3d 78 20 63  6f 6c 75 6d 6e 20 28 69  |  R2=x column (i|
000048e0  6e 63 6c 75 64 69 6e 67  20 6d 61 72 67 69 6e 29  |ncluding margin)|
000048f0  0a 09 20 20 20 52 33 3d  79 20 72 6f 77 20 6f 66  |..   R3=y row of|
00004900  20 63 6c 69 63 6b 20 69  6e 20 77 6f 72 6b 20 61  | click in work a|
00004910  72 65 61 20 63 68 61 72  61 63 74 65 72 73 0a 09  |rea characters..|
00004920  20 20 20 52 34 3d 62 75  74 74 6f 6e 73 20 28 62  |   R4=buttons (b|
00004930  30 3d 41 64 6a 75 73 74  20 62 32 3d 53 65 6c 65  |0=Adjust b2=Sele|
00004940  63 74 20 2d 20 6d 65 6e  75 73 20 64 65 61 6c 74  |ct - menus dealt|
00004950  20 77 69 74 68 29 0a 09  20 20 20 52 38 2f 52 39  | with)..   R8/R9|
00004960  3d 77 69 6e 64 6f 77 20  63 6c 69 63 6b 65 64 20  |=window clicked |
00004970  6f 6e 0a 0a 65 5f 6d 65  73 73 61 67 65 0a 54 68  |on..e_message.Th|
00004980  69 73 20 65 6e 74 72 79  20 70 6f 69 6e 74 20 69  |is entry point i|
00004990  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 61 6e  |s called when an|
000049a0  20 75 6e 72 65 63 6f 67  6e 69 73 65 64 20 77 69  | unrecognised wi|
000049b0  6d 70 20 6d 65 73 73 61  67 65 20 69 73 20 72 65  |mp message is re|
000049c0  63 65 69 76 65 64 20 62  79 0a 7a 61 70 2e 20 54  |ceived by.zap. T|
000049d0  68 65 20 6d 65 73 73 61  67 65 20 69 73 20 62 72  |he message is br|
000049e0  6f 61 64 63 61 73 74 20  74 6f 20 61 6c 6c 20 6d  |oadcast to all m|
000049f0  6f 64 65 73 2e 20 50 6c  65 61 73 65 20 49 47 4e  |odes. Please IGN|
00004a00  4f 52 45 20 28 69 65 20  72 65 74 75 72 6e 29 20  |ORE (ie return) |
00004a10  75 6e 6c 65 73 73 0a 79  6f 75 20 75 6e 64 65 72  |unless.you under|
00004a20  73 74 61 6e 64 20 74 68  65 20 6d 65 73 73 61 67  |stand the messag|
00004a30  65 20 6e 75 6d 62 65 72  21 21 0a 09 5c 45 20 52  |e number!!..\E R|
00004a40  30 3d 79 6f 75 72 20 6d  6f 64 65 20 6e 75 6d 62  |0=your mode numb|
00004a50  65 72 0a 09 20 20 20 52  31 3d 6d 65 73 73 61 67  |er..   R1=messag|
00004a60  65 20 62 6c 6f 63 6b 20  28 61 73 20 73 65 6e 74  |e block (as sent|
00004a70  20 62 79 20 77 69 6d 70  29 0a 09 20 20 20 52 32  | by wimp)..   R2|
00004a80  3d 6d 65 73 73 61 67 65  20 6e 75 6d 62 65 72 20  |=message number |
00004a90  28 69 65 20 52 31 21 31  36 29 0a 09 20 20 20 52  |(ie R1!16)..   R|
00004aa0  33 3d 6d 65 73 73 61 67  65 20 74 79 70 65 20 28  |3=message type (|
00004ab0  31 37 20 6f 72 20 31 39  29 20 61 73 20 72 65 74  |17 or 19) as ret|
00004ac0  75 72 6e 65 64 20 69 6e  20 52 30 20 62 79 20 77  |urned in R0 by w|
00004ad0  69 6d 70 2e 0a                                    |imp..|
00004ad5