home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilst
/
zap
/
!Zap
/
Docs
/
E-Entry
< prev
next >
Wrap
Text File
|
1995-06-19
|
35KB
|
708 lines
*************************************************************************
* >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
R12=Zap's 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_BaseMode. 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 and the entry point can be called directly.
Each mode has a word of workspace reserved in the window block (pointed to
by R8) for each file. A mode is responsible for storing the current options
in their mode word when the user changes mode (see e_start/e_end). There
are Zap calls provided to make this easier for you. If you need more than
one word of workspace then the mode word can store the pointer to a block of
workspace if you set a flag in e_mode. See E-Windows (w_mode0...) and E-Vars
(opt_mode0...).
The entry points
================
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. (Ie, the
name of the mode). 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 number on which to base null entry points. This is a bit out
of date since modes are now referred to by names and assigned numbers when
loaded. For all practical purposes this will always be 0 (text mode) though
you can use any mode permanently installed in Zap (ie 0=Text 1=byte 2=word
3=ascii 4=hex 11=throwback).
e_mode
Gives the mode number you would like to be in bits b0-b7. Bits 8-31
contain flags. It is VERY important that you do not assume you get this mode
number. Now that Zap loads modes on the fly, modes are often loaded in a
funny order and you cannot guarantee this mode number will be free. I suggest
that (seeing as modes 0-12 already have a standard meaning) you set this to
13 and then Zap will assign you the next free mode >=13. It tells you which
mode you have actually been assigned on e_init with R1=1.
Bits 8-31 as follows:
b8 Set to receive RAW keyboard input. All key presses are sent
to e_char. Zap key codes greater than &FF are sent as a
zero byte followed by the low byte.
b9 Set to get taskwindow style keyboard input passed to e_chars.
This differs from normal e_chars entry in that:
1) Delete is passed on as &7F instead of calling e_delete
2) Characters &20-&FF are passed on regardless of mapping
3) If not in COPY mode then the cursor keys are passed on
as a 0 byte followed by bottom 8 bits of the wimp's code.
Similarly TAB.
4) Return and Escape are passed on as &0D and &1B.
This is subject to changes - contact me.
b10 Set to indicate that you use a mode word in a window block
(eg w_moden) to point to a block of data. See E-Windows
for the format this block must take.
b11 Set to indicate that this is not a 'textual' mode. Eg it's
like byte/word mode. Setting this bit prevents, for example,
auto DOS text file detection.
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 or wants to give your
mode a chance to intercept an operation. 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. I am at liberty to add extra reason
codes so please return with all registers unaltered if you receive an
unrecognised code.
\E R1=reason code (and other registers may hold values dependent on it)
\X Save R1-R11 as usual unless otherwise stated below.
The reason codes are:
R1=0 => Zap is quitting and about to kill your module.
Return R0=-1 to stop this (eg if you've more than one mode).
R1=1 => Zap is just about to start up your mode (but hasn't read the
options block for this mode or anything like that).
R0=the mode number assigned to your mode.
You should note the mode number that has actually been assigned to
you and store it in your module somewhere. This is not guaranteed
to be the one you asked for.
R1=2 => Zap has started up your mode (and all other modes in your module).
You should also use this call to claim any buffers you need.
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. (See E-Vars)
R1=3 => Zap is deleting a file with your mode number in f_cmode. R9=file
block on entry. See E-File.
R1=4 => Zap is saving a file with your mode number in f_cmode. R8/R9=the
window being saved. Return R1=-1 if you wish to abort the save
(and handle it yourself). If you return R1=-1 then return R0=0 if
the save is safe (file can now be deleted) or -1 if unsafe (entered
data transfer protocol for example).
This is only called for saves to disc (F3). For inter-application
saves and post-saves see R1=8 below.
R1=5 => Zap wants to delete a file your mode number in f_cmode, but it
has the 'altered' flag set. Return R1=-1 to override and allow the
file to be killed anyway.
R1=6 => Zap is creating the colours submenu and wants to know what you
call colours >=9. Return in R1 pointer to a double zero terminated
list of zero terminated entries giving the names of the colours
starting from 9. Eg "REMs",0,"Strings",0,0. (Or leave R1 as 6
if this call is not supported).
R1=7 => Zap is creating its menus. At this point you can override your
e_menu value by returning R1 as the pointer to the replacement
(wimp-style) menu (values at #-4 and #-8 - see E-Menus).
Leave R1=7 if you don't want to do this.
You should use Zap_ReadMenu or Zap_LoadMenu to create the menu.
R1=8 => Zap is about to save a file with your mode number in f_cmode
to another application (not to disc). See also R1=4.
;E R0=0 if the file is just about to be saved
1 if the file has been transferred
R8/R9=the file being saved
e_menu
Offset of submenu in Zap's format / 0 for none. This menu comes off the
'Mode' menu. See the file E-Menu for details of the menu format. Greater
versatility can b