home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilsm
/
megaboard
/
Docs
/
ProgGuide
< prev
next >
Wrap
Text File
|
1995-03-30
|
19KB
|
615 lines
Guide for writing Special icons for Megaboard
---------------------------------------------
----------------
- Introduction -
----------------
This file explains how to create new special icons for Megaboard, it will
only be of interest to programmers, other users should refer to the "Guide"
file for information on general use.
For a step-by-step tutorial on creating a special icon see the ProgTutrl
file.
------------------
- Relevant files -
------------------
The files within Megaboard's application directory used by special icons are
the script file named "Cstm_Scrpt" and the files contained in the "Special"
subdirectory.
----------------------
- Creating new icons -
----------------------
Creating a new icon consists of two steps, writing the icon's definition in
the script file and writing a set of ARM code entry points needed to maintain
the icon.
Icon definition commands
------------------------
The script file consists of the following commands (Not case sensitive):
* Start_Icon
* Name:
* Author:
* Width:
* Height:
* Worksize:
* Update:
* Mouse_State:
* KeyPress_State:
* Message_State:
Start_Parameters
<Parameter name>:<default value>
...
<Parameter name>:<default value>
End_Parameters
* End_Icon
The Commands marked with an asterisk are mandatory and must be present in
every icon definition.
Writing an icon definition
--------------------------
An Icon definition always begins with the command Start_Icon, which may be
preceded by any number of spaces, but otherwise must be the only item on the
line.
Start_Icon is followed on subsequent lines by a list of commands terminated
by the End_Icon command.
Syntax of script commands
-------------------------
All commands except Start_Icon, End_Icon, Start_Parameters and
End_Parameters have the following syntax:
|<Spaces>|<Command>:|<Spaces>|<Value>
Where items contained in || are optional.
Example use:
Width: 100
^^^^^ ^
⇧ ⇧
Leading Spaces
Spaces separating
are command
ignored and
value
are
also
ignored
The command above sets the special icon's width to 100 OS units.
The following commands, however, have the same effect:
Width:100
Width: 100
Width:100
Command descriptions
--------------------
Now for a detailed description of script commands:
Name:
-----
The Name command sets the name of the icon as contained in the 'Special icon'
submenu and in the Function names (described later), it must therefore comply
with Basic V variable name restrictions.
Note: Although the command is not case sensitive in this case the value is.
Example:
Name: Pointer
Author:
-------
You!
This Command sets the name of the icon's author to be displayed in the Info
Box for the icon.
Example:
Author: Fred Bloggs
Version:
--------
Sets the version number of the icon as displayed in the 'Info' box including
the date, if required.
Example:
Version: 1.00 (19 Aug 1994)
Width:
------
Sets the width of the icon in OS units. The value must be a decimal integer
and a multiple of four.
Example:
Width: 100
Height:
-------
Sets the height of the icon in OS units. The value must be a decimal integer
and a multiple of four.
Example:
Height: 100
Worksize:
---------
Sets the amount of workspace the icon requires in bytes. The value must be a
decimal integer.
Example:
Worksize: 100
Update:
-------
Defines how often the icon requires updating, the value must be one of the
following words:
Continuous
Second
Minute
Hour
Day
Never
A value of Continuous means the icon needs updating as often as possible.
Pointer is an example of such an icon.
A value of Second, Minute, Hour or Day mean the icon needs updating every
Second, Minute, Hour or Day (what else!).
Never means the icon's contents do not change with time and therefore it does
not require updating. It is, however, updated whenever it receives a message,
keypress or mouseclick.
Message_State:
--------------
Defines whether or not Wimp messages should be reported to the icon, the
value must be either "On" or "Off".
Mouse_State:
--------------
Defines whether or not mouse clicks should be reported to the icon, the
value must be either "On" or "Off".
Keypress_State:
--------------
Defines whether or not Keypresses should be reported to the icon, the
value must be either "On" or "Off".
Menu_State:
--------------
Defines whether or not the icon has a menu associated with it, the value must
be either "On" or "Off".
Start_Parameters
----------------
Start_Parameters initiates the definition of parameters. It is followed by
a list of parameter descriptions terminated by the Command "End_Parameters".
Example:
Start Parameters
A parameter description has the following format:
|<Spaces>|<Name>:|<Spaces>|<default>
Where <name> is the name of the parameter (as displayed in the icons's
submenu and <default> is its default value. As is initially displayed in
the writeable parameter submenu item.
Example:
Pathname: adfs::4.$.Fred
Megaboard currently has a limit of 16 parameters per icon this will
(hopefully) be altered in a later version.
End_Parameters
--------------
End_Parameters terminates a list of parameters.
Example of a parameter list:
Start_Parameters
Pathname: adfs::4.$.Fred
Size: 1024
End_Parameters
End_Icon
--------
End_icon terminates an icon definition
Example:
End_Icon
-------------------------
- ARM code entry points -
-------------------------
A Megaboard special icon requires a file containing several blocks of ARM
code function correctly. The file must have the following format:
Size of the first code block (including this word) (1 word)
First code block (n words (must be a whol number of words))
Size of the second code block (1 word)
Second code block (n words (must be a whol number of words))
...
Size of the last code block (1 word)
Last code block (n words (must be a whol number of words))
The following code blocks are required:
initialise
null
redraw
finish
save
load
message
mouse
key
menu
menu_select
menu_warning
All of these blocks must be present in every entry points file regardless of
whether a particular icon responds to all messages.
Entry points are called using the BASIC CALL and USR commands i.e. R13 points
to a stack and MOV PC,R14 Areturns.
Entry point code must be position independent.
The entry points file should be named "Code" and placed in the directory
"!MegaBoard.Special.<icon name>". Where <icon name> is the name specified in
the definition. Any other files the icon reqiures should also be stored in
this directory.
Technical details of the entry points
-------------------------------------
INITIALISE
----------
On entry:
R0 - The X screen coordinate of the centre of the icon.
R1 - The Y screen coordinate of the centre of the icon.
R2 - The width of the icon.
R3 - The height of the icon.
R4 - A pointer to the icon's workspace.
R5 - A pointer to a list of parameters
R5+0 - first parameter string
R5+256 - second parameter string
...
R5+n*256 - last parameter string
On exit:
A% - New X screen coordinate
B% - New Y screen coordinate
C% - New icon width
D% - New icon height
Purpose:
Initialise is called when the icon is first placed on MegaBoard i.e. when the
user clicks on it's menu item. It should do any setting up the icon requires
in order for redraw to be called and store any parameters.
Note: the BASIC variables A%-D% are altered from assembler with the
following code (with A% as an example):
ADR R11,variable ;R11 points to the variable name
STMFD R13!,{R14} ;presverve R14 on the stack
MOV R10,R14
ADR R14,done ;point R14 to the address BASIC's variable
locator should return to.
ADD PC,R10,#&3C ;call BASIC's variable locator
.done ;R0 now points to