%OP%BON
%OP%WRY
%OP%AMM
%OP%BM2
%OP%LM4
%OP%FO/UDC Editor//page @P@/
%CO:A,12,73%%H2%%H1%Z88 User Defined Character Editor

Software & documentation (c) 1989 Simon Phipps, 0221

This software & documentation remains the property of Simon Phipps but 
may be freely used by Z88 Users' Club members provided:

a)   The software is not passed to any other person or body except 
     under these conditions and accompanied by this document unaltered.
b)   No financial or material gain may be made from this software or 
     documentation without permission from the owner.

Simon Phipps, (0703) 550037 or Gold 83:NTG339

%H4%Correct relating to version 1.1 as of 20th March 1989
%P0%
1 - %H1%Capabilities

This is a fairly simple BBC Basic program which allows any user to 
design "User Defined Characters" for the Z88 and generate BBC Basic 
"VDU" commands or zBase procedures to define them. The program allows 
character sets to be saved to RAM and subsequently reloaded. The 
program does not require Richard Russell's graphics patch. An example 
is provided in the form of a defined set of characters and a modified 
Micro User game which uses them.
%P0%
2 - %H1%User Defined Characters

User Defined Characters (UDCs) are special characters supported by the 
display driver on the Z88. They are defined using long but simple 
escape sequences. In a machine with less than 128k of memory in slot 1, 
only 16 may be defined unless the map display is restricted to less 
than 64 bits or is switched off; otherwise, up to 64 may be defined 
using character codes 64 to 127 for identification. The defined 
characters do not replace the standard character set. UDCs are 
displayed with the sequence 

VDU 1,&32,ASC"?",n

where n is the code used to 'tag' the UDC required. This code sequence 
may also be sent from zBase, in the form:

? chr(1)+chr(50)+"?"

where the trailing space is filled with the appropriate 'tag' 
character.

UDCs are used commonly in games and in applications requiring 'icons' 
to represent entities. They cannot be displayed in PipeDream.
%P0%
3 - %H1%Program Operation

To start up, simply RUN or CHAIN the program.
The screen display is divided into five areas:

| Menu area | Editing area    | Test area | Selection area     | Input  |
|-----------|-----------------|-----------|--------------------|--------|
| Currently | Character last  | Text may  | Current values of  | For    |
| available | edited or being | be placed | all UDCs (note:    | input  |
| commands  | edited with UDC | here to   | only those shown   | and    |
|           | display         | test UDCs | dark are editable) | reply  |
%H1%|           |                 |           |                    |        |


Program operation is very simple; merely press the letter shown in the 
menu box for the action you require. At the end of this document is a 
chart showing which commands are available and how they are accessed.

Normally on starting up you will wish to load a previously defined set 
of characters; to do this, press 'F' to select the File menu, then 
select 'L' (load). You will be prompted for a file name on the far 
right of the screen. As the file loads, the cursor will move across the 
display showing each character in turn; all existing definitions will be 
lost. Alternatively, the 'M' (merge) option loads a previously saved 
UDC set without erasing existing definitions (unless they are already 
defined in the set being loaded). The current set of defined characters 
may be saved in a similar way. Note that characters you have not defined 
within the program will not be saved as the program will have no 
knowledge of their definition - these characters are shown in grey on 
the selection grid. If you quit the program and have made any changes to 
any UDCs but have not saved your work, you will be asked for a file name 
to save the definitions. Use :NUL if you do not wish to save your work. 
Note that a suffix of ".UDC" is added to file-names if you do not 
specify a suffix.

To edit a character, return to the main menu with 'R' and select 'E'. 
You will now be able to move the cursor over the character grid using 
the cursor control keys to select a character for editing. Press the 
space bar to select your chosen character, which will then be displayed 
large scale in the editing area. You will now be able to move the 
cursor around the editing area with the cursor keys. You can set or 
reset bits of the UDC with the space bar; reset all bits with 'R'; set 
all all bits with 'S'; invert all bits with 'I'. All changes are shown 
'live' both on the character array and on a single copy of the UDC 
beside the editing area. When the character is satisfactory, press 'C'.

If you press 'O', the 'Other Options' menu is displayed. On this menu 
are aptions to allow you to move characters around and copy definitions. 
When you select any of these options, you will be given the chance to 
decide which other character you wish to duplicate into/move into/swap 
with the character previously selected. During this selection option, 
you may abort by pressing the %H4%SHIFT%H4% and %H4%MENU%H4% keys together.
%P0%
4 - %H1%Program Generation

The program is capable of creating zBase routines and BASIC program 
lines in the form of CLI files for defining UDCs. Both options are 
accessed from the 'P' (Program Generate) option on the main menu (as is 
the option to display the program version number and date).

a - %H2%BBC BASIC

When you press 'B' to select this option, you will be prompted for the 
name of a file to be created. If you do not include a suffix, ".cli" 
will be used. Into this file will be written program lines in plain text 
form preceded by the CLI command '.J' so that the lines will be 
correctly interpreted on loading. A typical file would look like this:

.J
9000 VDU1,&8A,&3D,64,192,196,206,223,206,196,192,248
9001 VDU1,&8A,&3D,65,192,219,223,223,206,196,192,248
9003 VDU1,&8A,&3D,67,192,196,206,223,223,213,196,248
9033 VDU1,&8A,&3D,97,192,196,204,196,196,196,192,199

Note that there are gaps in the sequence as only the characters you have 
edited are defined. The value in the third column (after &8A,&3D,) is 
the tag value for the UDC and corresponds to the character shown in grey 
under the UDC on the UDC Editor display. 

To add these lines to your existing BASIC program, first ensure the line 
numbers are not going to clash with anything else. Then type the 
following command after the '>' prompt:

*CLI .<Filename

The program lines will then be read into BASIC for you. It is best for 
the lines to be included in some form of initialisation routine, 
although you should call them every now and then during the life of your 
program as pop-ups such as Z-Tape re-define a number of UDCs (this also 
applies to zBase programs).

In order to display any UDC, use the following command:

VDU 1,&32,ASC"?",%H2%code%H2%

where %H2%code%H2% is the tag value for the UDC you want to display; for example, to print 
the first UDC defined above, use 64 for %H2%code%H2%.


b - %H2%zBase

Selecting 'Z' for a zBase program, you will be prompted for a file name 
to generate. If you do not specify a suffix, ".prg" will be used. A 
complete zBase program will be generated which, when called, will define 
all of the characters you have designed. Call this routine every now and 
then to re-define the characters in case they are replaced by UDCs from 
another application such as Scrazble. A typical program would look like 
this (note the lines are too long to fit across this page!):

%P10%
* UDC Routines generated by CharEditor (c) 1989 S.Phipps
* To display, use 'at x,y say chr(1)+"2?"+chr(CODE)'
let UDCprefix$=chr(1)+chr(138)+chr(61)
at 0,0 say UDCprefix$+chr(64)+chr(192)+chr(196)+chr(206)+chr(223)+chr(206)+chr(196)+chr(192)+chr(248)
at 0,0 say UDCprefix$+chr(65)+chr(192)+chr(219)+chr(223)+chr(223)+chr(206)+chr(196)+chr(192)+chr(248)
at 0,0 say UDCprefix$+chr(67)+chr(192)+chr(196)+chr(206)+chr(223)+chr(223)+chr(213)+chr(196)+chr(248)
at 0,0 say UDCprefix$+chr(97)+chr(192)+chr(196)+chr(204)+chr(196)+chr(196)+chr(196)+chr(192)+chr(199)
release UDCprefix$
return

The first chr(x) value is the tag value for the UDC and corresponds to 
the character shown in grey under the UDC on the UDC Editor display.
%P0%
5 - %H1%Display Control

The main menu offers an option for display control. Under this option 
will be found commands to allow re-definition of all UDCs know to the 
program (for example, when another application re-defines them and thus 
messes up the display) plus two options for filling the test area; one 
which allows you to type text into it and another which allows you to 
load text from a file (a suffix of ".txt" is added to file-names if none 
is specified). This test area is very useful if you are designing 
'sprites' which are composed from more than one UDC, as the component 
UDCs may be displayed in the order in which they will be used to test 
alignment and appearance. On initialising, the program attempts to load 
the file 'UDC.Txt' from the current directory into the test area. The 
default file supplied merely displays all current UDCs.

Also on the display menu is the Clear option. If you select this option, 
all UDC definitions will be lost.
%P0%
6 - %H1%Command Table

%H2%RUN
_____________________________________________________________
|
F - Files
|
|
|___________________________________
|
L - Load

____________
|
V - Version

__________________________________________________________
|
T - Type

____________________________________________________________
|
O - Options
|
|_______________________________________________
|
D - Duplicate *


*  Option may be aborted with SHIFT+MENU
%CO:B,12,61%







































































































































































































|
S - Save

________________________________________
|
B - Basic


|
L - Load


|
S - Set all
%CO:C,12,49%


































































































































































































|
Q - Quit



|
M - Merge


|
Z- zBase


|
C - Chars


|
R - Reset


|
M - Move *
%CO:D,12,37%


































































































































































































|
P - Program
\____________________ \
                        

|
R - Return


|
R - Return


|
E - Erase


|
I - Invert


|
S - Swap *


%CO:E,12,25%


































































































































































































|
D - Display
         
         \ |
          ||
          ||
          ||
          ||
__________||
           |  
           | |
           |
___________| 
| 
R- Return


|
C - Completed


|
R - Return
%CO:F,12,13%


































































































































































































|
E - Edit *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
