0% found this document useful (0 votes)
210 views

PG3

The SAIA PCA Programmable Logic Controller was one of the first devices to implement a "virtual machine", way back in the 1970s. The second generation, the SAIA PCD, was developed in the mid-1980s. Here are the original functional specifications for the "PG3" Programming Utilities, the tools used for programming this 2nd generation of controllers. These tools were developed to run on the very first personal computers, running "DOS".

Uploaded by

matt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
210 views

PG3

The SAIA PCA Programmable Logic Controller was one of the first devices to implement a "virtual machine", way back in the 1970s. The second generation, the SAIA PCD, was developed in the mid-1980s. Here are the original functional specifications for the "PG3" Programming Utilities, the tools used for programming this 2nd generation of controllers. These tools were developed to run on the very first personal computers, running "DOS".

Uploaded by

matt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 577

Table of Contents

Preface

PG3 Main Menus

Sedit - Instruction List Editor

Sasm - Assembler

Slink - Linker

Sbug - Debugger

Sconf - Online Configurator

Sdat - Data Transfer Utility

Sdisasm - Disassembler

Sdoc - Documentation Generator

Sfbref - FB Cross-Reference Generator

Sfile - File Handling Tools

Shelp - Context-Sensitive Help System

Sload - Up/Downloader

Sprom - EPROM Programming Tools

Sres - Resource Table Generator

Sview - Text File Viewer


PREFACE
════════

In 1986, I accepted a job in Switzerland with a small private company


called Sodeco-Saia. In the late 70s, this company had developed one of the
first "programmable logic controllers", known as the "PCA" (Programmable
Controller version A). This was a "virtual machine" with its own
proprietary programming language (PCA Instruction List) which was compiled
into bytecodes that were interpreted by firmware running on the controller.
The PCA’s programming tools (PCASS) were coded in Pascal, a high-level
language developed by Niklaus Wirth in Switzerland.

I was hired as a member of the team to develop the software for the next
generation of controllers, known as the "PCD". PCB was not used because
that means "printed circuit board", and PCC means "pour copie conforme" in
French, so they settled on "PCD". This also stands for "Process Control
Device", but that wasn’t realized until some years later.

First, the hardware was developed around the enormous 16-bit Motorola 68000
microprocessor. This was one of the most advanced microprocessors available
at that time. It was big!

In parallel to the hardware development, the software team worked on an


improved Instruction List programming language which was upward-compatible
with the original PCA language. My job was to help with the new programming
language and develop the software necessary to convert this language into
the binary bytecodes that could be executed by the "interpreter" running on
the PCD’s 68000 microprocessor. Another team developed the "firmware" to
run on the 68000, which comprised the Instruction List bytecode interpreter
and the communications and debug drivers.

For customers to be able to write programs for the controller, an


Instruction List program editor was needed, plus an "assembler" and
"linker" to create the bytecodes, a "downloader" to put the program into
the controller’s memory, and a "debugger" for commissioning and testing the
program.

In the end, it was I who developed the entire software product, which was
known as the "PG3" (PG = Programmiergerät in German). The full name was
"SAIA PCD Programming Utilities".

This voluminous document contains my specifications for all the parts of


the software which I developed. In addition to these, a French programming
methodology called "Grafcet" was implemented by a student at ETHZ as part
of his PHD project. Saia called their (slightly simplified) version,
"Graftec".
The software was developed for IBM PCs running "DOS", which later became
"MS-DOS". At that time, the displays were text only, 24 lines x 80
characters, usually monochrome. The first PC that I used had a monochrome
screen and two 5.25" floppy disk drives, but soon I got a new machine with
a 5MB hard drive, wow! We used the fast Borland Turbo C compiler for
development.

All these specifications were [laboriously] written on a DOS machine using


a very basic "text editor". This was way before Windows and Microsoft Word.

The PG3 product was a great success. It remained in use for over 15 years.
Nearly 40 years later, much of the original PG3 "C" code still exists deep
inside the latest version of the programming tools (the PG5 "Controls
Suite").

When Microsoft Windows was first released, we developed a new version


called the "PG4", which had an additional programming language called
"Fupla". Fupla was developed by a very clever Canadian wizard called Jean
Tremblay. With this, instead of writing a program, you could draw the
process like a circuit diagram by connecting function blocks (FBoxes)
together using data "wires" (bool, int and float signals). This feature
made Saia into a world class company.

Some years later, we started work on a new generation of programming tools,


intuitively called the "PG5". But the CEO and leader of development at that
time made a huge and unforgivable mistake by not allowing us to develop the
(badly needed) next generation of controllers in parallel. So, the new
tools were for developed the *old* controller architecture!? Almost all the
engineers thought this was an insane decision, but we were all ignored by
the management. This decision proved to be the downfall of the company.

Now, you can have many hours of fun reading my original specifications for
the PG3. It’s only just over 570 pages...

Matt Harvey
2023.06.24
*********************************************************************
* *
* SAIA PCD PROGRAMMING UTILITIES MENUS *
* FUNCTIONAL SPECIFICATIONS *
* FILENAME PCDMENU.DOC *
* AUTHOR Matt Harvey, SAIA AG, Murten *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1
1) On Connect menu, add function key F7=PCD shortcut for PCD
type selection.

21-Mar-97 $208, $207


1) Simplified the Connect menu's operation.
It now has these modes: PGU, S-BUS and S-BUS MODEM. PGU mode
works as before. S-BUS mode automatically tries each S-BUS
mode in turn (parity, data, break) if it cannot connect, and
always sends a "get station number" telegram if the entered
station number does not respond. There is no need to set the
station number to 255 to do this. S-BUS MODEM modem is
similar, but it tries data and break modes (not parity), and
the telephone number field is displayed.
Section 4.10 has been re-written.
2) The "Phonebook" feature has been improved and now allows up
up to 300 telephone numbers in the PHONES.DAT file. It uses
a new overlay file called SPHONES.OVL. See section 4.10.1.

14-Jan-97 $205
1) The Connect menu now allows S-BUS DATA MODE protocol to be
selected, for use with public line or radio modems.

21-Jun-96 V2.0

21-Feb-96 $19F
1) SWER 801: Resource table menu now creates FB parameter
cross-reference list file (.FBR).
2) SWMR 807: S-BUS can now be configured via an S-BUS link
from the "coNnect" menu when F4 is pressed (previosly, was
only via a PGU connection).
3) SWMR 602: File and directory names can be max. 8 characters.
File types can be max. 3 characters.

16-Oct-95 $198
1) "Connect" menu: P800 changed to PGU mode.
24-Apr-95 V1.9
1) The default file extension for the disassembler menu's
"File to disassemble" file name is now ".UPL" (was .PCD).

29-Mar-95 $18C
1) The "Link/Make" menu's "Check FB parameters" switch has
been changed to "Check Bloctec/Graftec", and SFBREF now
also verifies the Graftec step/transition structure.

13-Mar-95 $18B
1) Added "AUTO-ANSWER MODE" command to "Connect" menu, see
4.10.
2) Added error message ERROR 44: MISSING "AnswerOn" OR
"AnswerOff" STRING IN MODEM.INI.

06-Feb-95 $18A
1) Added password protection mechanism, see 4.10.3.
2) Added "read station number" feature, see 4.10.

05-Jul-94 $186
1) All file name entry fields can now accept a file name
up to 128 characters long. If the file name is longer
than the field, is can be scrolled using the left or
right arrow, home and end keys. If larger than the field,
< or > is shown at the start or end of the field to
indicate that is can be scrolled.
2) The "coNnect" screen now allows the S-BUS signalling mode
to be selected. The "Protocol" switch is now:
P800
S-BUS MODE 1 (PARITY)
S-BUS MODE 0 (BREAK)
3) The "coNnect" screen now processes some function keys for
short-cut configuration:
F3 = Configure S-BUS (runs SCONFIG)
F4 = Download S-BUS (runs SDNLD /S)
F5 = Configure serial ports (runs SCONFIG)
F6 = Select modem (runs SCONFIG)
4) The SCONNECT.EXE program, which is a DOS command line
replacement for the "coNnect" menu now has two extra switches
for selecting the S-BUS mode, the default is /S1:
/S1 = use "parity" signalling, mode S1
/S0 = use "break" signalling, mode S0
24-Sep-93 $175
1) Improved modem error messages:
ERROR 41: CAN'T CONNECT, MODEM RESPONSE: "...."
ERROR 42: CTS NOT RETURNED BY MODEM
ERROR 43: NO RESPONSE OR CARRIER FROM REMOTE MODEM
Also displays actual response strings received from
modem.
Removed errors 37 and 38.
2) Now accepts foreign characters in file names. Lower case
foreign letters are converted to standard ASCII upper case
characters. E.g. ä -> A.

09-Jun-93 V1.7
1) Whenever the cursor is in a filename entry field, pressing
function key F5 displays a pop-up directory window, from
which a filename can be chosen. See section 3.
2) Function key F1 now displays help.
3) Extended or expanded memory can now be used to provide up
to 100K bytes of extra memory for child programs (SEDIT,
SASM etc). See section 2.
4) New "coNnect" menu, with modem dialler and "phone book".
See section 4.10. Also SCONNECT program, see 4.10.2.
5) New documentation generator menu layout and new switches
"List LD values in binary" and "Use temporary file". See
section 4.7.
6) New disassembler menu switches for disassembly of the new
extension memory segment. See section 4.8.
7) New error messages 10..41. See section 5.1.
8) New sections "2.1 Logo screen", and "2.2 Use of directories",
and 3.1 to 3.4.
9) Prompt line texts changed.
10) If the assembler, linker etc. detects an error, the message
"WARNING: ERROR(S) OCCURRED" is displayed on the error
message line, accompaied by a beep. This notifies the user
that the operation failed, even if the error messages have
scrolled off the screen.

17-Jan-92 $155
1) Added "Remove blank lines" switch to Documentation Generator
menu, which also has a new layout.

09-Oct-91 $153
1) Disassembler menu start/end addresses now up to 6 digits
(0..262143) for new 1MB R600 memory module. Change "Start
address" to "Code start line", and "End address" to "Code
end line" for clarity.
2) New ERROR 10: INVALID ADDRESS.
30-Aug-91 $152
1) Add ERROR 9: OUT OF ENVIRONMENT SPACE.
2) Increase lengths of file names where possible.
3) Add "List Graftec parameters" and "List EQU/DEF statements"
switches to Documentation Generator menu.
4) Add "Assemble" option to Link menu - this allows "No files/
Changed files/All files" to be assembled before linking. It
provides a kind of "make" utility.

09-May-90 V1.4
1) Add macro switch to Assembler menu.
2) Add line numbers switch to Documentation menu.
3) "Texts & Data Blks" on resource table generator menu.

22-Nov-89 Version 1.3


1) More than one '.' allowed during filename entry.
2) "Ms-dos command" menu now stores last 10 commands. These
can be recalled with the up/down arrow keys. The very last
command is stored in the PCDMENU.DAT file.
3) Changed "Install" to "Configure", which is a more accurate
description, "doCumentation" changed to "dOcumentation".
"Configure" invokes SCONFIG.EXE.
4) Name of program for "Edit" now configurable from the
"Configure" menu.
5) Added "Word processor" command, invokes PE or other ASCII,
configurable from "Configure/Editor program names" menu.
6) Accepts disk drive name on all menus.
7) Now works in colour as defined in PCDCOLOR.DAT.
8) Added "Transfer data". This will invoke SDAT.EXE when it's
available.
9) Disassemble menu now supports new switches and a start/end
address.
10) Add comment selector switch to Documentation menu.
11) Add sort map symbols switch to Link menu.
12) New title "PCD PROGRAMMING UTILITIES".
13) Add ERROR 8 message, change message for ERROR 5.
14) Removed section on installation from this document, this is
described in README.TXT and doesn't belong here.

25-Nov-88 Version 1.1:


1) Name of menu program changed to PCD.EXE
2) Name if menu data file and install data file changed to
PCDMENU.DAT and PCDSETUP.DAT
3) Added "Graftec" option and restructured the main menu.
4) New package diagram.

30-May-88 Version 1.0:


1) Linker menu now includes "Check FB References" switch which
allows SFBREF to be invoked.
2) New Resource Table menu, to include FB Parameter Reference
List generator.
3) New ERROR 7.

26-Jun-87 Initial edit.


MENUS - Page 1

CONTENTS
════════
Page

1. OVERVIEW . . . . . . . . . . . . . . . 2
1.1 Package Diagram . . . . . . . . . . . . 3

2. INVOCATION FROM DOS . . . . . . . . . . . 5


2.1 Logo screen . . . . . . . . . . . . . 6
2.2 Use of directories . . . . . . . . . . . 7

3. GENERAL USER INTERFACE NOTES . . . . . . . . 8


3.1 Screen layout . . . . . . . . . . . . 8
3.2 Entry fields . . . . . . . . . . . . . 8
3.3 Directory window . . . . . . . . . . . 9
3.4 Help . . . . . . . . . . . . . . . 10

4. MENUS . . . . . . . . . . . . . . . . 11
4.1 Main Menu . . . . . . . . . . . . . . 11
4.2 Editor Menu . . . . . . . . . . . . . 13
4.3 Assembler Menu . . . . . . . . . . . . 14
4.4 Linker Menu . . . . . . . . . . . . . 16
4.5 Graftec Menu . . . . . . . . . . . . . 18
4.6 Resource Table Generator Menu . . . . . . . 19
4.7 Documentation Generator Menu . . . . . . . 21
4.8 Disassembler Menu . . . . . . . . . . . 23
4.9 Ms-dos Command Menu . . . . . . . . . . 25
4.10 Connect Menu . . . . . . . . . . . . . 26
4.10.1 The Phonebook . . . . . . . . . . . . 29
4.10.2 SCONNECT Program . . . . . . . . . . . 30
4.10.3 Password protection . . . . . . . . . . 31

5. ERROR HANDLING . . . . . . . . . . . . . 32
5.1 Error Messages . . . . . . . . . . . . 32
MENUS - Page 2

1. OVERVIEW
════════════

The SAIA PCD Programming Utilities is a set of programs, each of


which can be run either directly from DOS or from this front-end
menu program "PCD.EXE". The menus provide a user-friendly method
for entering data before invoking the programs, and also provides
many additional features.

Each utility has its own menu, which is either part of this front-
end menu program, or is an integral part of the utility itself.
The diagram on the next page illustrates this.

This document describes the main menu and sub-menus which are part
of the PCD.EXE menu program. Menus and screens controlled by
utilities invoked from the menus are described in their respective
functional specifications.

The menu package allows the user to work in any directory, for
example, a "project" directory, with his own configuration and
menu data.
MENUS - Page 3

1.1 Package Diagram


════════════════════

Boxes drawn with '─' characters are part of this menu program.
Boxes drawn with '═' characters are stand-alone programs, which
contain their own integral menus, the names of these programs are
also shown, refer to the relevant functional specifications for
details of these programs and their menus.

┌────────────┐ ┌────────────┐ ╔════════════╗


│ Main Menus │ Edit │ Editor │ ║ Editor, as ║
│ PCD.EXE ├──────┬───────────────>│ Menu ├──>║ defined in ║<┐
│ │ │ │ │ ║ Configure ║ │
└────────────┘ │ └────────────┘ ╚════════════╝ │
│ ┌────────────┐ ╔════════════╗ │
│ Assemble │ Assembler │ ║ Assembler ║ │
├───────────────>│ Menu ├──>║ SASM.EXE ║ │
│ │ │ ║ ║ │
│ └────────────┘ ╚════════════╝ │
│ ┌────────────┐ ╔════════════╗ │
│ Link │ Linker │ ║ Linker ║ │
├───────────────>│ Menu ├──>║ SLINK.EXE &║ │
│ │ │ ║ SFBREF.EXE ║ │
│ └────────────┘ ╚════════════╝ │
│ ╔════════════╗ │
│ Debug ║ Debugger ║ │
├────────────────────────────────>║ SBUG.EXE ║ │
│ ║ ║ │
│ ╚════════════╝ │
│ ╔════════════╗ ╔════════════╗ │
│ Up/download ║ SLOAD.EXE ║ ║ Loaders ║ │
├───────────────>║ Loader Menu║──>║ SUPLD.EXE ║ │
│ ║ Program ║ ║ SDNLD.EXE ║ │
│ ╚════════════╝ ╚════════════╝ │
│ ┌────────────┐ ╔════════════╗ │
│ Graftec │ Graftec │ ║ Graftec ║ │
├───────────────>│ Editor ├──>║ Editor ║─┘
│ │ Menu │ ║ SGRAF.EXE ║
│ └────────────┘ ╚════════════╝
│ ╔════════════╗
│ View program ║ ║
├────────────────────────────────>║ SVIEW.EXE ║
│ ║ ║
│ ╚════════════╝
│ ┌────────────┐ ╔════════════╗
│Resource tables │ Resource │ ║ ║
├───────────────>│ Table ├──>║ SRES.EXE ║
│ │ Menu │ ║ SFBREF.EXE ║
│ └────────────┘ ╚════════════╝
│ ┌────────────┐ ╔════════════╗
│ dOcumentation │ Document- │ ║ ║
├───────────────>│ ation Menu ├──>║ SDOC.EXE ║
│ │ │ ║ ║
│ └────────────┘ ╚════════════╝
v
MENUS - Page 4

Package diagram continued


─────────────────────────

v
│ ┌────────────┐ ╔════════════╗
│ dIsassemble │Disassembler│ ║Disassembler║
├───────────────>│ Menu ├──>║ SDISASM.EXE║
│ │ │ ║ ║
│ └────────────┘ ╚════════════╝
│ ╔════════════╗
│ Program eproms ║ Eprom Prog ║
├────────────────────────────────>║ SPROM.EXE ║
│ ║ ║
│ ╚════════════╝
│ ╔════════════╗
│ Transfer data ║ ║
├────────────────────────────────>║ SDAT.EXE ║
│ ║ ║
│ ╚════════════╝
│ ╔════════════╗
│ File handling ║ ║
├────────────────────────────────>║ SFILE.EXE ║
│ ║ ║
│ ╚════════════╝
│ ╔════════════╗
│ Word processor ║ User- ║
├────────────────────────────────>║ defined ║
│ ║ text editor║
│ ╚════════════╝
│ ┌────────────┐
│ Ms-dos command │ Ms-dos │
├───────────────>│ Command │
│ │ Handler │
│ └────────────┘
│ ┌────────────┐
│ coNnect │ Connect │
├───────────────>│ menu and │
│ │ dialler │
│ └────────────┘
│ ╔════════════╗
│ Configure ║ ║
├────────────────────────────────>║ SCONFIG.EXE║
│ ║ ║
│ ╚════════════╝
│ ┌────────────┐
│ Quit │ Quit │
└───────────────>│ Command │
│ Handler │
└────────────┘
MENUS - Page 5

2. INVOCATION FROM DOS


═══════════════════════

The menu program is invoked from the DOS prompt with one of these
commands:

PCD /X Use extended or expanded memory


PCD /NX Disable use of extended or expanded memory,
forces use of only conventional memory
PCD Uses the last switch as the default, /X or /NX

The /X switch is given, the menu program will page itself out of
main memory into extended or expanded memory before invoking a
child program. Once /X has been specified, it is remembered and
remains active every time the menus are used, until a /NX switch
is given to disable this feature. When paging to extended or
expanded memory, the text "USING EXTENDED/EXPANDED MEMORY" is
displayed on the error message line every time the menu program
is first executed.

"Extended memory" is contiguous memory above 1MB, which can be


directly accessed by an 80286/386/486 microprocessor. "Expanded
memory" is the older style add-on memory, which can be accessed
also by the 8086 and 8088 microprocessesors, and is paged in and
out of the 1MB memory area. Expanded memory is now less common and
not as efficient as extended memory.

The /X switch will not use additional memory unless the correct
memory management drivers have been loaded, usually by statements
in the CONFIG.SYS file. MS-DOS has HIMEM.SYS for extended memory,
and EMM386.EXE for expanded memory. Refer to your DOS user manual
for details. If there is no additional memory present, or the
memory manager has not been correctly loaded, the menu program
will page itself out to disk instead, which will be rather slow.
MENUS - Page 6

2.1 Logo screen


────────────────

When the menu program is first executed, the SAIA logo and copyright
notice screen is displayed. Pressing any key clears the screen and
displays the top-level menu. If a key is pressed while the menu
program is being loaded, the logo is not displayed.

┌──────────────────────────────────────────────────────────────────────────────────┐
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ████████████████████████████████████████████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ████████▀▀▀▀▀██▀▀ ▀████ ▀█████▀▀▀▀▀████████ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ████▀ █▌ ▐███ ████ ▀█████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ██▀ ▄▄██ ▄▄ ███ ███ ████ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ██ ▄█████▌ ▐██▌ ▐██ ██▌ ▐██ ▐███ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ██▌ ▐█████ ████ ██ ██▌ ███▌ ███ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ███ ▐████ ▐████ ██ ██ ████ ███ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ████ ████ █████ ██ ██ ████ ███ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █████ ▐███ █████ ██ ██ ████ ███ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ █████▌ ▐██ █████ ██ ██ █▀▀▀ ███ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ██████ ██ ▀███ ██ ██ ▐██ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ██████▌ ██ ██ ██ ▄▄██ ▐██ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▀▀██ ▐█ ███▄▄ ██ ██ ████ ▐██ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ██ █████ ██ ██ ████ ▐██ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ██▄▄ ▄██ █████ ██ ██ ████ ▐██ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ██████▄▄▄████ █████ ██ ██ ▄████▄▄▄▄███ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ██████████████▄▄▄█████▄▄▄▄▄██▄▄▄▄███████████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ │
│ ╔════════════════════════════════════════════════════════════════════════╗ │
│ ║ SAIA PCD PROGRAMMING UTILITIES PCD8.P3 V2.1 ║ │
│ ║ Copyright (C) SAIA-Burgess Electronics AG, 1987-1998 ║ │
│ ║ Written by Matt Harvey ║ │
│ ║ PRESS ANY KEY TO CONTINUE ║ │
│ ╚════════════════════════════════════════════════════════════════════════╝ │
│ │
└──────────────────────────────────────────────────────────────────────────────────┘

Once any key is pressed, the colour definition file PCDCOLOR.DAT


is read, and the main menu is displayed, with a "WAIT" message
prompt.

The menu data file PCDMENU.DAT, which should reside in the current
directory, is then read. This file contains all the information
that appeared in the menus the last time they were used. When the
menu program is exited (see "Quit" command, Section 4.1), all the
data and selections currently in the menus are written to this file.
If PCDMENU.DAT is not found, all the menu entry fields will be blank
and default switches selected. If the PCDMENU.DAT file is from an
older version of the utilities, program PCDCONV.EXE is called, which
attempts to convert the file to the new format.

The configuration data file "PCDSETUP.DAT", which is also usually


in the current directory, is then read. If not found, an error
message is displayed. This file is created by the configuration
program SCONFIG, invoked from "Configure" on the main menu.

Once PCDMENU.DAT and PCDSETUP.DAT have been read, the main menu
prompt is displayed, and the first menu function "Edit" is selected.
MENUS - Page 7

2.2 Use of directories


───────────────────────

For different configurations and/or different projects, the user


can have different configuration and menu data files in different
working directories.

If "PATH" and "SET PCD=" statements have been executed, usually from
the AUTOEXEXC.BAT file, the PCD Programming Utilities can be run
from any drive and directory.

The recommended procedure is to create a work or project directory


to contain all the source programs and listings etc. ALWAYS be in
a work directory when using the package. Do NOT work in the PCD
directory, otherwise a directory containing a confusing mixture of
PCD Progamming Utilities and user files is produced.

The PCD Programming Utilities use several special data files (.DAT).
These files are always created in the current directory (except for
PCDCOLOR.DAT which is only in the PCD directory).

PCDMENU.DAT stores all the information (file names, switch settings


etc.) which have been entered into the PCD menus. Whenever the PCD
menu program is run, it reads this file, restoring the menu settings
to the way they were the last time the menus were used. This file is
created on exit of the PCD Programming Utilities menus, when the
"Quit" command is executed.

PCDSETUP.DAT contains the printer set-up, the PCD memory mapping,


communications configuration etc. This is created in the current
directory by the configuration program SCONFIG.EXE. The PCDSETUP.DAT
file in the main PCD directory should contain the default set-up.
This default file is used if PCDSETUP.DAT is not found in the current
directory.

Other .DAT files may be used to store data for individual programs.
For example, SBUG.DAT stores the Debugger's "Refresh" window's
contents, so that it can be restored the next time Debug is run from
that directory.

The main advantage of using a separate directory for each of your


projects or programs is that you can have separate .DAT files for
each project or program. You will certainly want different file names
in the menus, and will probably use different PCD memory mapping etc.
MENUS - Page 8

3. GENERAL USER INTERFACE NOTES


════════════════════════════════

The following notes apply to all the utilities.

3.1 Screen layout


──────────────────

The screen is divided into four sections:

1) Line 1 is the title line, indicating the menu name. On the main
menu title line, the menu program version number is shown.

2) Lines 2-22 contain the menu entry fields and their accompanying
descriptions. All entry fields are highlighted to separate them
from other text on the screen. Lines 2-4 of the top level menu
are used to display the Registered User name.

3) Line 23 is the error message line. Error messages are displayed


in capitals, in intensified video, left justified, and are all
accompanied by a long beep. Error messages are cleared from the
screen when the next key is pressed.

4) Lines 24 and 25 are the prompt lines. These lines describe what
information is required and which keys are valid. The prompts may
change when the cursor is moved to another field on the menu.

3.2 Entry fields


─────────────────

Three types of input fields are used. When the cursor is on a field,
the entire field is always displayed in reverse video, indicating it
is the selected field. Movement from one field to another is by the
arrow or tab keys.

1) Select field

These appear on the main menu. They allow selection of a sub-


menu, program or operation, each field being a description of
the process. The selected field is highlighted in reverse video.
To select another field, the space bar can be used, as well as
tab or arrow keys. Pressing ENTER (carriage return) displays
the selected sub-menu or executes the program or operation.
Alternatively, each description contains one capital letter, the
command letter, displayed in bold video. This single command
letter key can be pressed to select the function directly.

2) Entry field

Numeric or text data, such as a file name or number can be input


into these fields. Only valid keys are accepted, invalid key
depressions are beeped. Full editing facilities are provided,
using the arrow, "Ins", "Del" and "<-" (backspace) keys.
Pressing the SPACE bar clears to the end of the field, and moves
the cursor to the next field.
MENUS - Page 9

Entry field continued:

If the entry field is for a file name, only valid DOS filename
characters are accepted. DOS file names consist of an optional
drive (e.g. A:, B:), a directory path, an file name of up to 8
characters and an optional 3-character file type. File name
entry fields allow file names of up to 128 characters to be
entered. If the file name is longer than the entry field, which
is indicated by < or > characters at the start or end of the
field, then the field can be scrolled left or right using the
left or right arrow, HOME or END keys. If no path name is entered,
it is assumed the file is in the curent directory (shown on the
main menu). If a file name ends in ".", no default extension is
appended. If an invalid file name is entered, an error message is
displayed when ENTER is pressed. Pressing function key F5 when the
cursor is in a file name entry field will display the pop-up
direcory window, allowing a file name to be chosen.

3) Switch field

This field is a muti-way switch, activated by pressing the SPACE


bar to select the switch position. These fields often have only
two positions "Yes" or "No".

3.3 Directory window


─────────────────────

Whenever the cursor is in a file name entry field, pressing function


key F5 displays a pop-up directory window containing all the file
names which match a default mask, or match the "wildcard" filename
entered in the field. Wildcard file names are drive or directory
names without a file name, or filenames which contain the "*" and
"?" wildcard characters ("*" matches any file name, "?" matches any
character). For example, if "*.SRC" is entered in the field, pressing
F5 displays a window containing all the ".SRC" files in the current
directory. If "C:\WORK" is entered, F5 displays all the files in
directory "C:\WORK".

The directory is displayed in a pop-up window, with the files sorted


by name. Subdirectories are displayed at the end, ended by a back-
slash "\". The last entry is the parent directory "..\". The names
can be viewed with the arrow, PgUp, PgDn, Home and End keys. If the
cursor is on a directory name, pressing Enter displays the contents
of that directory. A file name is selected by moving the cursor onto
the desired name then pressing Enter, the filename is then copied to
the filename entry field on the menu and the directory window is
closed. Pressing ESCape closes the window without chosing a file
name.
MENUS - Page 10

3.4 Help
─────────

Whenever the program is waiting for user input, function key F1


can be pressed to display the help screens. When on the top level
menu, the help index is displayed. When on a sub-menu, the help
screen relating to that menu is displayed.

The menus have a "hyper-help" system. A topic can be selected by


moving the cursor onto a high-lighted item, then pressing Enter.

These keys have special significance when displaying help:

F1 Returns to the help index.

F9, F10 F9 moves back to the previous help screen that was disp-
layed, F10 moves to the next help screen. A circular
buffer of the last 50 help screens is stored, F9 and F10
can be used to retrace the help path.

PgUp,PgDn Displays the help screens in the order in which they are
catalogued. Some help items have more than one screen,
indicated by --PgDn->, pressing PgDn displays the next
page, PgUp displays the previous page.

Home,End Moves the cursor to the first or the last highlighted help
item on the screen.

Arrows Move the cursor to select a highlighted help item. Pressing


Enter displays the help screen of the selected item.

ESCape Exits help, and returns to the menu.

*** NOTE ***

Help texts are stored in the file PCD.HLP, this file contains binary
index data and CANNOT be printed.
MENUS - Page 11

4. MENUS
═════════

4.1 Main Menu


──────────────

From this screen all the sub-menus and programs can be selected.

The display shows the current disk and directory name, the date and
time, and the registered user's name.
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD PROGRAMMING UTILITIES V2.1 MAIN MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ ╓────────────────────────────────────────────────────────────────────────────┐ │
│ ║ SNORELOUDER BEDS LIMITED, SLEEPY STREET, SNOOZEVILLE │ │
│ ╚════════════════════════════════════════════════════════════════════════════╛ │
│ Directory: C:\PCD\PILLOWS 25/01/88 15:45 │
│ │
│ │
│ ┌──────┐ │
│ │ Edit │ Graftec File handling │
│ └──────┘ │
│ Assemble View program Word processor │
│ │
│ Link Resource tables Ms-dos command │
│ │
│ Debug dOcumentation coNnect │
│ │
│ Up/download dIsassemble Configure │
│ │
│ Program eproms Transfer data Quit │
│ │
│ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ ARROW, SPACE or TAB selects, ENTER or capital Command letter executes. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The first function "Edit" is shown selected, it is highlighted with


a reverse video cursor. Other functions can be selected by using
the arrow, tab or space keys. Pressing ENTER, or the capital
command letter in the function description calls the sub-menu or
executes the program.
MENUS - Page 12

Main menu functions:


───────────────────

Edit Selects the Editor sub-menu, see section 4.2.

Assemble Selects the Assembler sub-menu, see 4.3.

Link Selects the Linker sub-menu, see 4.4.

Debug Loads and executes program SBUG.EXE, for


debugging (testing) a program.

Up/download Loads and executes program SLOAD.EXE, for


loading or saving programs in the PCD.

Program eproms Loads and executes program SPROM.EXE, for


programming EPROMs (electically programmable
read-only memories), or generating HEX files.

Graftec Selects the Graftec editor sub-menu, see 4.5.

View program Loads and executes program SVIEW.EXE.

Resource tables Selects Resource Table and FB Parameter List


sub-menu, see 4.6.

dOcumentation Selects Documentation Generator sub-menu, see


section 4.7.

dIsassemble Selects the Disassembler sub-menu, see 4.8.

Transfer data Loads and executes program SDAT.EXE. Can up or


download the state or Flags, Registers, Counters
etc.

File handling Loads and executes program SFILE.EXE. Can copy,


erase, display, print a file etc.

Word processor Loads and executes any text editor or word


processor, as defined from the "Configure" menu.

coNnect Selects the on-line communications mode, a CPU


or station number on a network, and also has a
dialler and "phonebook" for use with modems.
See section 4.10.

Ms-dos command Allows operating system commands to be executed


without exiting the PCD menus, see 4.9.

Configure Loads and executes program SCONFIG.EXE, for


configuring the package.

Quit Saves all menu data in file PCDMENU.DAT and


exits to DOS. Before this is done, the user is
prompted "Exit to DOS (Y or N) ?". If "Y" is
pressed, a return is made to DOS.
MENUS - Page 13

4.2 Editor Menu


────────────────

This menu has a single entry field, the name of the file to be
edited:
┌────────────────────────────────────────────────────────────────────────────────┐
│ EDITOR MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ ┌─────────────────────────────────────────────┐ │
│ Name of file to edit (.SRC) │ ___________________________________________ │ │
│ └─────────────────────────────────────────────┘ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=directory), ENTER executes, ESC exits. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The file name field accepts a drive and path name, with optional
extension ".ext", the default file extension is ".SRC".

When ENTER is pressed, the screen is cleared and the editor is


invoked. The editor which is loaded is defined from the "Configure/
Editor program names" menu.
MENUS - Page 14

4.3 Assembler Menu


───────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD MACRO ASSEMBLER MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ ┌────────────────┐ │
│ File(s) to assemble (.SRC) │ ______________ │______________ ______________ │
│ └────────────────┘ │
│ ______________ ______________ ______________ │
│ │
│ ______________ ______________ ______________ │
│ │
│ │
│ │
│ Object file . . . . . (.OBJ) Yes Use temporary files . . . . No │
│ │
│ Listing . . . . . . . (.LST) No Abort assembly on 1st error No │
│ │
│ Cross-reference list . . . . No │
│ │
│ Expand macros in listing . . Yes │
│ │
│ Listing to printer . . . . . No │
│ │
│ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=dir), ARROW or TAB moves cursor, ENTER executes, ESC exits.│
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

File(s) to assemble:

Enter the name of one or more source files to be assembled,


with an optional drive name. Up to nine files can be assembled.
The default file extension is ".SRC", ".DSR" files can also be
assembled. When ENTER is pressed, each of the file names is
checked, and if it doesn't exist an error message is displayed
and the cursor is placed over the suspect file name.

Yes/No switches can be set to control assembly, when the cursor is


one of these fields, the prompt is:
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ SPACE to change (Yes/No), ARROW or TAB moves, ENTER executes, ESC exits. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘
MENUS - Page 15
Assembler menu continued
────────────────────────

Object file switch:

If "Yes", object files are created. If "No", then no object files


are created. Note that if there are assembly-time errors on a
source file, then no object file is created for that file anyway.
The object file names are the SRC file names with extension ".OBJ",
and are always created in the current directory.

Listing switch:

If "Yes" a listing is produced, if "No", there is no listing.


Producing a listing slows the assembly process considerably. If
the "Listing to printer" switch is "Yes" then the listing is sent
to the printer as the file is assembled. Otherwise, a listing
file with extension ".LST" is created in the current directory.
A listing is produced regardless of assembly-time errors, and
contains the error messages showing exactly where the errors
occurred.

Cross-reference list switch:

If "Yes", a cross-reference list (which is also the symbol table)


is appended to the listing. If "Listing" is "No", the listing is
still produced, but it contains only the cross-reference list.

Expand macros in listing switch:

If "Yes", any macros used are expanded into their full source
code in the listing. If "No", the code generated by the macros
is not listed.

Listing to printer switch:

If "Yes", the listing and/or cross reference list, if produced,


are sent to the printer. The printer initialization and deinit-
ialization strings (defined from the "Configure/Printer" menu)
are sent to the printer.

Use temporary files switch:

When "Yes", temporary work files are used by the assembler


instead of storing data in memory. This allows much larger files
(e.g. > 5000 lines) to be assembled, and is particularly useful
when using large include files containing macros. Assembly time
is increased unless a good disk cache program such as SMARTDRV
is being used.

Abort assembly on 1st error switch:

If "Yes", assembly is stopped on the first error.

After entering the file names and setting the switches, pressing
ENTER begins the assembly process. If the menu contains the name of
a non-existent file, or listing is to the printer which is not ready,
an error message is displayed, and the cursor is placed on the bad
field. The assembler is not invoked until everything is correct.
If there are no problems, the screen is cleared, and the assembler
SASM.EXE is invoked. SASM then outputs its messages to the screen.
When all the files have been assembled, the following prompt is
displayed, pressing any key returns to the main menu:
├────────────────────────────────────────────────────────────────────────────────│
│ OPERATION COMPLETE: Press any key to continue _ │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

If the assembler detected an error in a source file, the message


"WARNING: ERROR(S) OCCURRED" is displayed, accompanied by a beep.
MENUS - Page 16

4.4 Link/Make Menu


───────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD LINK/MAKE MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ ┌──────────┐ │
│ File(s) to link (.SRC/.OBJ) │__________│ __________ __________ __________ │
│ └──────────┘ │
│ ╓──── "MAKE" FEATURE ────┐ __________ __________ __________ __________ │
│ ║ All SRC files, or only │ │
│ ║ the changed files, can │ __________ __________ __________ __________ │
│ ║ now be assembled from │ │
│ ║ this menu by setting │ __________ __________ __________ __________ │
│ ║ the "Assemble" switch. │ │
│ ║ Enter all the SRC file │ __________ __________ __________ __________ │
│ ║ names on the right. │ │
│ ╚════════════════════════╛ __________ __________ __________ __________ │
│ │
│ │
│ Absolute object file (.PCD) ______________ Assemble Changed files │
│ │
│ │
│ Map . . . . . . . . . . (.MAP) Yes Sort map symbols by Symbol name │
│ │
│ Map to printer . . . . . . . No Check Bloctec/Graftec No │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=dir), ARROW or TAB moves cursor, ENTER executes, ESC exits.│
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

File(s) to link:

Up to 24 object files can be assembled and linked from the menu


(the linker allows up to 75 files to be linked if invoked from
DOS). Enter the source and/or object file names to be assembled
or linked. When ENTER is pressed, the names are checked. If a
file does not exist, an error message is displayed and the cursor
is placed over the offending name.

Absolute object file name:

The name of the executable file created by the linker can be


given. If this field is left blank, the default file name used
is the name of the first file linked, with extension ".PCD". If
a file name with no extension is entered, the default extension
".PCD" is used.

Assemble switch:

The corresponding .SRC files from the "File(s) to link" list can
be assembled before linking if required. The switches from the
"Assemble" menu are used. The "Assemble" switch has three options:

No files No files are assembled, only the link operation


is done.
Changed files All modified .SRC files are assembled, or files
containing modified $INCLUDE files. Files are
assembled if its date is more recent than that
of the corresponding .OBJ file. Include file's
dates are also examined.
All files All .SRC files are assembled, regardless of
their modification dates.
MENUS - Page 17

Linker menu continued


─────────────────────

Map switch:

If "Yes" the link map is created. If written to a file (see "Map


to printer" switch below), this file has the file name of the
absolute object file, with extension ".MAP".

Map to printer switch:

This switch determines where the link map is sent. If "Yes", it


is sent to the printer. If "No" it is written to the ".MAP" file.
Note that a .MAP file is required by the documentation generator.

Sort map symbols switch:

This can be "Symbol name" or "Type and value". The MAP file
contains a list of global symbols. This list can be sorted either
by symbol name or by the symbol's type and value. NOTE: If any
foreign characters are used in symbol names, they may not be
sorted correctly because of their non-standard ASCII codes.

Check Bloctec/Graftec:

When "Yes", the Bloctec and Graftec structure of the program is


checked. All Function Block (FB) parameters (FBs) are checked
validity where they are used in the relevant Function Blocks,
and the Graftec step/transition structure is verified. This is
done by calling another program called SFBREF.EXE to do the checks.
The checks are not done unless the linkage was successful. See
the SFBREF Functional Specification for details of the detectable
errors. SFBREF can also be invoked from the "Resource tables" menu
to generate an FB parameter cross-reference list. If "No", then
some invalid FB parameters may not be detected, and the Graftec
structure is not fully checked.

When ENTER is pressed, if the "Assemble" option is not "No files",


then the relevant .SRC files are assembled. If a required .SRC or
.OBJ file doesn't exist, an error mesage is displayed and the cursor
is placed over the file name. If all .OBJ files are present, an
indirect command file named "SLINK.TMP" is created in the current
directory, the menu is cleared and linker program "SLINK.EXE" is
invoked. SLINK then reads commands from the SLINK.TMP file. Once
linkage is complete, SLINK.TMP is deleted. SFBREF is also executed
if FB parameter reference checks are required. Finally, the
"Operation complete: Press any key to continue" prompt is displayed.
Pressing any key returns to the main menu.

If the linker detected an error, the message "WARNING: ERROR(S)


OCCURRED" is displayed, accompanied by a beep.
MENUS - Page 18

4.5 Graftec Menu


─────────────────

This menu has a single entry field, the name of the Graftec source
file to be edited:

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD GRAFTEC MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ ┌──────────────────────────────────────────┐│
│ Name of Graftec source file (.SRC) │ ________________________________________ ││
│ └──────────────────────────────────────────┘│
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=directory), ENTER executes, ESC exits. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The default file name extension is ".SRC".

When ENTER is pressed, the screen is cleared and the Graftec editor
program SGRAF.EXE is invoked. Refer to the Graftec Functional
Specifications for details.
MENUS - Page 19

4.6 Resource Table Menu


────────────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD RESOURCE TABLE AND FB PARAMETER LIST MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ │
│ File to process . . . . . . (.PCD) _______________________________________ │
│ │
│┌──────────────────────────────────────────┬───────────────────────────────────┐│
││ Create Resource Table . . . . . . Yes │ Resource Table to printer No ││
│├──────────────────────────────────────────┘ ││
││ Resource Table file name . (.RES) _______________________________________ ││
│├────────────────────────┐ ││
││ All resources Yes │ Numeric tables Yes Graphic tables Yes ││
││ └─────────────────────────────────────────────────────││
││ ││
││ Inputs & Outputs Yes Timers & Counters Yes Constants Yes ││
││ Flags Yes Texts & Data Blks Yes Code blocks Yes ││
││ Registers Yes Semaphores Yes Special instructions Yes ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
│┌──────────────────────────────────────────┬───────────────────────────────────┐│
││ Create FB Parameter Reference List Yes │ Parameter List to printer Yes ││
│├──────────────────────────────────────────┘ ││
││ FB Parameter List file name (.FBR) ______________________________________ ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=dir), ARROW or TAB moves cursor, ENTER executes, ESC exits.│
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

This menu invokes both the Documentation Generator (SDOC.EXE) and/or


the FB Parameter Referencer (SFBREF.EXE).

File to process (.PCD):

This is the name of the absolute object file from which the
resource table or FB parameter reference list will be generated.
It must be a valid absolute object file (.PCD or .UPL). The
default file extension is .PCD.

Create Resource Table switch:

If "Yes", the resource table is created from the ".PCD" file and
all switches in the resource table box become active. If "No",
no resource table is created.

Resource Table file name (.RES):

The name of the resource table file. This is ignored if the


output is to the printer. If this field is empty, the default
output file name is the input file name with default extension
".RES". If a name without an extension is given, ".RES" is used.

Resource table to printer switch:

If "Yes", the resource table is printed as it is created. No


disk file is written. This is ignored if "Create Resource Table"
is "No".
MENUS - Page 20

Resource table menu continued


─────────────────────────────

Create Resource Table switch:

If "Yes", a Resource Table is created, if "No", no resource


table is created.

All resources switch:

If "Yes", the resource controls (on the next 3 lines of the menu)
are ignored. This switch has the same effect as setting all the
resource controls to "Yes".

Numeric tables switch:

If "Yes", the numeric format resource tables are produced, if


"No", they are not. Refer to the Resource Table Generator
Functional Specification for details.

Graphic tables switch:

If "Yes", the graphical format Resource Tables are produced, if


"No", they are not. Refer to the Resource Table Generator
Functional Specification for details.

Resource control switches (Inputs, Outputs, Flags, Registers etc.):

If the "All resources" switch is "No", these switches determine


which element types are listed in the table. If "Yes", this
element is listed, if "No" the element is ignored. For example,
if all resource control switches are "No" except "Numeric tables"
and "Inputs", and the "All resources in table" switch is also
"No", then the resource table will contain only inputs, listed in
numeric format.

Create FB Parameter Reference List switch:

If "Yes", an FB parameter cross-reference list is also created.

Parameter List to printer switch:

If "Yes", the FB parameter cross-reference list is output to the


printer, no file is produced. This is ignored if the "Create FB
Parameter Reference List" switch is "No".

FB Parameter List file name (.FBR):

The name of the FB parameter cross-reference list file. This is


ignored if the output is to the printer. If this field is empty,
the default output file name is the input file name with default
extension ".FBR". If a name without an extension is present,
".FBR" is used.

When data has been entered in the menu, pressing ENTER clears the
menu and invokes either the resource table generator "SRES.EXE",
and/or the FB parameter reference list generator "SFBREF.EXE". When
processing is complete, the "OPERATION COMPLETE: Press any key to
continue" prompt is displayed, pressing any key returns to the main
menu.
MENUS - Page 21

4.7 Documentation Generator Menu


─────────────────────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD DOCUMENTATION GENERATOR MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ NOTE: This requires the .MAP file produced when the source files were linked. │
│ │
│ MAP file name . . . . (.MAP) ___________________________________ │
│ │
│ Source file(s) . . . (.SRC) ______________ ______________ ______________ │
│ │
│ ______________ ______________ ______________ │
│ │
│ ______________ ______________ ______________ │
│ │
│ ______________ ______________ ______________ │
│ │
│ │
│ Documentation comment type User OR Automatic comments │
│ │
│ List blank lines . . . . . . No List LD values in binary No │
│ List source line numbers . . No │
│ List EQU & DEF statements . No Use temporary file . . . No │
│ List Graftec parameters . . No Documentation to printer No │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=dir), ARROW or TAB moves cursor, ENTER executes, ESC exits.│
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

MAP file name:

Enter here the name of the map file (produced by the linker)
which contains the list of files linked, start addresses, global
symbols etc. File extension ".MAP" is automatically used.

Source file(s):

Enter here the names of the source files for which documentation
modules are to be generated. File extension ".SRC" is automatic-
ally used. These files must be files whose object files were
linked to produce the .MAP file entered above. If not, a fatal
error occurs.

Documentation comment type:

If the source files were created using SEDIT, two comments may
be available for each program line. This switch selects which
comments appear in the documentation:

User OR automatic comments


User comments only
Automatic comments only
User AND automatic comments
MENUS - Page 22
Documentation generator menu continued
──────────────────────────────────────

List blank lines switch:

When "Yes", blank lines in the .SRC file are listed as normal.
This may spoil the documentation format, because EQU, DEF and
DOC statements may be being removed, and all $INCLUDEs, macros
and false conditional statements are removed, but the blank
lines which were used as spacing between these statements will
not be removed. This produces blank areas in the documentation.

To solve this problem, set the "List blank lines" switch to "No".
However, this also removes blank lines which may be needed, so
instead of using blank lines for spacing, use empty comment lines
which are not removed. For example:
; <──┬─ empty comment lines for spacing
; This is a comment │
; <──┘

List source line numbers switch:

When "Yes", the source file line numbers are included in the
documentation files.

List EQU/DEF statements switch:

If "Yes", EQUate, DEFine and DOCumentation statements are listed,


if "No", these are removed.

List Graftec parameters switch:

If "Yes" the incoming and outgoing parameter lists for step (ST)
and transition (TR) instructions are listed. If "No", these
parameter lists are removed.

List LD values in binary switch:

The LD and LDX instruction loads a 32-bit value into a register.


To show this value in binary in the DOC file, set this switch
to "Yes". In this case, the symbol name is lost because the
32-character binary value overwrites it. If "No", then binary
values greater than 12 bits are shown in Hexadecimal.

Use temporary file switch:

When creating documentation for very large source modules,


containing many automatic comments, an "OUT OF MEMORY" error may
occur. If this switch is set to "Yes", then automatic comments
are saved in a temporary file instead of in memory. If "No", then
automatic comments are saved in memory. The "TEMP" environment
string defines the directory used for the temporary file.

Documentation to printer switch:

If "Yes", output is to the printer. If "No", output is to files


with extension ".DOC".

When data has been entered in the menu, pressing ENTER clears the
menu and invokes the documentation generator "SDOC.EXE". Once
the documentation is complete, the "OPERATION COMPLETE: Press any key
to continue" prompt is displayed, pressing any key returns to the
main menu.
MENUS - Page 23

4.8 Disassembler Menu


──────────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD DISASSEMBLER MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ │
│ ┌───────────────────────────────────────┐ │
│ File to disassemble (.UPL or .PCD) │ _____________________________________ │ │
│ └───────────────────────────────────────┘ │
│ │
│ Listing or source format output . . Listing │
│ │
│ Output to printer . . . . . . . . . No │
│ │
│ Output file name . . (.DLS or .DSR) _____________________________________ │
│ │
│ │
│ Disassemble code/text/extension mem. Entire file │
│ │
│ Code start line . . . . . . . (0) 0_____ │
│ │
│ Code end line . . . . . . (999999) 999999 │
│ │
│ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ Enter file name (F5=dir), ARROW or TAB moves cursor, ENTER executes, ESC exits.│
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Converts an absolute object file (".UPL" or ".PCD") back to source


or listing format files. It is the reverse of the assemble/link
process. Because the UPL or PCD file does not contain any symbol
names or comments, these do not appear in the disasssembled files.
Source format files ".DSR" can be re-assembled or edited with SEDIT.
Listing format files ".DLS" contain program line numbers, and cannot
be assembled or edited with SEDIT.

Absolute object file to disassemble:

This must be the name of a file uploaded from the PCD (.UPL) or
created by the linker (.PCD). If no extension is entered, the
default is ".UPL".

Listing or source format output:

If "Listing", the output of the disassembler is a paginated


listing similar to the assembler listing, the output file has
extension ".DLS". If "Source", the output is a source format
file without pagination, with extension ".DSR", this file can
be re-assembled.
MENUS - Page 24

Disassembler menu continued


───────────────────────────

Output to printer:

If "Yes" the output is sent to the printer. If "No", an output


file is created.

Output file name:

If the output is to a file, the name of the file produced can be


entered here. If blank, the default file name is that of the
input file, with the default extension. This field would normally
be left blank. The default file extensions are ".DLS" if listing
format output, ".DSR" if source format output.

Disassemble code/text/extension mem:

It is possible to disassemble only the code, or only the text or


only the extension memory segments, or combinations of these.
This makes it possible to produce several smaller files from one
large ".PCD " file (the "Code start and end line" parameters
can also be used to split the file into even smaller files).

Entire file (all segments)


Code only
Text only
Extension memory only
Text and Extension memory

Code start and end line:

These define a section of the code in the file to be disassembled.


If the file is very large, smaller sections of the code can be
disassembled into separate .DSR or .DLS files. Disassembling a
large .PCD or .UPL file would otherwise create huge files, which
may be so large that they cannot be edited or assembled.

When data has been entered in the menu, pressing ENTER clears the
menu and invokes the disassembler "SDISASM.EXE". Once disassembly is
complete, the "OPERATION COMPLETE: Press any key to continue" prompt
is displayed, pressing any key returns to the main menu.
MENUS - Page 25

4.9 Ms-dos Command Menu


────────────────────────

From this menu, any program can be executed without exiting the PCD
menus.

The menu shows the DOS version number and the DOS prompt. The prompt
is shown with two ">>" characters to distinguish it from the actual
DOS prompt.

Any command line of up to 120 characters can be entered. Simple


editing of the command can be done using the HOME, END and DELETE
keys. The HOME key clears the entire line.

The up and down arrow keys can be used to recall any commands that
were previously entered, so that they can be edited or re-executed.
The last 10 commands are buffered. The very last command entered is
saved in the PCDMENU.DAT file on exit of the menus, and is available
next time the menus are run by pressing the up or down arrow key.

Pressing ESCape, or pressing ENTER on an empty line, returns to the


main menu.
┌────────────────────────────────────────────────────────────────────────────────┐
│ MS-DOS COMMAND MENU │
├────────────────────────────────────────────────────────────────────────────────│
│ │
│ IBM Personal Computer DOS V3.30 │
│ │
│ To return to the menu press ESCAPE or press ENTER on an empty line. │
│ Recall previous commands with up/down arrow. HOME clears the command. │
│ │
│ C:\FRED>>LAST COMMAND_ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────┘

*** WARNING ***

If the current directory is changed by using the "CD" or "CHDIR"


commands, then the menu data and configuration files (PCDMENU.DAT
and PCDSETUP.DAT) are re-read from this new directory. PCDMENU.DAT
is NOT saved in the old directory first, so data entered in the
current menus is lost.
MENUS - Page 26

4.10 Connect Menu


──────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
│ CONNECT MENU │
├────────────────────────────────────────────────────────────────────────────────│
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ This menu selects the communications mode and makes the on-line connection ││
│║ to a PCD. PGU mode connects directly to a local PCD's PGU port. S-BUS mode ││
│║ connects to a station on an S-BUS network. Use S-BUS MODEM for modems, and ││
│║ enter a telephone number for public-line (dial-up) modems or leave it blank ││
│║ for private-line modems. For a PCD4, select the CPU number (0 or 1). ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ ┌─────────┐ │
│ Action, press SPACE to select │ CONNECT │ │
│ └─────────┘ │
│ │
│ │
│ S-BUS station number (0..253) 0__ │
│ │
│ │
│ Number to dial (F2=Phonebook) 010-41-37-727354__________________________ │
│ │
│ │
│ Communications mode . . . . . S-BUS MODEM: COM2, 9600 BAUD │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────│
│ SPACE selects action, ARROW or TAB moves, ENTER executes, ESC aborts. │
│ F3=S-BUS F4=Download S-BUS F5=Serial ports F6=Modem F7=PCD type F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

This menu has three commands. The CONNECT command attempts to connect
to the PCD and displays an error message if it fails. The HANG UP and
AUTO-ANSWER MODE commands are for use with public-line (dial-up)
modems, and are only available if S-BUS MODEM mode is selected. The
modem type is defined from the "Configure/Modem for PC" menu. Each
command is described in detail delow.

The menu selects the communications mode which will be used when
communicating with a PCD:

PGU For a local connection directly to a PCD's PGU port


or the PCD6's PCD8.P800.
S-BUS For direct connection to a serial port on a PCD
which is configured to run in S-BUS slave mode, or
via a local S-BUS network.
S-BUS MODEM Used for connection via a modem: If a telephone
number is entered in the "Number to dial" field,
then a public-line (dial-up) modem is assumed, if
there is no telephone number then a private-line
modem is assumed.

If the selected PCD processor type is a PCD4, then a CPU number (0


or 1) can be selected because the PCD4's CPUs 0 or 1 are software
selectable. The PCD type is defined on the "Configure/Hardware and
memory" menu, press function key F7.
MENUS - Page 27

Connect menu continued


──────────────────────

Serial ports and baud rates are defined on the "Configure/Serial


ports for PC" menu, press function keys F5.

These short-cut function keys can be used for configuration:

F3 = Configure S-BUS
F4 = Download S-BUS (runs SDNLD /S)
F5 = Configure serial ports
F6 = Select modem
F7 = Select PCD type

Function key F3 allows the PCD's S-BUS configuration to be edited.


This can be downloaded into the connected PCD by pressing function
key F4. The CONNECT command must be executed first, to ensure you
are connected to the correct PCD.

WARNING: Downloading the S-BUS configuration resets all CPUs in the


connected PCD. Outputs are cleared and CPUs put into Run according
to the RESET OPTIONS shown on line 25, set by the Debug program's
"File set-load-Options" command.

If using the utilities from the DOS prompt, the SCONNECT program
can be used to select a communications mode, CPU, S-BUS station,
COM port and baud rate. See section 4.10.2.

CONNECT

This command attempts to connect to the PCD. Once connected, all


subsequent on-line operations will use this connection. If using
S-BUS MODEM and a telephone number has been entered in the "Number
to dial" field, then CONNECT will first dial and connect to the
remote modem. Press ESCape to abort dialling. The telephone number
can contain any characters supported by the modem. The telephone
number can be chosen from a user-editable Phonebook file by pressing
function key F2 when the cursor is in the "Number to dial" field.
The control strings defined by the "Configure/Modem for PC" menu
(in the MODEM.DAT file) are used to control the public-line modem.
If the "Number to dial" field is blank, then a private-line modem
is assumed.

If using S-BUS, and the entered station number does not respond, a
"read station number" telegram is broadcast. If only one station
exists, it will be connected and the correct station number will be
displayed. This is useful if the station number is unknown. If more
than one station replies, an "INVALID RESPONSE" error occurs, and
the correct station number must be entered.

If the PCD is password protected, a pop-up window is displayed and


the password can be entered, see section 4.10.3.
MENUS - Page 28

Connect menu continued


──────────────────────

HANG UP

If CONNECT for a public-line modem has been successful and the


telephone is still "off the hook", then this command disconnects
from the remote modem and hangs up. If the PCD was in AUTO-ANSWER
MODE, and a remote modem is still connected, this command can be
used to hang up and put the local modem out of auto-answer mode.
HANG UP is executed automatically if the utilities are exited with
the "Quit" command. The HANG UP command does not work for private-
line modems.

AUTO-ANSWER MODE

This command is for use with a public-line (dial-up) modem. It puts


the PC's modem into auto-answer mode so that it waits for an incoming
call from a remote SAIA PCD. The selected modem's "AnswerOn" and
"AnswerOff" strings in file MODEM.DAT are used. The remote PCD must
contain a user program which can dial and connect to the PC's modem
at the operator's request. An example dialler program can be found
in PCDDIAL.SRC. Auto-answer mode is typically used for remote debug/
control sessions where the remote site must bear the cost of the
telephone call.

When an incoming call is answered, the software tries to determine


the S-BUS station number of the remote PCD, and then connects to
this station. If it fails, it retries using the station number
entered on the menu. If this also fails, the remote modem remains
connected, but the user must enter the correct station number and
re-execute the CONNECT command. Once connected to the remote PCD,
the on-line utilities can be used in the usual way.

To disconnect the remote modem and hang up, either put the modem
back into auto-answer mode again, or execute a HANG UP command.

*** NOTE: HAYES COMPATIBILITY ***

If a modem is connected to a remote PCD, the PCD resets the modem


with this string: "ATZ\r", followed 3 seconds later by the init-
ialization string which sets it to "auto answer" mode. By default
this is "ATM0E0S0=2S25=250". Some "Hayes compatible" modems are not
fully compatible, and this command may fail. It is usually the
"S25=250" which fails, S-register 25 must configure "DTR change
detect time" in milliseconds (250ms is required). This string can be
re-defined from the "Configure/Modem for SAIA PCD" menu.
MENUS - Page 29

4.10.1 The Phonebook


─────────────────────

With the cursor on the "Number to dial" field of the "coNnect" menu,
pressing function key F2 displays the phonebook window. This is a
list of up to 300 telephone and S-BUS station numbers, read from the
user-editable PHONES.DAT file. A number is chosen from this list by
selecting it with the cursor keys, then pressing ENTER. ESCape aborts
the selection.

Phonebook File:

This file (PHONES.DAT) can be found in the current directory or the


PCD Programming Utilities directory. It can be edited with any ASCII
text editor. Each telephone number begins at the start of the line,
can contain any characters supported by the modem, and is terminated
by a space or carriage return. An optional station number (0..253)
can follow, separated from the telephone number by one or more
spaces. Further characters on the line are ignored (comments). The
entire line, including the comments, is displayed in the phonebook
window. The file can contain up to 300 numbers. For example:

;number station comment ';' indicates a comment line

010-41-37-123456 12 Station 12
0,71422 0 Internal number, ','=2 second delay
MENUS - Page 30

4.10.2 SCONNECT Program


────────────────────────

If running on-line programs such as SDNLD and SUPLD from the DOS
prompt or from a batch file, program SCONNECT.EXE can be used to
select a communications mode, S-BUS station and a CPU. It replaces
the "coNnect" menu, but does not provide dial-up MODEM support.

It either selects an S-BUS mode and connects to a given station and


CPU, or selects PGU mode and a CPU (e.g. CPU 1 on a PCD4). Some
programs (e.g. SBUG) have their own connect commands, other programs
are connected either using this program or by the "coNnect" command
on the main menu.

The default serial ports, baud rates and S-BUS timing are defined
from the "Configure/Serial ports for PC" menu (read from file
PCDSETUP.DAT).

SCONNECT updates the PCDMENU.DAT and PCDSETUP.DAT files in the


current directory.

Usage:

SCONNECT station [cpu] [switches]

Where:

station 0..254 = S-BUS station number ┬─ Selects S-BUS mode


255 = Read station number ┘
PGU = Selects PGU mode

cpu Optional CPU number: 0..6, default = CPU 0

switches Optional switches:

/S0 = S-BUS Break mode S0 ┬─ S-BUS only


/S1 = S-BUS Parity mode S1 │
/S2 = S-BUS Data mode S2 ┘
/COMn = Use COM port n (1..4) ┬─ Updates file PCDSETUP.DAT
/COM104 = PC/104 communications │
/110../38400 = Baud rate ┘
/Ppassword = Remove password protection
MENUS - Page 31

4.10.3 Password protection


───────────────────────────

PCDs with the latest firmware (PCD2 V003, PCD4 V005, PCD4.M4 V001,
PCD6.M5 V004, PCD6 V007) now have a password protection mechanism.

When protected by the password only reduced protocol communications


can be used. This allows access only to Registers, Timers, Counters,
Inputs and Outputs and the clock. The user program and all other
data cannot be accessed unless a valid password is entered.

Password protection is restored either by entering an invalid


password with SBUG's "Write passWord" command, or by the PCD's
"inactivity timeout". The inactivity timeout can be set to between
1 and 60 minutes. This automatically restores the password protection
if no telegrams are received by the PCD within this period.

Whenever one of the SAIA PCD Programming Utilities online programs


is run, a pop-up window is displayed if the PCD is password protected.
This prompts for entry of the password, so that password protection
can be removed. To skip password entry, press ESCape, this causes
a reduced p[rotocol connection to be made and all protected online
commands will produce a "command not accepted by PCD" error.

╔══════════════════════════════════════════════════╗
║ ONLINE PASSWORD PROTECTION IS ACTIVE ║
║ ║
║ Enter password: _________________________ ║
║ ║
║ Press ENTER to continue, ESC for reduced access. ║
╚══════════════════════════════════════════════════╝

The password is defined either using SBUG's "Write passWord" command


if using RAM memory, or from SPROM's "F7=Password" screen if prog-
ramming EPROMs.
MENUS - Page 32

5. ERROR HANDLING
══════════════════

All DOS error handling is disabled by the menu program, this


disables the "Abort, Retry or Ignore ?" prompt which is displayed
by the DOS error handler. This means that any disk or printer
errors are handled immediately by any programs invoked from the
menus, which display an error message and abort.

(If these programs are run directly from DOS, DOS error handling is
not disabled, and the "Abort, Retry or Ignore ?" prompt IS used to
handle errors (allows the use of these programs in a batch file).)

5.1 Error Messages


───────────────────

Error messages are displayed in bold video, left justified, on line


23. All messages are accompanied by a long beep.

WARNING: ERROR(S) OCCURRED

The program which has just been executed from the menu
detected some errors, for example the assembler detected
syntax errors. This notifies the user the operation failed,
even if the error messages have scrolled off the screen.

ERROR 0: CAN'T OPEN FILE: <filename>

The file does not exist in the current directory (if reading),
or the file cannot be created because the drive is not ready,
or the disk or directory is full (if writing).

ERROR 1: NO FILENAME ENTERED

A file name is required.

ERROR 2: PRINTER NOT READY

Printer output has been selected and the printer is not


connected, is powered off or is out of paper.

ERROR 3: CAN'T RUN PROGRAM: <program name>

The program cannot be loaded and executed, either because it


cannot be found, or because there is not enough free memory
for it to be loaded. Ensure that "PATH=" statement indicates
the directory containing the PCD Programming Utilities, see
the installation instructions in README.TXT, and your DOS
manual. Free up memory by removing memory-resident programs
such as SHELP and Norton Commander.
NOTE: SHELP cannot be run from the "Ms-dos command" menu.

ERROR 4: WRITE ERROR ON FILE: <filename>

This error occurs if the disk or directory is full, the disk


is not ready, has not been formatted or is write-protected.
If this occurs on exit (Quit command), the user is prompted
to "Retry or Abort (R or A) ?", allowing recovery.
MENUS - Page 33

Error messages continued


────────────────────────

ERROR 5: PCDSETUP.DAT NOT FOUND OR INVALID

Check that "SET PCD=d:\path" has been used to correctly


indicate the PCD Programming Utilities directory, and that
it contains the PCDSETUP.DAT file from distribution diskette 1.

ERROR 6: COMMAND.COM NOT FOUND, OR NOT ENOUGH MEMORY

To execute an DOS command from the menu, the DOS command


processor COMMAND.COM must be loaded. This error occurs if
COMMAND.COM can't be found, or if there's not enough memory
left to load both COMMAND.COM and the program to be executed.

ERROR 7: NO OPERATION SELECTED

When on the "Resource tables" menu, at least one of the two


operations (Create Resource Table or Create FB Parameter
Reference List) must be selected.

ERROR 8: INVALID FILE NAME

The entered file name is not a valid DOS file name or


attempts to access a non-existant drive. Re-enter the file
name. Use function key F5 to display the directory.

ERROR 9: OUT OF ENVIRONMENT SPACE

The "environment" is an area of memory used by DOS to hold


configuration information such as the PATH and SET variables.
The PCD menus use the environment for passing data to and
from programs which are invoked from the menus. If there is
not enough space left in the environment to pass the data,
menu settings (which are normally remembered) will be lost.
The environment space can be increased by removing unwanted
directories from the PATH, or removing SET variables, or by
placing a SHELL command in your CONFIG.SYS file:

SHELL C:\COMMAND.COM /E:4096 /P

(Sets environment space to 4K)

ERROR 10: INVALID CPU NUMBER

The PCD2 and PCD6.M5 have one CPU (0), the PCD4 can have two
CPUs (0, 1), and the PCD6 can have up to 7 CPUs (0..6).

ERROR 11: INVALID STATION NUMBER

S-BUS stations are numbered 0..253.


MENUS - Page 34

ERROR 12: COMMAND NOT ACCEPTED (NAK RESPONSE)


ERROR 13: NO RESPONSE
ERROR 14: INVALID RESPONSE
ERROR 15: COMMUNICATIONS ERROR (PARITY, FRAMING OR OVERRUN)

Check that the baud rate and communications protocol are


correct. The personal computer's baud rate is defined on the
"Configure/Serial ports" menu, and the protocol is selected
from the "coNnect" menu. If using S-BUS, ensure the PCD's
S-BUS port has been configured correctly.

ERROR 16: PCD NOT CONNECTED TO COMn OR POWERED OFF

Occurs when PGU mode is selected, and the PCD is not returning
the CTS (RDYOUT) signal.

ERROR 17: PORT COMn NOT PRESENT

Select the serial port from the "Configure/Serial ports" menu,


which also shows which serial ports are present.

ERROR 18: CPU n NOT PRESENT

The CPU can't be connected because is doesn't exist.

ERROR 19: PCD8.P8 NOT CONNECTED TO CPU n

If using PGU mode with a PCD6 and a PCD8.P800 co-processor,


the P800 must be physically connected to the desired CPU.

ERROR 20: BAD CONNECTION BETWEEN PCD8.P8 AND PCD6

Power off the PCD and re-connect the PCD8.P8. Ensure that the
connectors are clean and free from dirt or grease.

ERROR 21: INVALID ADDRESS

Valid addresses (program line nunbers) are 0..999999.

ERROR 22: PCDMENU.DAT FILE CAN'T BE CONVERTED TO NEW FORMAT

Program PCDCONV.EXE is used to convert menu data files to the


new format. This error occurs if PCDCONV.EXE can't be found,
or the PCDMENU.DAT file is from V1.2 or earlier. Answering
"Yes" (Y) to the "Overwrite old file (Y or N)?" prompt will
delete the old file.

ERROR 23: OUT OF MEMORY

Should never occur. Free up memory by removing memory-resident


utilities such as SHELP and Norton Commander.

ERROR 25: WRONG HELP FILE VERSION: <filename>


ERROR 26: INVALID HELP FILE FORMAT: <filename>
Usually caused by mixing up different versions of the PCD
Programming Utilities. Ensure that the "SET PCD=d:\path" and
the "PATH=d:\path" ndicate the correct directory, and that
the correct versions of the utilities are being run.
MENUS - Page 35

ERROR 27: READ ERROR ON FILE: <filename>

Media error due to bad disk.

ERROR 28: UNKNOWN ERROR

Should never occur. Contact SAIA Technical Support.

ERROR 29: NO RESPONSE FROM S-BUS STATION

The selected station is not responding. Check that the


station number is correct, it is correctly configured and
it's on-line.

ERROR 32: MODEM COMMUNICATIONS WORKS ONLY FOR S-BUS

PGU mode cannot be used with modems.

ERROR 33: NO PHONE NUMBERS IN FILE: PHONES.DAT

The phonebook file PHONES.DAT can be edited using any standard


ASCII text editor, such as DOS "EDIT".

ERROR 34: NOT CONNECTED VIA PUBLIC LINE MODEM

The "HANGUP" command cannot be executed unless connected to a


remote public line modem.

ERROR 35: MODEM TYPE NOT DEFINED: <modem type>

The modem configuration file MODEM.DAT does not contain a


valid definition for the selected modem type. This will only
occur if the file has been incorrectly edited.

ERROR 36: NO RESPONSE FROM MODEM

The modem is probably not connected or powered off. This can


also occur if the modem does not support the selected baud
rate.

ERROR 39: MODEM NOT INITIALIZED

A "HANGUP" command will not work unless the modem has been
initialized by a "CONNECT VIA MODEM" command.

ERROR 40: ENVIRONMENT STRING "name" INVALID OR MISSING

The PCD or TEMP environment string is not defined or contains


a bad path name. The AUTOEXEC.BAT file should contain the
commands "SET PCD=d:\path" and "SET TEMP=d:\path". "PCD"
defines the drive and name of the PCD Programming Utilities
directory, e.g."SET PCD=C:\PCD". "TEMP" defines a directory
to hold temporary files, "SET TEMP=C:\". Refer to the
installation instructions in README.TXT.
MENUS - Page 36

ERROR 41: CAN'T CONNECT, MODEM RESPONSE: "<response>"

The public line modem cannot connect to the remote modem.


The <response> text is the response from the modem which
should indicate the reason why it couldn't connect. Typical
response texts are:

BUSY Engaged or number unobtainable


NO CARRIER Remote modem not responding
ERROR Invalid command sent to modem
NO DIALTONE No dialtone detected

ERROR 42: CLEAR TO SEND (CTS) NOT RETURNED BY MODEM

The modem is either incorrectly connected or is powered off.

ERROR 43: NO RESPONSE OR CARRIER FROM REMOTE MODEM

The dialled number has been answered, but the remote modem
is not responding. Is the dialled number correct?

ERROR 44: MISSING "AnswerOn" OR "AnswerOff" STRING IN MODEM.INI

Old versions of the MODEM.INI file do not contain these two


strings which are needed to control auto-answer mode. These
should be added to each modem definition in the MODEM.INI
file. The default strings are:

AnswerOn="ATS0=1\r"
AnswerOff="ATS0=0\r"

ERROR 45: CONNECT A PCD WITH THE "CONNECT" COMMAND BEFORE CONFIGURING
S-BUS
A PCD must be connected in order to use the F4=Download S-BUS
command from the @coNnect@ menu.

*** END PCDMENU.DOC ***


*********************************************************************
* *
* SEDIT - SAIA PCD INSTRUCTION LIST EDITOR *
* *
* FILENAME SEDIT.DOC *
* AUTHOR Matt Harvey, SAIA Murten *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1

21-Jun-96 V2.0

26-Jun-95 $191
1) Max. no. of symbols increased to 5000 (was 4000).

24-Apr-95 V1.9

06-Feb-95 $18A
1) Scollable file name entry fields now allow entry of file
names up to 128 characters in length. (641)
2) Illegal operands (e.g. STH F Tom+Dick+10) are now
highlighted as invalid lines. If this occurs in an EQU
statement, then the EQU is ignored and the symbol is added
to the resource table without a type and value. (631)

18-Jul-94 $186d
1) A warning message is now issued to prevent resources being
deleted when editing an ST or TR from SGRAF. It is possible
to delete resources which are not referenced by code in the
module being edited, but used resources cannot be deleted.
It is therefore possible to delete resources which are not
used in the ST or TR being edited, but ARE used by other STs
or TRs in the module. A warning message is now displayed to
notify the user of this potential problem:
WARNING 90: RESOURCE(S) MAY BE USED IN OTHER STEPS/TRANSITIONS

08-Jun-94 $185d
1) Now handles new TFRI/STXMI/SRXMI instructions, which use
register indirect addressing. See section 15.
2) TFR now transfers data blocks.
3) New section 15: Entering non-standard instructions.

18-Apr-94 $182
1) SWMR 622: Add $IFINC and $IFNINC support. Also, if type/
value is multi-defined only add it to the symbol table
once.

11-Oct-93 V1.8
1) SWMR 560: Now creates backup files. Old files are renamed
to "filename.BAK".

27-Sep-93 $175
1) Add special handling for pre-defined symbols, see section
4.9. New error message: ERROR 89: PRE-DEFINED SYMBOL, SASM
ASSIGNS A VALUE.
09-Jun-93 V1.7
1) New CPBI and TFR instructions.
2) Can now be called from the Graftec editor, to edit the code
inside a STep or TRansition.
3) Public labels can now be defined by preceding the label in
the LABEL column with a "%" character.
For example: %LABEL STH I 0
Generates: PUBL LABEL
LABEL EQU $
STH I 0
4) The sort order of constants in the resource table has been
changed so that they now appear after the K constants when
the resource table is sorted by type and value.
5) Function key F5 now displays the pop-up directory window
when the cursor is on a filename entry field.
6) Now supports extension memory texts and DBs 4000..7999.
7) Will use extended or expanded memory in the IBM PC if
the PCD Programming Utilities menus were invoked with
the /X switch.
8) The standard ANSI mnemonics for special characters can now
be entered into texts, enclosed in angle brackets. SASM
converts these to their binary characters. E.g. "<CR><LF>" =
"<13><10>", "<BEL>" = "<7>".

31-Jan-91 $155
1) Can now insert and delete FB parameter definitions, and
all FB parameter references in the program are renumbered.
2) Sequential Blocks (SB) can be defined in the resource table,
and called from the program (CSB), but cannot be defined.
These must be defined using the Graftec editor SGRAF.
3) SB, ST and TR numbers *can* be changed now, and if not
referenced, they can be deleted from the resource table.
The "Block Renumber" command can also be used.
4) New ERROR 76: MORE THAN 255 FB PARAMETERS (old error removed).
5) Added "Locate neXt" command (same as F6).
6) FB parameters cannot have the same symbol name as any
other resource.
7) Now detects attempts to delete a marked block containing
FB parameter definitions and gives ERROR 77 unless all
references to these parameters are included in the marked
block, and will also be deleted.
8) "Block Renumber" now works for all data types except constants.
9) Changed error message ERROR 51: MUST MARK ENTIRE INSTRUCTION
10) Changed error message ERROR 55: CAN'T RENUMBER THIS TYPE
11) Added check for APPEND /X, which prevents the "File Assemble"
command from working with DOS version 3.3. New error message:
ERROR 84: CAN'T EXECUTE SASM: "APPEND /X" LOADED

06-Dec-91 $154
1) "File Os command" changed to "File dOs command".

22-Aug-91 $152
1) Changed texts for ERROR 27 and 62.
2) "Locate Operand" changed to "Locate Type/value".
3) Graftec structure instructions cannot be edited. Only ST
and TR names can be changed (not numbers), and comments
can be edited.
4) ESC is either "undo" if data has been entered in a field,
or "Quit" if no data has been entered.
03-Dec-90 Version 1.4
1) Pop-up directory window can now be used to choose a filename
if a filename containing wildcard characters or an empty
filename is entered.

12-Nov-90 Version $139


1) Now supports Data Blocks, see sections 2.7, 8 and 10.
2) Added error messages 82 and 83, section 12.5.
3) After assembling a file with the "File Assemble" command,
pressing ESC returns to DOS or the main menu, any other
key returns to SEDIT.

10-Sep-90 Version $137 (version no. now matches PG3 package)


1) CTRL+HOME and CTRL+END move to start/end of file. HOME and
END move only to start/end of field (SWMR 112).
2) Labels can now be entered on empty lines (SWMR 111).
3) Add "ERROR 39: LABEL TOO LONG (MAX. 6 CHARACTERS)".
4) Entered comments beginning with ';;', the first ';' is
removed so that the comment is not discarded (SWER 102).
5) Insert mode (toggled with the "Ins" key) is retained if the
field is changed (SWMR 110).
6) "Mark" command changed to "Block", "Mark Begin" and "Mark
End" merged into "Block Mark", "Block Move" changed to
"Mark moVe" (SWMR 104).
7) Add "eXternal" command (SWMR 106).
8) Changed "IG" column (Include/Global) to "IS" (Include/Scope).
'S' column contains 'G' for Global or 'X' for "eXternal".
9) Added "Block eXternal" and "Block Global" commands for
changing the scope of a block of elements.
10) Add errors 68 and 69.
11) Add section 13.2, "Editing Graftec programs".
12) Add section 4.7: Include/Scope column.

08-May-90 Version $113


1) "File Load Resources" now loads the FB parameter definitions
too.
2) Symbols can be used if not defined (point 1 below removed).
(It is possible to enter an invalid type/value for a symbol).
3) Resource type SEMA now documented.
4) Document use of new conditional assembly directives $IFNINC
and $IFNINC to allow FB parameters to be defined in $INCLUDE
files (see section 8.3).
5) Added errors 78 and 79.

07-Mar-90 Version $111 / $112


1) Symbols cannot be used on the edit screen unless they have
been defined on the resource screen and have a type and
value.
2) Added "Error 24: Symbol not defined or incomplete".
3) A resource cannot be made public with the "Global"
command unless it has a symbol name.
4) Now supports $ELSEIFxxxx directives (for SASM V1.4).
5) Add section 8.3 "Using FBs defined in another module".
6) Added "Error 81: Text truncated".
7) New data types ("symbol EQU COB x" etc) supported.
22-Nov-89 Version 1.0
1) Select next/previous commands with arrow keys on "File
Os-command" (SWMR 8).
2) Support K for LD, LDH and LDL. The K is removed if the
operand is entered from SEDIT (SWMR 17).
3) Labels can now be local to a block. The same label twice
in one block is detected by SASM. (Removed check for multi-
defined labels). (SWMR 21).
4) Allows international character set in labels and symbols.
(SWMR 32).
5) Allows simple expressions in symbol field (e.g. SYMBOL+1).
(SWMR 76)
6) Read FB definitions from $INCLUDE file (SWMR 81).
7) Now processes PUBL and EXTN statements when SRC file is
read.
8) Added "Global" command to make a symbol PUBLic.
9) Added "IG" column to resource screen to show if a resource
is from an include file or is global.
10) All symbols defined without a type and value are declared
EXTN in the SRC file. (SWMR 82).
11) Added sections 11.2 and 11.3 to describe global resources,
use of include files and conditional assembly.
12) Can now load a register with a label, the label must be
entered in the OPERAND field, not the SYMBOL field (SWMR 84).
13) "Mark Delete" from resource screen now deletes all the unused
resources in the marked block. Used resources are not
deleted and a warning message is given.
14) $INCLUDE files now read when the $INCLUDE statement is
entered during the edit. Supports nested include files.
15) Supports 4-character (32-bit) ASCII constants 'abcd' etc.
16) Help text improved, and help file is now compressed a bit.
17) Colours now defined in PCDCOLOR.DAT (see SCONFIG).
18) "Locate" now finds MOV operands (Q 1, N 0 etc).
19) Texts can now be defined with a symbol+offset.

10-Jul-89 Updated for pre-release version $003:


1) File modified indicator displayed on title line (2.1).
2) Cursor line number added to status line (2.4).
3) SASM $1.3 now produces an error file SASM.ERR, which is
read-in by SEDIT and the errors are highlighted (12.3).
4) SASM, SLINK and SDOC now support 10-character symbol
names (was only 8), from $1.3.
5) "Mark Save" does not save the resources any more (3.4).
6) Greatly improved "Locate Operand" command (3.5). Can now
locate both definitions and references of any resource type
and for labels and FB parameter references etc.
7) New "Locate line Number" command (3.5).
8) "Locate Label" now finds labels in the operand field (3.5).
9) "Locate Symbol" now finds FB parameter references "=Toto".
10) F11/F12 keys now locate the previous or next error (6).
11) Full implementation of hex, binary and character constants
for LD, LDL etc (4.6.1).
12) New "File Assemble" command (3.8).
13) "File Fbs" command now implemented (3.8).
14) F17/F18 keys move cursor to start or end of field (6).
15) F6 is now "Locate Next" (6).
16) New help system implemented (7.1).
17) Instruction information implemented (7.2).
18) Text numbers from text definitions (inside comments) are
now put in the resource list (9).
19) Add separate section describing comments (10).
20) Add "Modular Programming and Global Resources" (11.1).
21) Resource definitions in $INCLUDE files are now processed to
provide a simple method of handling global resources (11.1).
22) Add section on installation (15).
23) Now works in colour, with user definable colours (15).
24) "File Load resources" and "File Save resources" now
fully implemented (5.9).
25) When a symbol is entered on the edit screen, checks that the
type and value of the symbol is valid are now done (were
only done if absolute value was entered).
26) Error messages updated and numbered (12.5).
27) LD instruction doesn't allow -ve values for T|C.
28) Updated for SGRAF compatibility. For ST/TR the automatic
comments are now taken from the SB/TR instructions instead
of from an EQUate statement (Mod Req 48).
29) Can now insert a space at the first position of the
comment field, for nested comments.
30) Warning issued if a block is multi-defined (Mod Req 45).
31) If a file contains two K constants with the same value,
both constants are now loaded (Err Rep 50).
32) The directory window can be used to choose a file name
by pressing F5 whenever a prompt is displayed to enter
a file name.

13-Mar-89 Initial edit, for pre-release version $001.


TABLE OF CONTENTS
═════════════════ Page

1. INTRODUCTION . . . . . . . . . . . . . . . . . . 1
1.1 Invocation . . . . . . . . . . . . . . . . . . 2

2. EDIT SCREEN . . . . . . . . . . . . . . . . . . . 3
2.1 Title line . . . . . . . . . . . . . . . . . . 3
2.2 Prompt line . . . . . . . . . . . . . . . . . 3
2.3 Command line . . . . . . . . . . . . . . . . . 4
2.4 Status line . . . . . . . . . . . . . . . . . 4
2.5 Error message line . . . . . . . . . . . . . . 4
2.6 Entry fields . . . . . . . . . . . . . . . . . 4
2.7 Label field . . . . . . . . . . . . . . . . . 5
2.8 Mnemonic field . . . . . . . . . . . . . . . . 6
2.9 Operand field . . . . . . . . . . . . . . . . 6
2.10 Symbol field . . . . . . . . . . . . . . . . . 6
2.11 Comment field . . . . . . . . . . . . . . . . 7

3. EDIT SCREEN COMMANDS . . . . . . . . . . . . . . . 8


3.1 Resources . . . . . . . . . . . . . . . . . . 8
3.2 Insert . . . . . . . . . . . . . . . . . . . . 8
3.3 Delete . . . . . . . . . . . . . . . . . . . . 8
3.4 Block . . . . . . . . . . . . . . . . . . . . 8
3.5 Locate . . . . . . . . . . . . . . . . . . . . 9
3.6 Comments . . . . . . . . . . . . . . . . . . . 10
3.7 Print . . . . . . . . . . . . . . . . . . . . 10
3.8 File . . . . . . . . . . . . . . . . . . . . . 10
3.9 Quit . . . . . . . . . . . . . . . . . . . . . 12

4. RESOURCE SCREEN . . . . . . . . . . . . . . . . . 12
4.1 Title line . . . . . . . . . . . . . . . . . . 13
4.2 Prompt line . . . . . . . . . . . . . . . . . 13
4.3 Command line . . . . . . . . . . . . . . . . . 13
4.4 Status line . . . . . . . . . . . . . . . . . 13
4.5 Symbol name field . . . . . . . . . . . . . . 13
4.6 Type and value field . . . . . . . . . . . . . 13
4.6.1 Resource data types . . . . . . . . . . . . . 14
4.7 Include/Scope "IS" column . . . . . . . . . . 14
4.8 Automatic comment field . . . . . . . . . . . 14
4.9 Pre-defined symbols . . . . . . . . . . . . . 14

5. RESOURCE SCREEN COMMANDS . . . . . . . . . . . . . 15


5.1 Editor . . . . . . . . . . . . . . . . . . . . 15
5.2 Sort . . . . . . . . . . . . . . . . . . . . . 15
5.3 Insert . . . . . . . . . . . . . . . . . . . . 15
5.4 Delete . . . . . . . . . . . . . . . . . . . . 15
5.5 Next . . . . . . . . . . . . . . . . . . . . . 15
5.6 Block . . . . . . . . . . . . . . . . . . . . 16
5.7 Locate . . . . . . . . . . . . . . . . . . . . 17
5.8 Global . . . . . . . . . . . . . . . . . . . . 17
5.9 eXternal . . . . . . . . . . . . . . . . . . . 17
5.10 Print . . . . . . . . . . . . . . . . . . . . 18
5.11 File . . . . . . . . . . . . . . . . . . . . . 18
5.12 Quit . . . . . . . . . . . . . . . . . . . . . 18

6. THE KEYBOARD . . . . . . . . . . . . . . . . . . . 19

7. HELP . . . . . . . . . . . . . . . . . . . . . . . 21
7.1 F1 Help . . . . . . . . . . . . . . . . . . . 21
7.2 F3 Instruction info . . . . . . . . . . . . . 21
Table of contents continued
──────────────────────────-

8. FUNCTION BLOCKS AND PARAMETERS . . . . . . . . . . 23


8.1 Defining a Function Block . . . . . . . . . . 23
8.2 Calling a Function Block . . . . . . . . . . . 24
8.3 Using FBs defined in another module . . . . . 24

9. COMMENTING THE PROGRAM . . . . . . . . . . . . . . 25

10. TEXTS AND DATA BLOCKS . . . . . . . . . . . . . . 26


10.1 Texts . . . . . . . . . . . . . . . . . . . . 26
10.1.1 Using symbols in texts . . . . . . . . . . 27
10.2 Data Blocks . . . . . . . . . . . . . . . . . 28

11. ASSEMBLING AND LINKING . . . . . . . . . . . . . . 29


11.1 Modular programming and global resources . . . 29
11.2 Include files . . . . . . . . . . . . . . . . 30
11.3 Conditional assembly . . . . . . . . . . . . . 31

12. ERRORS . . . . . . . . . . . . . . . . . . . . . . 32
12.1 Source file errors . . . . . . . . . . . . . . 32
12.2 Edit errors . . . . . . . . . . . . . . . . . 32
12.3 Assembler errors . . . . . . . . . . . . . . . 32
12.4 Fatal errors . . . . . . . . . . . . . . . . . 33
12.5 Error messages . . . . . . . . . . . . . . . . 34

13. SOURCE FILE . . . . . . . . . . . . . . . . . . . 41


13.1 Using source files created by another editor . 41
13.2 Editing Graftec programs . . . . . . . . . . . 43
13.3 Source file format . . . . . . . . . . . . . . 44

14. DIRECTORY WINDOW . . . . . . . . . . . . . . . . . 45

15. ENTERING NON-STANDARD INSTRUCTIONS . . . . . . . . 46


15.1 Jump instructions (JR/JPI/JPD) . . . . . . . . 46
15.2 Conditional instructions . . . . . . . . . . . 46
15.3 Register indirect addressing (TFRI/SRXMI/STXMI) 46
15.4 LD instruction and labels . . . . . . . . . . 46
SEDIT - Page 1
1. INTRODUCTION
════════════════
SEDIT (SaiaEdit or SuperEdit) is a comfortable "spread sheet" style
instruction list editor. It is designed for editing short programs,
which contain a small number of modules. Larger more complex programs
are best written using a standard text editor (e.g. IBM's Personal
Editor), which allows much more freedom to use the full power of the
SAIA assembly language (macros etc).

SEDIT edits an ASCII source file (.SRC) which can be assembled


and linked using the assembler and linker supplied with the PCD
Programming Utilities package (V1.3 or after).

SEDIT has two screens, the "edit screen" and the "resource screen".
The edit screen is where the program code is entered. The resource
screen is where the resource list (symbol names, data type, values
and automatic comments) can be edited.

Program code can be entered either using symbol names such as "Fred"
or using absolute values "I 0". Symbol names and absolute values are
entered into the resource table if not already there, so that symbol
names, data types and automatic comments can be assigned to them
later from the resource screen.

Here is a summary of SEDIT's functions:

* Replaces the standard text editor (PE), as called from the


existing main menu. SEDIT is an optional extra, PE can still
be used by those customers who prefer it. NOTE: SEDIT cannot be
used to edit files created by another editor, see section 13.1.

* Reads a standard source file (.SRC) as input, and produces a


source file as output. The source file is assembled and linked
with the existing Assembler and Linker.

* Syntax checking as each instruction line is entered.

* Prompts which show the permissible operands to each instruction


during entry of the program.

* The resource list (a list of all symbols, elements and blocks


used in the program) can be displayed, edited and printed.

* Automatic comments (up to 35 characters) can be attached to any


symbol or absolute operand value. User comments (or "free
comments") are also supported.

* Provides Function Block (FB) parameter prompting and checking.


FB parameter lists are defined when an FB is created, prompts
and syntax checks of each parameter are done as parameters are
entered after the FB is called (with the CFB instruction). Each
FB parameter can be defined with a symbol name, a type and an
automatic comment.

* Edits up to 3000 lines of code in a single module, and handles


up to 5000 symbols (resources) at a time.

* Allows the importing of resource lists and FB parameter


definitions from other modules. Supports global and external
resources, and resources defined in $INCLUDE files.

* Comprehensive on-line help system, with over 250 help screens.


SEDIT - Page 2

1.1 Invocation
───────────────

SEDIT consists of three files:

SEDIT.EXE The executable file.


SEDIT.HLP Contains the help screens and indexes.
SEDIT.OVL Overlay for invocation of the assembler.

The PCD Programming Utilities configuration files PCDSETUP.DAT


and PCDCOLOR.DAT are also required for printer page formatting,
colour definitions etc. These are defined from the "Configure"
option on the main menu (SCONFIG).

SEDIT can be run from the PCD Programming Utilities main menu
with the "Edit" command, or can be invoked directly from DOS.

Invocation from DOS:

SEDIT filename[.ext]

Where: filename The name of the source file to be edited.


[.ext] The file extension. If no extension is
given, ".SRC" is used as the default.

If no file name is given, SEDIT will be invoked with an empty edit


buffer. Editing can continue as normal, but a file name must be
given before the file can be saved.

If a file name is given and the file exists, the file is loaded
by SEDIT. If the file doesn't exist, the "NEW FILE" warning is
displayed on the error message line.

SEDIT will use extended or expanded memory in the IBM PC for


assembling the source module ("File Assemble" command) if the
PCD Programming Utilities main menu program was invoked with the
/X switch.
SEDIT - Page 3

2. EDIT SCREEN
═══════════════

The edit window is a scrollable window with five entry fields on each
line. A large reverse-video cursor can be moved to select a field
using the arrow or tab keys etc. If the selected field can be edited,
the small flashing cursor appears inside the field, and new data can
be entered if required. The prompt line is updated according to the
cursor field.
┌───── File modified indicator
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD CODE EDITOR V2.1 MODULE: TEST.SRC * │ <──── Title line
├────────────────────────────────────────────────────────────────────────────────┤
│┌─────┬────────┬─────────────┬────────────┬────────────────────────────────────┐│
││LABEL│MNEMONIC│ OPERAND │ SYMBOL │ AUTOMATIC COMMENT ││ <───── Header
│È═════¤════════¤═════════════¤════════════¤════════════════════════════════════¥│
│ ════ Start of module ════ │ ─┐ <── Start indicator
│ ; Full 80-column comment lines can be entered by typing a ';' character in │ │
│ ; the first column of the LABEL field. User comments can also be entered in │ │
│ ; the comment field after an instruction line. │ │
│ PB 0 GetBit │ │
│ ADD R 1 SrcReg Source register │ │
│ R 2 TagReg Tag register │ │ Scrollable
│ R 100 Scratch register │ ├──── Edit window
│ INC C 0 BitCount Counts bits produced │ │
│ CMP R 0 OldValue Holds old number of bits │ │
│ C 0 BitCount Counts bits produced │ │
│ JR E OK │ │
│ OUT O 0 AlarmLamp Turn on alarm lamp │ │
│ JR END │ │
│ OK LD R 0 OldValue Holds old number of bits │ │
│ C 0 BitCount Counts bits produced │ │
│ ════ End of module ════ │ ─┘ <── End indicator
│ │
│ ERROR: INVALID OPERAND │ <───── Error message line
├────────────────────────────────────────────────────────────────────────────────┤
│ OPERAND: I 0-8191, O 0-8191, F 0-8191, T 0-450, C 0-1599 │ <───── Prompt and command
├────────────────────────────────────────────────────────────────────────────────┤ line
│ Line: 5 Free Memory: 406981 Symbols: 9 Errors: 0 F1=Help F3=Info │ <───── Status line
└────────────────────────────────────────────────────────────────────────────────┘

2.1 Title line


───────────────
Shows SEDIT's version number (e.g. V2.1), and the name of the SRC file
being edited. If no file name has been given, the file name will be
blank. On the right is the "file modified indicator", if the file has
been altered an asterisk '*' is displayed here.

2.2 Prompt line (line 24)


──────────────────────────
Shows a context-sensitive prompt, which changes according to the
cursor position on the edit screen. When the cursor is on the operand
field, the prompt line shows the type and range of the operand which
can be entered for the instruction. When the cursor is on a CFB
parameter, the user-defined parameter type, name and comment are
shown on the prompt line, see section 8.2 for details.

While a file is being loaded or saved, the prompt line shows the name
of the file and the line number being processed.
SEDIT - Page 4

2.3 Command line (line 24)


───────────────────────────
The command line is displayed on line 24 when either the ALT or
the CTRL key is pressed. To execute a command, press ALT or CTRL,
then the capital command letter of the command to be executed. See
section 3 for edit screen commands.

2.4 Status line (line 25)


──────────────────────────
"Line" shows the line number which the cursor is on, the first line
in the module is line 1.

"Free memory" shows the number of bytes of memory available for


editing and for storing the resource list. When this number is less
than about 40K (40000), then the module is becoming too large, and
it should be separated into smaller modules. This value is not updated
when lines are deleted, it is updated only when new memory is taken.

"Symbols" shows the number of lines used by the resources in the


resource screen. A maximum of 5000 resources can be handled for a
single module. This figure includes any blank lines in the resource
list.

"Errors" shows the number of source file errors (detected when the
source file was read in, see section 12.1), or the number of errors
found when the file was assembled (see section 12.3). Errors can be
located with the F11 (SHIFT+F1) and F12 (SHIFT+F2) keys, or the
"Locate Error" command, and corrected before saving the file.

2.5 Error message line (line 23)


─────────────────────────────────
Whenever an error is detected, an error message is displayed on this
line, accompanied by a beep. The error message is cleared on the
next key depression. A list of error messages is in section 12.5.

2.6 Entry fields


─────────────────
When the cursor in on an entry field, the entire field is displayed
in reverse video. If data can be entered in the field, the small
blinking cursor is shown inside the field. The prompt displayed on
the prompt line indicates what can be entered into the field.

If new data is entered in a field, it is checked and processed only


when the cursor is moved to another field, or before a command is
executed. The cursor cannot be moved and commands cannot be executed
if the field contains invalid data.

Full editing facilities are provided for every entry field. The "Ins"
key toggles between insert and overtype mode (a block cursor means
insert mode, an underline cursor means overtype mode). "Del" deletes
the character under the cursor, backspace "<-" deletes the character
to the left of the cursor. The left arrow and right arrow keys move
the cursor within the field. Home and End move the cursor to the start
or end of the field. "Esc" is "undo" if a field has been edited (the
original data is restored), or "Quit" if the field has not been
edited.

Moving in or between fields is done using the up arrow, down arrow,


tab, backtab, PgUp, PgDn, Ctrl+Home, Ctrl+End, F9, F10 and space keys.
The space bar will move to the next field if the cursor at the start
of an entry field. See section 6.
SEDIT - Page 5

2.7 Label field


────────────────
This field has five functions, to enter a jump label, a comment line,
an assembler directive, a Text or a Data Block.

a) Jump labels

If the first character in this field is not ';' or '$', SEDIT


assumes the text is ajump label. Labels are used as a destination
for the JR, JPD or RCOB instructions, where the condition code and
destination label are entered in the Operand field).

Labels can contain characters A..Z, a..z, digits 0-9, the '_'
underline character or the foreign characters Ä, á etc. Labels
cannot begin with a digit and, for SEDIT, must be between 2 and 6
characters long. Mnemonics and assembler reserved words cannot be
used as labels, and labels must not have the same name as a symbol.
Labels are not case sensitive (unless foreign characters are used),
the SHIFT key can be used to enter lower case letters.
The ':' terminator (required by the Assembler) is not needed by
SEDIT, this is appended by SEDIT when the file is saved.

Labels are local to the block (COB, PB, FB etc) where they are
defined. The same label can be used many times in a single module,
providing it is not used twice within the same block. It is illegal
to jump to a label in another block. These errors are detected only
when the file is assembled.

Global labels can be produced by starting the label with a "%"


symbol, this creates a public label.
E.g. %LABEL produces: PUBL LABEL
LABEL EQU $

b) Comment lines

To turn a line into a comment line, type ';' in the first column.

*** NOTE ***


Texts and Data Blocks (see below) are entered inside comments,
therefore a comment line MUST NOT begin with the keywords TEXT
or DB, or the character '"'.

c) Assembler directives

To begin an assembler directive, type '$' in the first column.


The only directives which are actually processed by SEDIT are
$INCLUDE, $IFINC..$ENDIF and $IFNINC..$ENDIF. All the other
directives ($IF, $EJECT etc.) are processed only when the file
is assembled.

--> If the first character is not ';' or '$', SEDIT will assume that
it's a jump label.

d) Texts

These are entered in comment lines, see section 10.

e) Data Blocks

These are entered in comment lines, see section 10.


SEDIT - Page 6
2.8 Mnemonic field
───────────────────
For the entry of an instruction mnemonic. When a new mnemonic is
entered, lines are inserted to make space for the number of operands
needed by the instruction. For example, if "ADD" is entered, three
blank lines are inserted. If an existing mnemonic is changed, the
operands of the old instruction are deleted and blank lines are
inserted for the new instruction.

When entering Function Block parameter definitions, this field is


used for the FB parameter number, see section 8.1.

2.9 Operand field


──────────────────
An absolute operand, valid for the instruction, can be entered (for
example "I 0", "K 45", "-20"). When the cursor is on this field, the
prompt line shows which operands are valid. When an operand is entered
or edited, the symbol and automatic comment fields are updated with
the symbol name and automatic comment which have been assigned to the
operand. Symbol names and automatic comments are assigned to absolute
operands from the resource screen.
If the operand is a resource (I, O, F, TEXT etc), and it is not
already in the resource list, it is added to the list. The symbol
name and automatic comment can be added from the resource screen
later.

For block call instructions (CFB, CPB etc), the condition code and
optional block number must be entered in this field.

For the jump instructions (JR and JPD) the condition codes and labels
are both entered in this field, for example "JR Z FRED". Absolute
values can also be used for jumps, for example "JR H -1", but it is
safer to use labels. Also put the label in this field to load a
register with the value of a label, e.g. LD R 0, LABEL.

When defining Function Block parameters, this field is for the


parameter type, see section 8.1.

2.10 Symbol field


──────────────────
The symbol name of an element can be entered here. The operand and
automatic comment fields are updated with the value and automatic
comment which have been assigned to the symbol name from the
resource screen. If the symbol is not defined, it is added to the
resource list, and a type and value can be assigned to it later.

A symbol name can be up to 10 characters long. Symbols can contain


the characters A-Z, a-z, digits 0-9, foreign characters and the '_'
underline character. Symbols cannot begin with a digit. It is illegal
to use a mnemonic or assembler reserved word as a symbol name. Symbol
names are not case sensitive unless they contain foreign characters -
"symbol" is the same as "SYMBOL". Use capital letters or underline
characters '_' to improve the readability of symbola, for example
"OnSwitch" or "ON_SWITCH" is easier to read than "onswitch".

*** NOTE ***


If the symbol is not defined or has no type and value, SEDIT cannot
check if the symbol is valid. When the symbol is subsequently given
a type and value, these may not be valid where the symbol is used.
For example, "STH Symbol" where "Symbol" is subsequently given the
type and value "R 100". When the module is assembled this will
generate an error.
SEDIT - Page 7

2.11 Comment field


───────────────────
This field can display two types of comment, either automatic or user
comments, selectable with the "Comments" command or with function key
F8. The current comment type is shown on the header line. See section
9 for more on comments.
a) AUTOMATIC COMMENTS. When these are selected, the automatic
comment assigned to the operand is displayed.
b) USER COMMENTS. When these are selected, the cursor can be
moved onto this field, and a user comment can be entered.
SEDIT - Page 8

3. EDIT SCREEN COMMANDS


════════════════════════

Commands are executed by pressing the ALT or the CTRL key, then the
capital command letter of the desired command. Some commands can
also be executed using the function keys, see section 6.

This is a list of the edit screen commands:

3.1 Resources
──────────────
Switches to the resource screen.

3.2 Insert
───────────
Inserts a line at the current cursor position. Note that lines
cannot be inserted between the operands of a multi-line instruction.
This command can also insert new FB parameters in an FB parameter
definition list, see section 8.1.

3.3 Delete
───────────
Deletes the current cursor line. To delete an entire instruction,
the cursor must be on the first line of the instruction which
contains the mnemonic. It is not possible to delete a single line
of a multi-line instruction. When an instruction is deleted, all the
operand lines associated with the instruction are also deleted.
Thsi command can also delete unreferenced FB parameters in an FB

parameter definiton list, see section 8.1.

3.4 Block
──────────
A block of lines can be marked for deleting, moving, copying, print-
ing or saving in an intermediate file. A second command letter must
be typed to select the mark operation, a second command line is
displayed:
├────────────────────────────────────────────────────────────────────────────────┤
│ BLOCK: Mark Delete moVe Copy Unmark Print Save <ESC> │
└────────────────────────────────────────────────────────────────────────────────┘

Block Mark: The line containing the cursor is marked as the start
or end of the marked block. The marked line cannot be
within a multi-line instruction. The marked block is
displayed in reverse video.

Block Delete: The marked block of code is deleted.

Block moVe: Moves the marked block to the present cursor line.
The block is automatically unmarked after the move.
The marked block at the original position is deleted.

Block Copy: Copies the marked block to the current cursor line.
The original block is not deleted and remains marked.
SEDIT - Page 9

Block command continued


───────────────────────
Block Unmark: Unmarks the marked block. It is re-displayed in normal
video (if on screen).

Block Print: Prints the marked block. The user is prompted to


make the printer ready before starting the print by
pressing Enter. See also the "Print" command.

Block Save: Saves the marked block to an intermediate source file


(.SRC). The name of the file must be entered first,
or press F5 to select the file from the directory
window. The definitions of any symbols or resources
used are NOT saved in the file. The marked block
is not deleted and remains marked. The file can be
read back using the "File Load code" command. If the
file already exists, a prompt is displayed "Overwrite
(Y or N)?".

Escape can be used to abort.

3.5 Locate
───────────
Moves the cursor to a specified label, mnemonic, operand, symbol,
or to the next error. The search commences from the line AFTER the
present cursor line (except for "Locate line Number"), to the end
of the file. To search from the start of the program, first move
the cursor to the first line using CTRL+HOME. If the item is found,
the cursor is moved onto the item. If not found, an error message
is displayed.

Once a valid "Locate" command has been executed, the F6 function key
can be used to locate the next occurrence of the item. Remember that
the search begins at the line AFTER the present cursor line. To use
F6 to search for the first item again, first press CTRL+HOME to move
to the start of the file.
├────────────────────────────────────────────────────────────────────────────────┤
│ LOCATE: Label Mnemonic Symbol Type/value Error line Number neXt <ESC> │
└────────────────────────────────────────────────────────────────────────────────┘

Locate Label: Searches for a label. Finds the label definition in


the label field, or jumps to the label where the
label is used in the operand field.

Locate Mnemonic: Searches for a mnemonic in the mnemonic field, for


example "STH", "COB".

Locate Type/value: Searches for references in the operand field. The


item can be a resource with a type and value, or it
can be a constant in any units (see resource types
in section 4.6.1).
For example, "FB 10" will find the instructions FB 10
and CFB [cc] 10; "I 0" will find all references to
Input 0; "100" will find all operands which contain
the decimal constant 100; "1.0" will find all operands
containing the floating point constant 1.00000E+00.
K 'A' will find K 'A' and K 65. "TEXT 0" will find
where TEXT 0 is used, and TEXT 0 itself.
SEDIT - Page 10

Locate command continued


────────────────────────
Locate Symbol: Searches for the next location where the symbol is
used. The search is not case sensitive, "ONSWITCH"
is the same as "OnSwitch". Function block parameter
references "=symbol" can also be located.

Locate Error: If there are any errors logged, this command moves
the cursor to the next highlighted error, and the
associated error message is displayed. The F11
(SHIFT+F1) and F12 (SHIFT+F2) function keys can also
be used to locate the previous/next errors.

Locate line Number: Moves the cursor to the specified line number,
if it exists.

Locate neXt Locates the next occurrence of the item, same as


function key F6.

3.6 Comments
─────────────
Switches the comments column from the display of automatic comments
the display of user comments, and back again.

3.7 Print
──────────
Prints the entire module on the printer. Either the automatic or the
user comments are printed, depending on which is displayed when the
print is started. The user is prompted to ready the printer, then
press Enter to start the print. Escape can be used to abort the print
at any time.

Page formatting is done as defined from the "Configure" option on the


PCD Programming Utilities main menu. If printer initialization and
de-initialization strings are defined, these are sent to the printer
before and after each print. The same is true for the "Block Print"
commands.

3.8 File
─────────
This command can assemble the file, load or save code to a file,
load Function Block parameter definitions, display the contents of
any directory on any disk, or execute any DOS command.

When saving files, if a file exists with the same name (the original
file) it is renamed to "filename.BAK", so it can be restored in case
of error.

├────────────────────────────────────────────────────────────────────────────────┤
│ FILE: Assemble Load code Save code Fbs Directory dOs command <ESC> │
└────────────────────────────────────────────────────────────────────────────────┘
SEDIT - Page 11

File command continued


──────────────────────
File Assemble: Saves and assembles the program, then returns to SEDIT
with any errors highlighted, see section 12.3. The
program is first written back to the original source
file on the disk. If you don't want to overwrite the
the original source file, answer 'N' to the "Overwrite
(Y or N)?" prompt to abort assembly.

File Load code: Loads the code and symbols from the specified file
(.SRC) and inserts the code at the current cursor
line. Any resources defined in the file are added to
the resource list. If a symbol name is already defined,
it takes the new type, value and automatic comment of
the symbol read from the file. The name of the file
must be entered first, or press F5 to select a file
from the directory window.

File Save code: Saves all the code and symbols in the specified file
(.SRC). The name of the file must be entered first,
or press F5 to select the file from the directory
window. If the file already exists, a prompt "Over-
write (Y or N)?" is displayed.

File Fbs: Loads the Function Block parameter definitions from


the specified file. The name of the file must be
entered first, or press F5 to select a file from
the directory window. If the parameter definitions
of FBs defined in other modules are loaded, then
the FB parameter prompts will be available when the
FB is called with the CFB instruction. If the FB is
already fully defined, new definitions are ignored.
If the FB is defined without a symbol name, or
without a number, the name or number and automatic
comment from the file is used. NOTE: The "File Load
resources" command (executed from the resource scrn)
also loads FB parameter definitions. Section 8.3
describes a better method for managing externally
defined Function Blocks.

File Directory: Displays the contents of any directory. A file name


mask or a drive and directory name can be entered.
Pressing function key F5 also displays the directory
window. This command is also available from the
resource screen. See section 14.

File dOs command: Allows DOS Operating System commands to be executed


as they would be from the DOS command line. Previous
commands can be recalled for executing again or for
editing by using the up and down arrow keys, the
last 10 commands are stored. To clear the command
line use Home or backspace "<-". To return to the
edit screen press Escape or press Enter on an empty
line. This command is also available from the
resource screen.
*** NOTE ***
If editing a very large file, there may not be enough
memory left to load and execute another large program.
Do NOT re-execute SEDIT or the PCD Programming
Utilities menu from here!
SEDIT - Page 12

3.9 Quit
─────────
Exits to DOS or to the PCD Programming Utilities main menu. If the
file being edited has not been saved, the user is asked if he wants
to save the file.

4. RESOURCE SCREEN
═══════════════════

This screen is entered from the edit menu by the "Resources" command
or by pressing function key F7.

This screen shows a list of all the elements (I O F T C R, TEXT, DB


and SEMA), all the blocks (COB, XOB, PB, FB, SB, ST and TR), and
certain constants used by the program. These are known as the
"resources" of the program. Elements and blocks are automatically
added to the resource list as the program is written. Constants are
NOT automatically added, these must first be defined from the resource
screen and referenced by symbol name in the program.

If the program has been written using only absolute values, then
symbol names can be assigned to each absolute value from this screen.
Each resource can also be assigned an automatic comment from this
screen, which is displayed in the automatic comment field of the Edit
screen.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD CODE EDITOR V2.1 MODULE: TEST.SRC │ <──── Title line
├────────────────────────────────────────────────────────────────────────────────┤
│┌─────────────┬────────────────────┬──┬────────────────────────────────────────┐│
││ SYMBOL NAME │ TYPE AND VALUE │IS│ AUTOMATIC COMMENT ││ <───── Header
│È═════════════¤════════════════════¤══¤════════════════════════════════════════¥│
│┌──────────────────────────────────────────────────────────────────────────────┐│
││ Switch I 0 I Red start button ││ ─┐
││ EndStop I 1 I End of motor travel ││ │
││ MotorOn O 32 Turns on the motor ││ │
││ MotorOff O 33 Turns off the motor ││ │
││ Fault O 34 Turns on the red fault lamp ││ │
││ EndTimer T 0 G Times movement to EndStop ││ │ Scrollable
││ ItemCount C 100 G Counts number of items moved ││ ├──── Resource
││ Main COB 0 Main motor control ││ │ Window
││ Control0 PB 0 Controls Motor 0 ││ │
││ ExtBase X This is defined externally ││ │
││ ││ │
││ ││ │
││ ││ │
││ ││ │
││ ││ ─┘
│È══════════════════════════════════════════════════════════════════════════════¥│
│ │ <───── Error message line
├────────────────────────────────────────────────────────────────────────────────┤
│ RESOURCE LIST: Edit or enter the symbol name. │ <───── Prompt and command
├────────────────────────────────────────────────────────────────────────────────┤ line
│ Line: 12 Free Memory: 406981 Symbols: 9 Errors: 0 F1=Help F3=Info │ <───── Status line
└────────────────────────────────────────────────────────────────────────────────┘
SEDIT - Page 13

4.1 Title line


───────────────
See section 2.1.

4.2 Prompt line


────────────────
Indicates what is to be entered in the cursor's field.

4.3 Command line


─────────────────
The command line is displayed on line 24 when either the ALT or
the CTRL key is pressed. To execute a command, press ALT or CTRL
then the capital command letter of the command to be executed.
See section 5 for the resource screen commands.

4.4 Status line


────────────────
See section 2.4.

4.5 Symbol name field


──────────────────────
The symbol name for the resource should be entered here. New names
can be assigned, or existing names can be edited. If a program has
been written using absolute operands, symbol names can be added
later. New symbol names are displayed in the symbols column on
return to the edit screen.

4.6 Type and value field


─────────────────────────
The type and value of each resource should be entered here. Data
types are listed in section 4.6.1. Constants are entered without
a type.

Constants can be entered in decimal, hex, floating point, binary


or as ASCII characters.

HEX constants must be terminated by an 'H', e.g. 0ABCH, FFH.

FLOATING POINT constants must contain a decimal point '.' or an


exponent 'E', for example "0.1", "5E10".

BINARY constants must be terminated by a 'Q', these are limited


to 12 bits, e.g. 1100101Q

ASCII CHARACTER constants can be one to four ASCII characters,


enclosed in single quotes: 'A', 'abcd' etc. For K type constants,
only one ASCII character is allowed, the character is converted
to decimal after entry, if K 'A' is entered, the value displayed
is K 65.

*** NOTE ***


New Graftec Steps (ST) and Transitions (TR) cannot be defined,
only their symbol names, numbers or comments can be changed. New
STs and TRs can only be created using the Graftec editor (SGRAF).
SEDIT - Page 14

4.6.1 Resource data types


──────────────────────────

TYPE DESCRIPTION RANGE EXAMPLES


─────────────────────────────────────────────────────────────────────
I Input \ Share same 0 - 8191 I 16, I 8191
O Output / addresses 0 - 8191 O 32, O 8191
F Flag 0 - 8191 F 8000, F 0
T Timer \ Share same 0 - 450 T 45, T 0
C Counter / addresses 0 - 1599 C 100, C 1599
R Register 0 - 4095 R 1000, R 4095
K K constant, decimal 0 - 16383 K 1234, K 'A', K 32H
COB Cyclic Org'n Block 0 - 15 COB 0, COB 15
XOB Exception Org'n Block 0 - 31 XOB 0, XOB 16
PB Program Block 0 - 299 PB 12, PB 0
FB Function Block 0 - 999 FB 10, FB 999
SB Sequential Block 0 - 31 SB 31, SB 0
ST Step \ Create with 0 - 999 ST 999, ST 0
TR Transition / SGRAF only 0 - 999 TR 123, TR 999
TEXT Text (or X) \ Share same 0 - 7999 TEXT 456, TEXT 7999
DB Data Block / addresses 0 - 7999 DB 0, DB 3999
SEMA Semaphore 0 - 99 SEMA 0, SEMA 99
Decimal constant -2147483648 - +2147483647
Hex constant 0 - FFFFFFFFH 0ABCDEFH, 1234H
Binary constant 0Q - 1111111111111Q
ASCII constant (1..4 chars) 'a' 'abcd' '£100' 'ä' 'é' etc.
Floating Point (FFP) ±2.710505E-20 - ±9.223371E+18
ALGI/ALGO channel+base adds 0-7 0-8180 0 0, 3 8181, 3 32

4.7 Include/Scope "IS" column


──────────────────────────────
The "IS" column stands for "Include" and "Scope". The "I" column
contains an 'I' if the resource is defined in an include file (see
section 11.1). The "S" column contains a 'G' the resource is global
(see the "Global" command, section 5.8), an 'X' if the resource is
external (see the "eXternal" command, section 5.9), a 'P' if it's
a pre-defined symbol (see section 4.9), or is blank if the resource
is local.

4.8 Automatic comment field


────────────────────────────
This is where the automatic comments are assigned to the resource.
Any characters can be used in the comment. This comment will appear
in the comment field on the edit screen if automatic comments are
selected for display.

4.9 Pre-defined symbols


────────────────────────
Two useful symbols are pre-defined, and are assigned values when the
file is assembled. These can be referenced by the user program as
normal symbols, with some restrictions: they cannot be made Global,
and cannot be given a value or automatic comment. For pre-defined
symbols, a 'P' is listed in the 'S' scope column.

_BLOCKNUM_ The number of the current block, e.g. XOB 16 = 16.


_BLOCKTYP_ The type of the current block:
0=COB, 1=XOB, 2=PB, 3=FB, 4=IST, 5=ST, 6=TR.
SEDIT - Page 15

5. RESOURCE SCREEN COMMANDS


════════════════════════════

5.1 Editor
───────────
Returns to the edit screen.

5.2 Sort
─────────
The resource list is sorted either by symbol name, or by type and
value. The "Sort" command changes the sort order and re-sorts the
list. The sort order is indicated by either "SYMBOL NAME" or "TYPE
AND VALUE" displayed in bold video on the header line.

When sorted by symbol name, all resources without symbolic names are
moved to the front of the list. When sorted by type and value, all
resources without type and value are moved to the front of the list.
This makes it easier to edit the undefined resources.

New symbols or types and values can be entered anywhere in the list,
and the list can be re-sorted later using the "Sort" command.

Function key F8 also executes the "Sort" command.

*** NOTE ***


If foreign characters are used in symbols, the sort order may not
be correct. Foreign characters are special ASCII codes greater than
127 and are not in alphabetical order, e.g. A=65, Ä=142.

5.3 Insert
───────────
Inserts an empty line into the resource list at the cursor position.

5.4 Delete
──────────-
Deletes the line at the cursor position. If the line contains a
symbol name or type and value which is used by the program, the
resource cannot be deleted. To delete used resources, first remove
all references to them from the edit screen. If a resource is defined
in an include file (marked with 'I'), it cannot be deleted, this can
only be done by editing the include file itself.

5.5 Next
─────────
Inserts the next element into the resource list. For example, if the
cursor is on "I 32", the "Next" command will insert a line containing
"I 33", and move the cursor onto the new line. If executed again it
inserts "I 34" and so on. Each element can then be given a symbol
name and an automatic comment. This saves typing when defining all
the inputs or outputs for a card etc.

This works for all data types, except floating point constants, and
Steps and Transitions which can only be created using the Graftec
editor SGRAF.

If a resource is already defined, an error occurs.


SEDIT - Page 16

5.6 Block
──────────
A block of resources can be marked for deleting, renumbering, printing
or saving in an intermediate resource file. A second command letter
must be typed to select the block operation, a second command line is
displayed:

├────────────────────────────────────────────────────────────────────────────────┤
│ BLOCK: Mark Delete Unmark Renumber Global eXternal Print Save <ESC> │
└────────────────────────────────────────────────────────────────────────────────┘

Block Mark: The line containing the cursor becomes the start or
end of the marked block. The marked block is displayed
in reverse video. A single line can be marked if
required.

Block Delete: Deletes all the unused resources in the marked block.
Used resources are not deleted. If any resources are
not deleted, a warning message is displayed.

To delete *ALL* unused resources, mark the first and


last lines.

Block Unmark: Unmarks the marked block. It is re-displayed in


normal video (if on screen).

Block Renumber: Renumbers the marked block of elements. This works


all types except constants. The marked block must
consist of the same types, sorted by type and value.
The user is prompted to enter the new starting
address. The first element is given this address,
and the others are renumbered accordingly. This is
especially useful for relocating an I/O card to
another base address.

Block Global: Toggles the scope of the marked resources between


global and local. Global resources are marked with a
'G' in the scope column.

Block eXternal: Toggles the scope of the marked resources between


external and local. External resources are marked
with an 'X' in the scope column. An external
resource is defined as being "global" in another
module, using the "Global" command. If it's defined
externally, it cannot have a local type or value
(unless it's a PB, FB or SB, where the type only
will be shown).

Block Print: Prints the marked block of resources. The user is


prompted to make the printer ready before starting
the print. See also the "Print" command.

Block Save: Saves the marked block of resources into a resource


file (.SRC). The name of the file must be entered
first, or press F5 to select a file from the direct-
ory window. If the file exists, a prompt "Overwrite
(Y or N)?" is displayed.
SEDIT - Page 17

5.7 Locate
───────────
Moves the cursor to a specified symbol or type and value. It the
resource is found, the cursor is moved onto the resource. If not
found, an error message is displayed.

├────────────────────────────────────────────────────────────────────────────────┤
│ LOCATE: Symbol name Type and value <ESC> │
└────────────────────────────────────────────────────────────────────────────────┘

Locate Type and value:


Searches for the specified type and value, as entered
in the TYPE AND VALUE column.

Locate Symbol name:


Searches for the specified symbol name as entered
in the SYMBOL NAME column or referenced by a Text
or Data Block. The search is not case sensitive,
"ONSWITCH" = "OnSwitch".

5.8 Global
───────────
Any resource which has been defined with a symbol name and a type
and value can be flagged as global (PUBLic) with this command. When
a symbol is global, a 'G' is displayed in the scope column. The
"Global" command toggles the resource's scope between global and
local.

Global symbols can be referenced by other modules, and are used so


that the actual type and value of the symbol is defined only in one
module, and not in every module which references it. This prevents
the same symbol being defined with a different types and/or values
in other modules.

To reference a global symbol defined in another module, define only


the symbol name and its automatic comment, and set the symbol's scope
to external using the "eXternal" command. When the modules are linked,
the symbol's type and value are taken from the module where it is
defined as global.

See section 11.1, and the "Block Global" command.

5.9 External
─────────────
This command makes the resource which the cursor is on into a
resource which is defined externally. External resources are marked
with an 'X' in the scope column. The resource must be declared
global in another module using the "Global" command. When the
modules are assembled and linked together, external resources are
matched with their global counterparts. The "eXternal" command
toggles the reseource's scope between local and external. External
resources cannot have a type and value, only a symbol name and an
automatic comment. (External symbols which are PB, FB and SB types,
referenced by CPB, CFB and CSB instructions *ARE* given a type,
but no value.)

See also the "Block eXternal" command.


SEDIT - Page 18

5.10 Print
───────────
Prints the resource list as it is currently sorted. Ensure the
printer is ready, then press Enter to start the print. Escape can
be used to abort the print at any time.

Page formatting is done as defined on the PCD Programming Utilities


"Configure" menu. If printer initialisation and de-initialisation
strings are defined, these are sent to the printer before and after
each print. The same is true for the "Block Print" commands.

5.11 File
──────────
Can load or save resources to or from a file, display the contents
of any directory on any disk, or execute any DOS command.

When saving files, if a file exists with the same name (the original
file) it is renamed to "filename.BAK", so it can be restored in case
of error.

├────────────────────────────────────────────────────────────────────────────────┤
│ FILE: Load resources Save resources Directory dOs command <ESC> │
└────────────────────────────────────────────────────────────────────────────────┘

File Load resources:


Loads the resources and Function Block parameter
definitions from a source module (.SRC), and adds
them to the resource list. If the resource is
already defined using a symbol name, then the type,
value and automatic comment from the resource in
the file replaces the existing values. The list is
re-sorted after the resources are loaded. The name
of the file must be entered first, or press F5 to
select a file name from the directory window.

File Save resources:


Saves all the resources into the specified file
(.SRC), the name of the destination file must be
entered first, or press F5 to select a file from
the directory window. If the file already exists, a
prompt "Overwrite (Y or N)?" is displayed. Resources
are saved as lines of EQUate or DOC statements, and
can be read with the "File Load resources" command.
See also "Block Save" in section 5.6.

File Directory: See sections 3.8 and 14.

File dOs command: See section 3.8.

5.12 Quit
──────────
See section 3.9.
SEDIT - Page 19

6. THE KEYBOARD
════════════════

Cursor movement keys:

Left Arrow If at the start of a field, moves to the previous


field on the left, otherwise moves small cursor
left within the field.
Right Arrow If at the end of a field or on an empty field,
moves the cursor to next field on the right,
otherwise moves small cursor right within the
field.
Up Arrow Up one line, cursor remains on same field.
Down Arrow Down one line, cursor remains on same field.
Enter Down one line, cursor moves to first field on
next line. If at end of file, inserts a new line.
Tab Next field to the right.
BackTab Next field to the left.
Home, End Start or end of field.
Ctrl+Home First line, first field.
Ctrl+End Last line, last field.
PgUp Up a screen (cursor remains on same field).
PgDn Down a screen (cursor remains on same field).

Editing keys:

Ins Toggles between insert and overtype mode. When


in insert mode, characters can be inserted in
the text of a field. Insert is disabled if the
field is full, note that spaces at the end of
a field are treated as characters. When in insert
mode a block cursor is shown, when in overtype
mode an underline cursor is shown. To enter
spaces at the start of an automatic or user
comment, insert mode must be on otherwise the
space key will move the cursor to the first field
on the next line. Whenever the cursor is moved to
another field, the mode is set back to overtype
mode.

Del Deletes the character under the cursor, characters


to the right are shifted left.
BackSpace Deletes the character to the left of the cursor,
characters to the right are shifted left.

Other keys:

Alt or Ctrl Displays the command prompt.


Function Keys Execute commonly used commands, see next page.
Esc Either an "undo" function, which restores the
original data to an edited entry field; or "quit"
if no data has been entered; or "abort".
If entering a command on line 24, or entering a
file name or search string, pressing Escape aborts
the command, returning the cursor to the screen.
Escape also aborts any "(Y or N)?" questions.
SEDIT - Page 20

The keyboard continued


──────────────────────
The function keys F1-F10 can be used to execute some common commands
and to display help information:

╔═════╤═════╗
Help ║ F1 │ F2 ║ Save and exit │ The "File Save code"
╟─────┼─────╢ │ command also saves
Instruction Info ║ F3 │ F4 ║ Save, don't exit │ the file.
╟─────┼─────╢
File Directory ║ F5 │ F6 ║ Locate Next, repeats a Locate command
╟─────┼─────╢ (Edit screen only)
Editor/Resources ║ F7 │ F8 ║ Comment/Sort
╟─────┼─────╢
Left Field ║ F9 │ F10 ║ Right Field
╚═════╧═════╝

F1 Help Displays the help screens, see section 7.1.

F2 Save and exit Saves the code in the work file and exits to
DOS or the PCD Utilities menu. If the file
exists, it is overwritten. If no file name
has been supplied (editing a new file), the
user is prompted to enter a file name.

F3 Instruction Info Displays information on the instruction which


the cursor is on, see section 7.2.

F4 Save, don't exit Saves the code in the work file, but does not
exit. Editing can continue. If the file exists
it is overwritten. If no file name has been
supplied (editing a new file), the user is
prompted to enter a file name.

F5 File Directory Displays the directory window as described in


section 14. All files are displayed, no file
name mask can be entered.

F6 Locate Next Repeats the previous "Locate" command, edit


screen only.

F7 Editor/Resources Changes from the edit scren to the resource


screen and back again.

F8 Comment/Sort If on the edit screen, this switches the


comment column between displaying automatic
and user comments. If on the resource screen,
this re-sorts the resource list to be sorted
by symbol name or by type and value.

F9 Left Field These two keys are conveniently positioned


F10 Right Field on the IBM AT style keyboard, so that they
can be used for fast movement to the left
or right-hand fields. They have the same
function as the tab and backtab keys.

F11 (SHIFT+F1) Moves the cursor to the previous or the next


F12 (SHIFT+F2) highlighted error.
SEDIT - Page 21

7. HELP
════════

Using the F1 and F3 keys, help information is displayed. Press Escape


to clear the help and return to the edit or resource screens.

7.1 F1 Help
────────────
SEDIT is supplied with a HyperHelp system. F1 displays the main help
index. A topic can be selected by moving the cursor onto a high-
lighted item, then pressing Enter. Help texts are stored in the file
SEDIT.HLP, this file contains some binary data and CANNOT be printed.

These keys have special significance when displaying help:

F1 Returns to the help index.

F9, F10 F9 moves back to the previous help screen that was disp-
layed, F10 moves to the next help screen. A circular
buffer of the last 50 help screens is stored, F9 and F10
can be used to retrace the help path.

PgUp,PgDn Displays the help screens in the order in which they are
catalogued. Some help items have more than one screen,
indicated by --More-->, pressing PgDn displays the next
page, PgUp displays the previous page.

Home,End Moves the cursor to the first or the last highlighted help
item on the screen.

Arrows, Move the cursor to select a highlighted help item. Pressing


Enter displays the help screen of the selected item.

ESCape Exits help, and returns to the edit or resource screen.

7.2 F3 Instruction info


────────────────────────
If the cursor is on an instruction when F3 is pressed, a help page
describing the instruction is displayed. If the cursor is on a
Text or Data Block line, help on these is displayed. If on any other
type of line, an index of instruction mnemonics is displayed, and an
instruction can be chosen from the list by moving the cursor to the
instruction and pressing Enter.
SEDIT - Page 22

F3 Instruction info continued


─────────────────────────────

Instruction information display example:


┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD CODE EDITOR V2.1 MODULE: DEMO.SRC │
├────────────────────────────────────────────────────────────────────────────────┤
│ LDH LOAD HIGH WORD (UPPER 16 BITS) = │
│────────────────────────────────────────────────────────────────────────────────│
│ DESCRIPTION: Loads the upper 16 bits (16-31) of a Register, the lower 16 bits │
│ are not affected. LDH (and LDL, Load Low) allow 16-bit constants │
│ to be passed as Function Block parameters, or loaded directly. │
│ Using these instructions, a 32-bit value can be loaded. To load │
│ all 32 bits, LDL must be executed first, because this sets the │
│ upper 16 bits to zero (0). Values can be loaded in decimal, hex, │
│ Ascii or binary, NOT floating point. LDH cannot be used to load │
│ Timers or Counters, where the upper 16 bits cannot be loaded │
│ separately. │
│ │
│ USAGE: LDH[X] element (i) ; R 0-4095 │
│ value ; 0-65535 decimal, 0H-FFFFH Hexadecimal. │
│ │
│ EXAMPLE: LDH R 100 ; Loads bits 31-16 of Register 100 with │
│ FFFFH ; FFFF hex. R 100 = FFFFxxxx Hex. │
│ │
│ FLAGS: Unchanged. │
│ │
│ SEE ALSO: LDL, LD, Constants. │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ HELP: Select a highlighted help item using the arrow keys, then press ENTER. │
│ Use PGUP and PGDN to view pages, ESCape exits. F1=Index F9=Back F10=Forward │
└────────────────────────────────────────────────────────────────────────────────┘

A help page for every instruction in the PCD instruction set is


provided. For each instruction, the mnemonic(s) and the instruction
name are shown on the top line. Some instructions have two mnemonics,
the second mnemonic ends with an 'X' and means that the instruction
supports indexed addressing, indexed operands are marked with "(i)".
An 'A' on the top line means it is ACCU dependent, an '=' means it
accepts FB parameters (e.g. STH =1).

Each help page has these sections:

DESCRIPTION Describes what the instruction does and its operands.


USAGE Shows how the instruction is used, and gives the
types and ranges of each operand. An "[X]" after the
operand means that indexed addressing is possible by
adding the optional 'X' to the mnemonic (e.g. STHX,
INCX). For indexed addressing, the indexed operands
are marked with "(i)".
EXAMPLE A typical example of how the instruction is used.
FLAGS Shows which status flags are affected (ACCU, P, N,
Z, E).
SEE ALSO A list of other instructions or topics which may be
useful, these are also highlighted help items.
SEDIT - Page 23

8. FUNCTION BLOCKS AND PARAMETERS


══════════════════════════════════

8.1 Defining a Function Block


──────────────────────────────
Before calling a Function Block (FB) with the CFB instruction, the
FB and its parameter list (if required) should be defined. For FBs
defined in other modules, the parameter definitions can be loaded
with the "File Fbs" command (see 3.8), the "File Load resources"
command (see 5.11), or the module can be $INCLUDEd (see 8.3).

To define a Function Block, enter the FB instruction and the FB


number. The parameters should be defined on the lines immediately
after the FB instruction. To enter a parameter definition, first
type '=' in the mnemonic field. Parameter numbers (=1, =2 etc.)
are generated automatically when the cursor is moved to the operand
field, where the parameter's type must be entered as a single
character. Parameters without a type cannot be referenced.

These are the possible FB parameter types:

TYPE DESCRIPTION RANGE


────────────────────────────────────────────────────────────────
I Input I 0 - I 8191
O Output O 0 - I 8191
F Flag F 0 - F 8191
T Timer T 0 - T 450
C Counter C 0 - C 1599
R Register R 0 - R 4095
K K constant K 0 - K 16383
X teXt X 0 - 7999 (with or without the X)
D Data Block DB 0 - 7999
S Semaphore 0 - 99 (not used at present)
W Word -20 - 65535 (for any untyped constant
in LDH, LDL etc.)
A Algi/Algo 0 0 - 7 8180 (channel + base I/O address)
M MOV data type Q 0 - Q 31, D 0 - D 9 etc.

The parameter type is used for checking parameters when they are
entered after the CFB call. It is also used to check that the param-
eter is used correctly within the FB. For example, the instruction
"STH =1" generates an error if parameter 1 is defined as a register.
If parameter 1 is a register, and "I 0" were entered as parameter
1 of a CFB instruction, an error is also generated.

Each parameter can also be given a name (up to 9 characters) in the


symbol field, and an automatic comment in the comment field. The name
and automatic comment are displayed wherever the parameter is refer-
enced inside the Function Block, and are displayed on the prompt line
when entering the CFB parameter lists (see next page).

Parameters can be inserted or deleted from the list using the


"Insert" and "Delete" commands, and all the subsequent parameter
numbers are automatically updated.

To reference a parameter from within the Function Block, type "=n"


in the operand field for parameter n, or type the parameters name,
preceded by "=" in the symbol field "=Name". The parameter name,
number and comment will be displayed.

FB parameters cannot have the same name as any other resource.


SEDIT - Page 24

8.2 Calling a Function Block


─────────────────────────────
When calling a Function Block with the CFB instruction, the list
of parameters (if required) must be entered. If the FB definition is
available, lines are inserted to make space for the correct number
of parameters when the CFB instruction is entered. If the parameter
has not been defined, a warning is issued.

When the cursor is moved into the operand field of a parameter, the
prompt line shows a description of the parameter to be entered. The
parameter number, its name, the type, valid values and the automatic
comment (all as entered when the parameter was defined) are shown:
├────────────────────────────────────────────────────────────────────────────────┤
│ FB PARAMETER 1: Fred I 0-8191 Automatic comment for Fred │
└────────────────────────────────────────────────────────────────────────────────┘
| | | | |
| | | | +---- Automatic comment
| | | +------------------- Value range (added by SEDIT)
| | +----------------------- Parameter type
| +-------------------------------- Parameter name
+------------------------------------- Parameter number

It is not possible to enter a parameter with the wrong type or value.

*** NOTE ***

If the Function Block definition is not available, a warning is


issued. The CFB can still be entered with parameters, but the
parameter prompting does not occur. FB parameter definitions can
be loaded from other source files with the "File Fbs" or "File Load
resources" commands.

If parameters are added to a Function Block definition after CFB


instructions have been entered or the FB paramater definitions have
been loaded, prompts for the new parameters are not shown in the
CFB parameter list unless the CFB instruction is re-entered. The
parameters can still be added to a CFB if definitions are not
available.

8.3 Using FBs defined in another module


────────────────────────────────────────
The $INCLUDE directive can be used to include a module containing
Function Block definitions. However, the included code is also
included when the module is assembled, and the FB code is repeated
many times (this generates a "multi-defined FB" error when the
modules are linked).

To overcome this problem, the $IFNINC conditional assembly directive


can be used. Define all the Function Blocks between $IFNINC and
$ENDIF directives. The Function Block code is then only assembled
when the include file is assembled separately, it is not assembled
in each module which $INCLUDEs it.

The demonstration files FBDEMO1.SRC and FBDEMO2.SRC illustrate this


method.
SEDIT - Page 25

9. COMMENTING THE PROGRAM


══════════════════════════

SEDIT supports three types of comments. The Documentation Generator


(SDOC) has switches which allow selection of which comments will
appear in the documentation file (.DOC).

Any characters, including foreign characters can be used in


comments.

a) Comment lines
─────────────────
These use a complete line (up to 80 characters). To enter a line
comment, move the cursor into the label field (far left), and type
a colon ';' character in the first position to define the line as
a comment line. Type the comment on the rest of the line.

*** WARNING ***

Texts and Data Blocks are defined in comment lines, therefore a


comment line MUST NOT begin with the words TEXT or DB, or the
character '"'.

b) User comments
─────────────────
These comments are entered in the comment field on the right. They
can be entered only if user comments have been selected for display
in this field with the "Comments" command or with function key F8.
User comments should be used to describe what the program is actually
doing.

c) Automatic comments
----------------------
These are automatically displayed in the comment field on the right
if automatic comments have been selected for display using the
"Comments" command or F8. Automatic comments can be used to describe
the resource (what it is, its location, wiring information etc).
SEDIT - Page 26

10. TEXTS AND DATA BLOCKS


══════════════════════════

NOTE: SEDIT was not designed for ease of enetring Texts and Data
Blocks. For applications with a large number of Texts or DBs it will
be easier to edit these in a separate source module using a standard
ASCII editor, and "$include" this module, or assemble and link it.

In SEDIT, Texts and Data Blocks are entered as comment lines, with a
';' in the first position of the label field. The ';' character is
removed by SEDIT when the line is saved to the source file. When a
source file is read, any Text or Data Block lines are turned back into
comments so that SEDIT can handle them. Entering these as comments
allows SEDIT's full line editing facilities to be used.

10.1 Texts
───────────
A Text is defined on a comment line as follows:

; TEXT number [length] "The text itself" ; comment


; "more text" ; comment

The "number" can be a symbol (with an optional offset), or an


absolute value. The optional "[length]" is the size of the text in
characters, which can be a symbol or absolute value (the [ and ]
are required). The text itself is defined in inverted commas, and
can occupy one or more lines. Symbols can also be used inside Texts,
see the help screens or the Assembler documentation for details.

Texts can contain ASCII characters with decimal codes 32..126 (' '..
'~'). Other characters (control characters with codes 1..31 or
special characters 127..255) can be entered as either decimal numbers
or ASCII mnemonics enclosed in angle brackets, e.g. <255> <10> <13>
<STX> <CR> <LF> <SOT>. Characters with codes 128..255 can be entered
as the IBM extended ASCII characters (e.g. foreign language characters
Ä, ü etc, and graphics characters « õ ┌ ┐ ╔ ║ etc). If the keyboard
cannot produce the character, it can be entered by holding down the
ALT key and typing its decimal ASCII code on the numeric keypad, the
character is displayed when ALT is released. To insert an angle
bracket or a double inverted comma into the text, these must also be
entered in angle brackets, e.g. <<> <>> <">

The ASCII code 0 (NUL) is NOT allowed in texts 0..3999 because NUL is
used as the text terminator. The first character of a text 0..3999
should NOT be 253, 254 or 255 (FD..FF hex), these are reserved to
indicate that the text is a binary LAN text or a Data Block. Texts
4000..7999, in extension memory, do not have these restrictions.
Texts can be any number of lines, up to a total size of 3072 (3K)
characters.

Text examples:
6
SEDIT - Page 27

10.1.1 Using symbols in texts


──────────────────────────────
To use the value of a symbol in a text, without having to enter an
absolute value, the symbols can be entered as follows (examples on
next page):

;TEXT number "text", [ symbol[+offset][.format], ]... "text" ...

Separate the "text" and the symbols using commas. The value of the
symbol is inserted into the text by the Assembler. The optional
".format" must be separated from the symbol name by '.' (no spaces).
The format defines the width of the field for the number, whether the
number is to be left or right justified in this field, whether it
should have leading zeros, and whether it should be prefixed by the
symbol's type. Symbols are added to the resource list.

.format is: .[-][0]width[t|T] ( [..] means optional )


- Left justify the number in the field (default is
right justified)
0 Padd to the left with leading zeros, if width given
width Field width 1..20
t or T t = prefix with lower case medium type, T = upper
cas (o,f,c,k,O,F,C,K, I set to O, T set to C)

Examples: Assume DiagFlag is F 64, DiagReg is R 300, BaudRate is


9600, INPUT is I 64, FLAG is F 100.

;TEXT 0 "UART:",BaudRate,",7,E,1;" ; Text 0 is "UART:9600,7,E,1;"


;"DIAG:", DiagFlag.T, ",", DiagReg.T, ";" ; "DIAG:F64,R300;"
;TEXT 1 "$",INPUT.04T ; Text 1 is "$O0001"
;TEXT 2 "10:",INPUT.T,"-",INPUT+15,":",FLAG.T,"-",FLAG+15
; Text 2 is "10:O1-16:F100-115"
;TEXT 3 "",FLAG+100.04T," ",1234.05 ; Text 3 is "F0200 01234"
;TEXT 4 "0123",456,"78",10-1 ; Text 4 is "0123456789"

*** NOTES ***

If a symbol is used in the text, it is automatically added to the


resource list. If the symbol name is subsequently changed from the
resource screen, the symbol name in the text is NOT updated. If the
type is I (Input), it is converted to O (Output). If the type is T
(Timer), it is converted to C (Counter). This is for LAN text
compatibility. For the Assembler I/O and T/C are the same type.

Texts and Data Blocks share the same addresses (0-7999), i.e. if
TEXT 0 exists, then DB 0 cannot be used.
SEDIT - Page 28

10.2 Data Blocks


─────────────────
A Data Block (DB) stores an array of 32-bit values. DBs 0..3999 are
stored in Text memory, and can hold up to 383 values (0..382). DBs
4000..7999 are in extension memory, and can hold up to 16384 values
(0..16383).

The PUT instruction copies data from Registers/Timers/Counters into a


DB, the GET instruction copies data from a DB into a block of R/T/C,
the number of values copied depends on the number of elements in the
DB. The TFR instruction transfers single elements. With SEDIT, Data
Blocks must be entered in comment lines:

; DB number '[' [length] ']' [value1 [, value2]...]

The length of the DB is defined in square brackets, e.g. DB 10 [100],


followed by an optional list of initializer values, separated by
commas. The length may be left blank, e.g. DB 10 [], in which case
the length is determined from the number of initializers. Initializer
values can be decimal, hex, floating point, ASCII or any expression.

If the DB definition occupies more than one line, the preceding line
must end with a comma ',', so SEDIT knows that more values are
expected.

If symbols are used as data values, the symbol names are added to
the resource list. Data Blocks can have comments on the same line,
as shown below.

Data Block examples:


│ PUT R 0 DestReg │
│ DB 101 │
│ ECOB │
│ │
│; DB 100 [10] ; DB 100 holds 10 items, all set to 0 │
│; DB 101 1,2,3,4.1 ; DB 101 holds 4 items, set to 1, 2, 3 and 4.1 │
│; DB 102[4] 1,2,3 ; DB 102 holds 4 items, set to 1, 2, 3, 0 │
│; DB DATA[LEN] VAL1,,,4H ; DB DATA holds LEN items, set to VAL1, 0, 0, 4 │
│ │
│; This Data Block occupies more than one line (previous line ends in ','): │
│ │
│; DB BigDat [BigDatLen] MaxCount, StartPoint, SetPoint, EndPoint, 45, │
│; TopEnd, BottomEnd, Offset, Direction, │
│; 0, 99, 45 │
│ ════ End of module ════ │

*** NOTES ***

Data Blocks and @Texts@ share the same addresses (0-7999), if DB 0


exists, then TEXT 0 cannot be used.
The PCD2 has only Texts and DBs 0..5999.
SEDIT - Page 29

11. ASSEMBLING AND LINKING


═══════════════════════════

When editing of the program module is complete, it can be assembled


with the "File Assemble" command. This writes it back to the file,
invokes SASM, then returns to SEDIT. Any errors detected by the
assembler can then be viewed and corrected, see section 12.3. The
F11 (SHIFT+F1) and F12 (SHIFT+F2) keys, or the "Locate Error"
command can be used to locate the error lines.

Once the program assembles without errors, exit SEDIT, ensuring that
the file is saved, using F2 or "Quit". The file must then be linked
using the "Link" option from the main menu (or SLINK from the DOS
prompt). The file can also be assembled from the "Assemble" menu, or
SASM from the DOS prompt.

If writing a very large program, it should be separated into several


smaller modules, of up to about 3000 lines each - we recommend a
maximum of about 1000 lines per module, for speed. These modules must
be linked together to produce a single executable file (.PCD) (see
"modular programming" in section 11.1). Even if there is only one
module, it must still be linked to produce a PCD file.

The linked PCD file can then be loaded into the PCD using the
"Up/download" option from the main menu, or using "Debug".

11.1 Modular programming and global resources


──────────────────────────────────────────────
SEDIT can handle a single source module of up to about 3000 lines
of code, depending on your IBM PC's memory size and the number of
comments and symbols in the program. In order to write a larger
program, it must be separated into several smaller source modules.
We recommend a maximum of 1000 lines per module, for speed. These
modules are edited and assembled separately, and are then linked
together using the "Link" operation.

Each module will typically contain one COB, and a set of PBs and
FBs. A library of PBs and FBs can also be developed, placing these
in a separate source file, which can then be linked with other
modules to produce the program.

When more than one module is used, it will be necessary to share


some resources between the modules. These are called the "Global
resources". Each global resource should be defined ONLY ONCE in
the program, otherwise definitions of the same resource could be
assigned different symbol names or types/values, causing errors in
the program.

SEDIT provides two methods for managing global resources:

1) Global resources can be defined in an include file. This file


is edited separately, and included at the start of any module
which needs to reference the global resources by the use of the
$INCLUDE directive, see section 11.2.
SEDIT - Page 30

Modular programming and global resources - continued


────────────────────────────────────────────────────

2) Global resources are defined in only one of the modules, and


are declared global using the "Global" command from the resource
screen, see section 5.8. To reference global resources from the
other modules, the symbol name must be entered, and declared as
external using the "eXternal" command, see section 5.9. Symbols
which are declared external are stored in the source file with
the "EXTN" declaration.

Additionally, resources and Function Block parameters which are


defined in other modules can be loaded using the "File Load
resources" command (from the resource screen). Function Block
parameter definitions can only be loaded from other modules using
the "File Fbs" command (from the edit screen). See section 8.3 for
a better method of managing global Function Block parameter
definitions.

11.2 Include files


───────────────────
Include files are source files which can be edited as a separate
file, and are included at the start of a module using the $INCLUDE
assembler directive:

$INCLUDE filename

The "filename" can contain a drive, path and file extension, for
example D:\FRED\GLOBALS.INC. The $INCLUDE directive must be entered
in the label field, see section 2.7(b).

SEDIT reads the include file and adds any resources defined in the
file into the resource table. Resources defined in an include file
are marked with an 'I' in the "IS" column of the resource screen,
see section 4. If any FBs are defined in the include file, the FB
parameter definitions are also read.

SEDIT ignores any code contained in the include file - but the
assembler will process this code as though it were part of the
source module.

When the source file which contains included files is assembled,


the assembler also reads and assembles the include files. Any code
which is defined in the include file is also assembled. It is
possible to prevent the code being assembled in every module which
includes the file, this can be done using the conditional directive
$IFDEF, see sections 8.3 and 11.3.

Include files are typically used to define "Global resources", where


the resource is defined only once in one module, and can be shared
by any module which includes the file. Include files can also be
used to define sections of code which are often repeated.

*** NOTE ***

Graftec programs, created with the Graftec editor SGRAF, must not
use $INCLUDE files. SGRAF does not support this directive.
SEDIT - Page 31

11.3 Conditional assembly


──────────────────────────
Sections of a program can be included or skipped according to a
"conditional assembly" directive. This feature can be used to
assemble a different program according to the value of a symbol
or to patch out a section of code. "$IF" is used, followed by an
expression or symbol name. Refer to the Assembler documentation
for details of expressions.
$IF statements can be nested up to 10 deep. $IF statements are not
processed by SEDIT, they are processed only when the module is
assembled.

Format:

$IFxxx <expression> ; If <expression> is true (not zero)


... ; then assemble this code
$ELSExxxx ; else (the ELSE clause is optional)
... ; assemble this code. Other $IF..$ENDIF
$ENDIF ; statements can be placed between
; $IF..$ENDIF and $ELSE..ENDIF.
These are the $IF directives:

$IF <expression> If result of <expression> is true (not zero).


$IFN <expression> If result of <expression> is false (zero).
$IFDEF <symbol> If <symbol> IS defined as a resource or label.
$IFNDEF <symbol> If <symbol> is NOT defined as a resource or
label.
$IFINC If $INCLUDE file (TRUE if this module has been
included in another module).
$IFNINC If not $INCLUDE file (TRUE if module is main
module).
$ELSE $ELSExxx directives can follow $IFxxx.
$ELSEIF <expression> $ELSEIFN <expression>
$ELSEIFDEF <symbol> $ELSEIFNDEF <symbol>
$ELSEIFINC $ELSEIFNINC

To patch out a section of code without deleting it use $IF 0 (0 is


always false) or $SKIP..$ENDSKIP. When the section of code is needed
again, delete the directives, or change $IF 0 to $IF 1, any non-zero
value is always true. $IFDEF or $IFNDEF can also be used.

Example:
...
STH I 0
$IF 0 ; | This code has been patched out.
SET F 32 ; | When this code is needed again,
.... ; | change "$IF 0" to "$IF 1".
$ENDIF ; |
SET F 96

Conditional assembly is often used to produce slightly different


versions of a program, where most of the code is the same for the
two versions.

For example:

$IF Version=3 & !Testing ; If version 3 is needed, and the program


$INCLUDE VER3.INC ; is not being tested, then include file
$ENDIF ; VER3.INC here.
SEDIT - Page 32

12. ERRORS
═══════════

12.1 Source file errors


────────────────────────
When reading a source file which has not been created by SEDIT,
certain errors may occur, see section 13. If SEDIT cannot process
a line, or finds some error in the line, the line will be shown as
a comment in the edit screen and will be highlighted.

Function keys F11 (SHIFT+F1), F12 (SHIFT+F2) or the "Locate Error"


command can be used to move the cursor to the error. The "Errors"
count on the status line shows how many errors were found when
reading the file.

To correct errors in a multi-line instruction, it may be necessary


to delete and re-enter the entire instruction.

12.2 Edit errors


─────────────────
While editing the program and entering mnemonics, operands and
symbols, invalid data will be occasionally entered. This is
indicated by an error message and a beep. It is not possible to
move the cursor off a field containing invalid data. The data must
either be corrected or deleted. An empty field is not treated as
invalid by SEDIT, although this may generate an assembler error.

12.3 Assembler errors


──────────────────────
SEDIT purposely allows some invalid statements to be entered (see
next page). Any errors which are caused by an incomplete program
are ignored until the program is assembled.

If errors are found during assembly (with SASM V1.3 or above), they
are stored in a temporary error log file called SEDIT.ERR. When the
module is next edited using SEDIT, the SEDIT.ERR file is read and
any lines containing errors are highlighted. Some errors such as
missing operand, missing text etc. may highlight the line after the
error.

The error message is displayed if the cursor is moved onto the


highlighted line. The F11 (SHIFT+F1) and F12 (SHIFT+F2) keys, or
the "Locate Error" command can be used to move the cursor onto an
error. Errors should be corrected before the module is re-assembled.

The SEDIT.ERR file is deleted immediately after it is read by SEDIT.


Refer to the SASM assembler documentation for details of these
errors. Note that SEDIT adds 100 to the SASM error numbers to avoid
conflicts with the SEDIT error messages.

The "File Assemble" command assembles the module, allowing the


assembler to do the detailed error checking without exiting SEDIT.

Errors during linkage are usually due to external resources not


having an associated global, most other errors are eliminated by
SEDIT and the assembler. If errors do occur when one or more modules
are linked, the error messages are not available to SEDIT, the errors
will not be highlighted when the module is re-edited. You must find
the reason for the error and correct it in the relevant source module,
then re-assemble and link. Refer to the SLINK Linker documentation
for details of these errors.
SEDIT - Page 33

Assembler errors - continued


────────────────────────────

Function Block parameters can be double-checked using SFBREF, or by


supplying the /F switch to the linker SLINK.

Errors which are accepted by SEDIT, but are trapped by the assembler
SASM are:

* Use of a symbol with an invalid type or value because the type


or value has been changed from the resource screen.

* Jumps to undefined labels.

* Labels with the same name as a symbol.

* Instructions with missing operands (empty fields on the edit


screen).

* Block structure errors, missing/invalid start or end of block


instructions.

* Instructions outside a block.

* The contents of Texts and Data Blocks.

* Instructions where the valid operand range is dependent upon the


value of a preceding operand, such as MOV, TFR, STXM, SRXM etc.

12.4 Fatal errors


──────────────────
Fatal errors occur only if there is not enough memory to run SEDIT,
or an internal software error is detected. All other errors are
recoverable.

If a fatal error occurs, SEDIT cannot continue, pressing any key


exits to DOS or the PCD Programming Utilities' main menu.

NOTE: If a "FATAL INTERNAL ERROR" occurs, please report the full


error message to SAIA Murten immediately, so the problem can be
fixed.
SEDIT - Page 34

12.5 Error messages


────────────────────

FATAL ERROR 0: PROGRAM NOT LICENSED


The wrong PCDSETUP.DAT file has been accessed.

ERROR 1: INVALID FILE NAME: filename


The "name" is not a valid DOS file name. File names cannot
contain any IBM graphics characters, or any of these
characters:
* ? . " / [ ] | < > + = ; ,
A file name can contain an optional drive, path name and
extension (d:path\name.ext), e.g. "A:\FRED\SOURCE.001".

ERROR 2: CAN'T OPEN FILE: filename


The file cannot be found (for reads), or cannot be created
(for writes). For reads, a drive or path name may be needed.
For writes, either the disk is full, the diskette is not
correctly inserted, the diskette has not been formatted, or
the destination file is read-only.

ERROR 3: READ ERROR ON FILE


The file could not be successfully read due to a disk error.

ERROR 4: WRITE ERROR ON FILE


The disk is full or is not formatted.

ERROR 5: PRINTER NOT READY


The printer must be connected to parallel port 1 (LPT1),
must be switched on, have paper and must be on-line.

ERROR 6: HELP FILE (SEDIT.HLP) NOT FOUND


The file SEDIT.HLP must be in the PCD directory with the
other PCD programs (SEDIT.EXE, SASM.EXE etc). The command
"SET PCD=d:directory" must be in the AUTOEXEC.BAT file,
where d:\directory is the drive and directory where the
other PCD Programming Utilities programs are found.

ERROR 7: INVALID HELP FILE: SEDIT.HLP


The help file is the wrong version for this version of
SEDIT. Copy the correct help file from the distribution
diskette into the PCD Programming Utilities directory.

ERROR 10: OUT OF MEMORY


ERROR 11: OUT OF SYMBOL SPACE
There is not enough memory available to continue editing.
Caused by trying to edit a single module which is too large.
For indication that this is about to occur, see the "Free
memory" value on the status line.

The module can be split into two or more smaller modules


(using "Block Save"), and linked together (see section 11).
These errors can also be caused by having a large memory
resident program installed. Norton Commander or RAM disks
are the usual culprits. Remove any memory resident programs
and try again. More memory is available if SEDIT is run
directly from DOS, rather than from the PCD Programming
Utilities menu.
SEDIT - Page 35

ERROR 12: OUT OF ENVIRONMENT SPACE


The DOS environment is a section of memory used to store
defined strings such as the PATH. SEDIT uses the environment
when the "File Assemble" command is executed. To cure this
error, shorten the "PATH=..." command in AUTOEXEC.BAT and
remove unwanted "SET x=..." strings, or increase the
environment size with the DOS SHELL command.

WARNING 13: INSTRUCTION HAS MISSING OPERAND: Line n


WARNING 14: RESOURCE HAS MISSING TYPE/VALUE: name
These warnings indicate that an incomplete program is being
saved in a file. The file will not assemble correctly.

ERROR 15: INVALID MNEMONIC


ERROR 16: INVALID VALUE
ERROR 17: INVALID TYPE OR VALUE
ERROR 18: ADDRESS TOO BIG
ERROR 19: INVALID OPERAND
The data just entered is invalid. It must be corrected or
deleted before the cursor can be moved or a command
executed.

ERROR 20: NO LABEL OR COMMENT ALLOWED HERE


ERROR 21: MNEMONIC NOT ALLOWED HERE
ERROR 22: OPERAND NOT ALLOWED HERE
ERROR 23: SYMBOL NOT ALLOWED HERE
An attempt has been made to enter data into a protected
field: Labels cannot be entered on a line which does not
contain a mnemonic. Mnemonics cannot be entered inside
multi-line instructions. Operands and symbols cannot be
entered if the instruction doesn't need any operands.

ERROR 24: SYMBOL DEFINITION INCOMPLETE


Symbols cannot be made public with the "Global" command
unless they have a symbol name and a type and value.

ERROR 25: SYMBOLS MUST BE MORE THAN ONE CHARACTER


ERROR 26: SYMBOLS CANNOT BEGIN WITH A NUMBER
ERROR 27: CANNOT USE MNEMONIC OR RESERVED WORD AS SYMBOL
ERROR 28: INVALID CHARACTER(S) IN SYMBOL
Symbol names can be up to 10 characters long, and can
contain the characters A-Z, a-z, 0-9, foreign characters
(ä, à, å etc.) or '_' (underline).

ERROR 29: SYMBOLIC OPERANDS NOT ALLOWED FOR MOV DATA TYPES
The MOV instruction does not allow the data type to be a
symbol, it must be an absolute value.

ERROR 30: SYMBOL HAS INVALID TYPE OR VALUE


When a symbol name is entered as an operand, the type and
value assigned to the name from the resource screen is
checked as if it was entered in the operand field. In
this context it is invalid.
SEDIT - Page 36

ERROR 31: SYMBOL ALREADY DEFINED: name


ERROR 32: RESOURCE ALREADY DEFINED: type/value
The resource is already defined. No two resources can have
the same name or the same type and value. Labels, resources
and FB parameters must all have unique names.

ERROR 33: INVALID OFFSET (+0 to +127)


The offset entered in the symbol field is invalid. The
offset can be between +0 and +127, negative offsets are
not allowed, e.g. BASE+1, XFlags+64.

ERROR 34: OFFSET NOT ALLOWED FOR THIS TYPE


Certain symbol and operand types cannot be given offsets.
Offsets are allowed only for I, O, F, T, C, R, K and
integer constant types. They are not allowed for blocks
(COB, PB etc) or for floating point numbers.

ERROR 35: LABELS MUST BE MORE THAN ONE CHARACTER


ERROR 36: LABELS CANNOT BEGIN WITH A NUMBER
ERROR 37: CANNOT USE MNEMONIC OR RESERVED WORD AS LABEL
ERROR 38: INVALID CHARACTER(S) IN LABEL
ERROR 39: LABEL TOO LONG (MAX. 6 CHARACTERS)
Labels can contain characters A-Z, digits 0-9 or the '_'
underline character. Labels cannot begin with a digit, and
must be between 2 and 6 characters long. Mnemonics and
other reserved words cannot be used as labels.

ERROR 40: CANNOT INSERT LINES WITHIN AN INSTRUCTION


ERROR 41: CANNOT DELETE INDIVIDUAL OPERANDS, ONLY ENTIRE INSTRUCTIONS
A single instruction is handled as a single entity by
SEDIT. It is not possible to insert or delete individual
operands of a multi-line instruction. The CFB instruction
and its parameters are treated as a single instruction,
so are ST, TR and RSB their parameter lists. To delete an
instruction, the cursor must be on the mnemonic line.
When the mnemonic line is deleted, all associated operand
lines are also deleted.

ERROR 42: RESOURCE ALREADY DEFINED AS: TEXT/DB n


Texts and Data Blocks share the same addressing. It is not
possible to define both a Text and a DB with the same number.

ERROR 45: CANNOT INSERT NEXT, CURSOR NOT ON A RESOURCE


To insert the next resource, the cursor must be placed on
a resource before the "Next" command is executed.

ERROR 46: CANNOT INSERT NEXT FOR THIS TYPE


The next resource cannot be inserted for floating point
values.

ERROR 47: CANNOT INSERT NEXT, LAST VALUE REACHED


The last possible resource has been defined, no more can
be inserted with the "Next" command.

ERROR 48: CANNOT INSERT NEXT, RESOURCE ALREADY DEFINED


The next resource is already defined, and cannot be
inserted with the "Next" command.
SEDIT - Page 37

ERROR 49: RESOURCE IS REFERENCED, CAN'T CHANGE ITS TYPE


If the resource is referenced by the program, its type
cannot be changed because the new type might be invalid in
the context where it is used. First create a new resource
with the correct type, then change all references to the
old resource to access the new one, then delete the old
resource.

ERROR 50: NO BLOCK MARKED


The "Block" command cannot be executed because nothing
has been marked.

ERROR 51: MUST MARK ENTIRE INSTRUCTION


Multi-line instructions must be marked by marking all
operand lines of the instruction, so that the entire
instruction can be processed.

ERROR 52: SOURCE AND TARGET CONFLICT


A marked block cannot be moved or copied onto itself.

ERROR 53: RESOURCE IS USED, IT CANNOT BE DELETED


From the resource screen, a resource definition cannot be
deleted if it is referenced by the program. To delete the
resource, first edit out all references to it from the
edit screen. References to it can be found with the
"Locate Operand" command.

WARNING 54: USED RESOURCES NOT DELETED


The "Block Delete" command from the resource screen deletes
only those resources which have not been used in the
program. Used resources are not deleted from the marked
block.

ERROR 55: CAN'T RENUMBER THIS TYPE


The "Block Renumber" command cannot renumber constants.

ERROR 56: ALL RESOURCES MUST HAVE THE SAME TYPE


The "Block Renumber" command can only renumber a marked
block of resources if they all have the same type.

ERROR 57: RESOURCE WILL BE MULTI-DEFINED


If the "Block Renumber" command is executed, renumbering
the resources will create two definitions of the same
resource.

ERROR 58: RESOURCE IS DEFINED IN AN INCLUDE FILE


The resource cannot be edited. It can be edited or altered
only by editing the include file where it is defined.

ERROR 59: LINE NUMBER n NOT PRESENT


"Locate line Number" command moves to the given line only
if the line exists.
SEDIT - Page 38

ERROR 60: LABEL NOT FOUND: label


ERROR 61: MNEMONIC NOT FOUND: mnemonic
ERROR 62: TYPE/VALUE NOT FOUND: [type] value
ERROR 63: SYMBOL NOT FOUND: name
ERROR 64: NO ERRORS FOUND
ERROR 65: VALUE NOT FOUND: value
The "Locate" command has searched from the cursor line to
the end of the file, and the item was not found. To search
from the start of the file, the cursor must be on the 1st
line.

ERROR 66: LOCATE COMMAND NOT ENTERED


The "Locate neXt" command, or function key F6 cannot be
processed because no "Locate" command has been entered yet.

WARNING 67: MULTI-DEFINED BLOCK


The COB, XOB, PB or FB is already defined in the module.
For FBs, the FB mignt be defined in the module from which
FB parameter definitions were loaded with the "File Fbs"
command.

ERROR 68: EXTERNAL'S CAN'T HAVE LOCAL TYPE AND VALUE


A resource cannot be made external if it already has a
local type and value. The type and value of an external
is defined in another module.

ERROR 69: SYMBOL ALREADY GLOBAL/EXTERNAL


A symbol can't be both global and external at the same time!

ERROR 70: INVALID FB PARAMETER


The type given to the Function Block parameter is not valid
in this instruction. See section 8.

ERROR 71: FB PARAMETER NOT DEFINED


The Function Block parameter has no definition.

ERROR 72: FB PARAMETER HAS NO TYPE


Before a Function Block parameter can be referenced, it
must be given a type where it is defined after the FB
instruction. See section 8.1.

ERROR 73: FB PARAMETER NUMBER CANNOT BE EDITED


Function Block parameter numbers are generated auto-
matically. They can be changed only by inserting and
deleting parameter definitions. Parameter numbers must
be consecutive.

ERROR 74: FB PARAMETER NAME ALREADY DEFINED


The symbolic name for the Function Block parameter has
already been used. The same names can be used for the
parameters of different FBs.

WARNING 75: FB PARAMETER DEFINITIONS NOT FOUND


The parameters for the CFB instruction just entered have
not been defined. Editing can continue as normal, but the
FB parameter prompts cannot be displayed and the parameters
cannot be checked when they are entered. Parameter def-
initions can be loaded from another module with the "File
Fbs" command.
SEDIT - Page 39

ERROR 76: MORE THAN 255 FB PAREMETERS


Inserting a new Function Block parameter will create more
than the maximum of 255 parameters.

ERROR 77: FB PARAMETER(S) USED, CANNOT DELETE


The Function Block parameter is referenced in the FB, and
cannot be deleted. This error is also given when attempting
to delete a marked block containing FB parameter def-
initions unless all the references are included in the
marked block, and will also be deleted.

ERROR 78: FB <n> ALREADY DEFINED WITH DIFFERENT NAME OR NUMBER


The function block definition read in from another file
(using "File Fbs" or "File Load resources") is already in
the resource table, but has a different definition.

ERROR 79: SYMBOL ALREADY DEFINED AS FB PARAMETER NAME


The symbol is already used as the name of an FB parameter.

ERROR 80: INVALID TEXT NUMBER


The text number is out of range (0..7999) or contains
invalid characters.

ERROR 81: TEXT TRUNCATED


If a text line read from a source file is longer than 80
characters, some of the text, including the closing quote
<">, is lost. This only occurs with modules which were
originally edited using another editor.

ERROR 82: INVALID DATA BLOCK NUMBER


The DB number is out of range (0..7999) or contains invalid
characters.

ERROR 83: INVALID COMMENT, DIRECTIVE OR LABEL


Caused if the ';' or '$' character at the start of a comment
or assembler directive line is deleted. Delete the entire
line.

ERROR 84: CAN'T EXECUTE SASM: "APPEND /X" LOADED


Due to a bug in DOS version 3.3, the "File Assemble" command
can't be used if the DOS command "APPEND /X" has been used.
"APPEND /X" is NOT necessary because the "PATH" is used to
find executable files.

ERROR 85: CAN'T FIND FILE: SEDIT.OVL


The overlay file cannot be found. This file is needed when
the "File Assemble" command is executed. SEDIT.OVL should
be in the PCD Programming Utilities directory. The command
"SET PCD=d:directory" should be in the AUTOEXEC.BAT file
(d:\directory is the drive and directory where the other
PCD Programming Utilities are found).

ERROR 86: INVALID STATEMENT


Files which were originally written using another editor
(PE etc.) will produce this error if an expression which
is not supported by SEDIT is found. The file should be
updated using the original editor before using SEDIT, see
section 13.1. SEDIT handles the unprocessed line as a
comment. To correct this, the commented-out line can be
deleted and re-entered correctly from SEDIT, or it can be
corrected using the original editor.
SEDIT - Page 40

ERROR 87: INCLUDE FILE NESTING TOO DEEP


$INCLUDE files can be nested up to 10 deep. An include
file can include another file, which in turn can include
another file and so on, up to 10 times. This error is
often caused by an include file including itself.

ERROR 88: CAN'T EDIT GRAFTEC STRUCTURE, USE GRAFTEC EDITOR (SGRAF)
Editing of the Graftec structure SB, ST and TR instructions
has been disabled in SEDIT. These can only be edited using
the Graftec editor SGRAF.

ERROR 89: PRE-DEFINED SYMBOL, SASM ASSIGNS A VALUE


Symbols which are pre-defined by SASM cannot be given a
type or value because these are automatically assigned
when the file is assembled.

WARNING 90: RESOURCE(S) MAY BE USED IN OTHER STEPS/TRANSITIONS


Normally, resources which are referenced cannot be deleted.
If SEDIT is invoked from the Graftec editor SGRAF, to edit
the code in a step or transition, then SEDIT does not know
if a resource has been referenced by code in another block,
and will allow it to be deleted. The warning is accompanied
by a message "OK to delete (Y or N)?", which gives the user
the opportunity to abort the delete.

ERROR 100-200:
Generated by the Assembler SASM, see section 12.3 and the
Assembler documetation.
SEDIT - Page 41

13. SOURCE FILE


════════════════

The source file created is a standard ASCII source file (.SRC), which
can be assembled using SASM.

13.1 Using source files created by another editor


──────────────────────────────────────────────────
If you have already written SRC files using another editor (PE etc),
these must be re-edited using the original editor before attempting
to edit them using SEDIT. This is because SEDIT places some
restrictions on the format of source files. If the source file
contains any of the items listed below, first edit the file using
the original editor to remove them. The file can then be read in by
SEDIT, and will be converted to the SEDIT source file format.

Alternatively, disassemble the PCD file to create a source file, and


edit this with SEDIT. Disassembled files are 100% compatible with
SEDIT, but there are no comments or symbols in a disassembled file,
and these must all be re-typed. This is the safest method.

* Only simple expressions containing an offset between 0 and 127


are supported, e.g. OBASE+1, TSTART+32. Expressions containing
* / >> << & | etc. are not supported unless the expression is in
a conditional assembly directive (see section 11.3). All other
complex expressions must be removed or simplified.

* EQUate and DOC statements must contain absolute values, not other
symbols. For example, "Symbol2 EQU Symbol1" is not allowed,
instead use "Symbol EQU I 1".

* Operand type information is lost if symbols are defined without a


type "Symbol EQU 1", then used in an operand with an mc: "STH I
Symbol". Ensure that all EQUate statements contain the symbols'
type I|O|F|T|C|K|X|DB|COB etc. (unless the symbol is a constant)
e.g. "Symbol EQU I 1".

* The DEFine statement is not supported (except for FB parameter


definitions, see next page). Change these to EQUates, and change
the symbol names to ensure that they are not multi-defined.

* $directives are treated as comments, only $INCLUDEs are processed


by SEDIT. The EQUate statements in $INCLUDE files processed, but
the code is ignored. Conditional assembly directives ($IF..$ENDIF)
will work correctly when the file is assembled.

* Jump labels cannot have more than 6 characters, they are truncated
to 6 if longer. This may cause multi-defined label errors.

* No blank lines are allowed within CFB parameter lists or ST/TR/


RSB lists. Make sure that all parameters are on consecutive
lines.

* Texts must be entered as comments, ensure that maximum total


length of each line is less than 80 characters, see section 10.
SEDIT - Page 42

Using source files created by another editor - continued


────────────────────────────────────────────────────────
* FB parameters should be DEFined after the FB instruction, like
this:
FB 0
Input DEF = 1 ; Comment [type]
Output DEF = 2 ; Another comment [type]
etc....

The [type] is a single character in square brackets, after the


comment. This is used by SEDIT to check that parameters supplied
when the FB is called are valid, see FB parameter types in
section 8.1.

* FB parameters which have been DEFined as above, must be referenced


by their symbol name, which must be preceded by an '='. This lets
SEDIT know it's a parameter reference, and not a symbol in the
resource table. For example:

STH =Input
OUT =Output

* The largest single module which can be edited is about 5000 lines,
on an IBM PC/XT/AT with 640K memory. This depends on the size and
number of comments in the source file, and on available memory.
If an "Out of memory" error occurs, split the source file into
two modules. We recommend a maximum size of about 500 lines for
each module.

* The resource list is created from the EQUate and DOC statements.
The automatic comment for each resource is taken from the comment
on the same line as the EQUate or DOC. For example:

OnSwitch EQU I 0 ; Autocomment for MotorOn and I 0


DOC I 1 ; Autocomment for I 1

* User comments are taken from the comment on an instruction or


operand line:

STH OnSwitch ; If on switch pressed } These are the user


ANL Alarm ; and no alarm condition } comments
OUT MotorOn ; turn on the motor }

* The maximum comment length is 35 characters. If longer, they are


truncated.

* The source file should assemble without any errors or warnings.


SEDIT - Page 43

13.2 Editing Graftec programs


──────────────────────────────
Graftec source files created using the Graftec Editor (SGRAF) can
be edited with SEDIT, but the Graftec structure cannot be changed.

There are the limitations:

* You cannot alter the Graftec structure with SEDIT. The SB, IST,
and TR instructions, and their incoming/outgoing parameter lists
cannot be changed.

* Sequential Blocks (SB), Steps (ST) and Transitions (TR) can be


assigned symbol names and comments from the resource screen.
SGRAF can display the comments, but not the symbol names.

* New STs and TRs cannot be defined on the resource screen.

* SBs, STs, and TRs can be renumberd from the resource screen, and
unused SB, ST and TR definitions can be deleted.

* The $INCLUDE directive is not supported by SGRAF.

* Macros are not supported by SGRAF.


SEDIT - Page 44

13.3 Source file format


────────────────────────
SEDIT saves the source file with a short header containing the
module name and its creation date and time.

The resource table is saved as a list of EQUate or DOC statements


which also define the automatic comments. Where possible, the code
is saved using symbols in the operand fields.

Some new data types have been introduced for SEDIT which are not
handled by the existing version of the assembler (SASM V1.x). EQUate
or DOC statements containing these are commented out with double
semicolons ';;' at the start of the line. Thus they are not processed
by the assembler, but are available to SEDIT. A declaration of the
symbol which can be processed by SASM is included.

Global symbols are followed by a PUBL (public) declaration. Symbols


which are defined in the resource table without a type and value are
declared as EXTN (external).

Other lines beginning with double semi-colons, which do not contain


EQU or DOC statements, are ignored by SEDIT.
;; SAIA PCD SOURCE MODULE - SEDIT V2.1
;; MODULE: X.SRC
;; DATE: 22.11.89 16.25
;;
EXTN Fred ;Symbol with no type and value
Start EQU I 0 ;Red start button, global
PUBL Start
Alarm EQU O 32 ;Automatic comments....
Motor EQU O 33 ;Turns on the motor
DOC R 0 ;Type & value with no symbol
Init0 EQU TEXT 0 ;SASI text
Channel EQU 0 ;Serial comms channel
MainBlock EQU COB 0 ;Another automatic comment
StartUp EQU XOB 16 ;Executed on power up or reset
;;
$include globals.inc ;Include global symbols

XOB StartUp
SASI Channel ;Initialize Channel 0
Init0
LD R 0 ;User comment.....
Fred
EXOB
; Comment line
COB MainBlock ;User comments.....
0
STH Start ;if red start button pressed
ANL Alarm ;and no alarm
SET Motor ;then turn on the motor
ECOB

TEXT Init0 "This is text 100"


"This is another line of text 100"
SEDIT - Page 45

14. DIRECTORY WINDOW


═════════════════════

The directory is displayed in a pop-up window, with the files sorted


by name. Subdirectories are displayed at the end, ended by a back-
slash "\". The last entry is the parent directory "..\". The names
can be viewed with the arrow, PgUp, PgDn, Home and End keys. If the
cursor is on a directory name, pressing Enter displays the contents
of that directory. Escape closes the window.

Whenever prompted for a file name, entering a file name containing


the "wildcard" characters "*" or "?" (see below), or entering an
empty file name, or pressing the function key F5, will display the
directory window. A file name can be selected by moving the cursor
onto the desired name then pressing Enter.

If the "File Directory" command is used to display the window, a


file mask can be entered to display only the files of a certain
type, or with specific characters in their names. The standard DOS
"wildcard" characters can be used:

* matches any set of characters


? matches any single character

For example, using "*.SRC" as the mask, will display all the ".SRC"
type files. "ED*.SRC" will display all the source files whose names
begin with "ED". Directories are excluded from the masking process.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD CODE EDITOR V2.1 MODULE: TEST.SRC │
├────────────────────────────────────────────────────────────────────────────────┤
│┌─────┬────────┬─────────────┬────────────┬────────────────────────────────────┐│
││LABEL│MNEMONIC│ OPERAND │ SYMBOL │ AUTOMATIC COMMENT ││
│╘═════╧════════╧═════════════╧════════════╧════════════════════════════════════╛│
│═══ Start of module ═══ │
│ ┌───────────────────────────── E:\SEDIT\*.* ──────────────────────────────┐ │
│ │ FBDEMO.SRC FBPARAMS.DOC HARDWARE HASH.OBJ │ │
│ │ HEADER PCDMENU.DAT PCDSETUP.DAT PRNT.BAT │ │
│ │ Q.LST Q.SRC README SASM.EXE │ │
│ │ SEDIT.DOC SEDIT.EXE SEDIT.HLP SEDIT.INF │ │
│ │ SEDITHLP.SAV SHIFTKEY.H SOFTWARE STRMCPY.C │ │
│ │ STRMCPY.OBJ STROVL.C STROVL.OBJ STRTAB.C │ │
│ │ STRTAB.OBJ SYMBOLS.SRC TCCONFIG.TC TURBOC.CFG │ │
│ │ VIDEO1.C VIDEO1.H VIDEO1.OBJ X.SRC │ │
│ │ Y.SRC 8-MAR\ JEAN\ MAMI\ │ │
│ │ SAVE1\ SAVE2\ SAVE\ TEST\ │ │
│ │ ..\ │ │
│ │ │ │
│ │ │ │
│ ╘═════════════════════════════════════════════════════════════════════════╛ │
│ SET O 33 Motor Turns on the motor │
│ ECOB │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ FILE DIRECTORY: Use ARROW, PGDN, HOME etc. Enter selects a directory. <ESC> │
├────────────────────────────────────────────────────────────────────────────────┤
│ Line: 5 Free Memory: 406981 Symbols: 9 Errors: 0 F1=Help F3=Info │
└────────────────────────────────────────────────────────────────────────────────┘
SEDIT - Page 46

15. ENTERING NON-STANDARD INSTRUCTIONS


══════════════════════════════════════

Some instructions, due the the format of their operands, must be


entered in a special way.

15.1 Jump instructions (JR/JPD)


────────────────────────────────

Jump instructions need a destination address and an optional


condition code. The destination address is normally a label. The
condition code and label must *both* be entered in the OPERAND
field, the SYMBOL field is not used.

15.2 Conditional instructions


──────────────────────────────

Conditional instructions, such as CFB (Call Function Block), need


an optional condition code. The condition code must be entered in
the OPERAND field.

15.3 Register indirect addressing (JPI/TFRI/SRXMI/STXMI)


─────────────────────────────────────────────────────────

Register indirect addressing means that the operand is a type


and a Register number, and the actual value used by the instruction
is the contents of the Register. For example, "T 0" means "Timer
whose number is in Register 0". The type must be entered in the
OPERAND field. This can be accompanied by an absolute Register
number. If a symbol is to be used, the symbol must be a Register
(e.g. TOTO R 0). Enter only the type in the OPERAND field, and enter
the symbol in SYMBOL field.

15.4 LD instruction and labels


───────────────────────────────

LD (Load) can be used to load the value of a label into a Register.


In this case, the label must be entered in the OPERAND field, *not*
the SYMBOL field. If entered into the symbol field then it is
assumed to be a resource (not a label) and automatically added to
the resource table.

*** END SEDIT.DOC ***


*********************************************************************
* *
* SASM - SAIA PCD MACRO ASSEMBLER *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME SASM.DOC *
* AUTHOR Matt Harvey, SAIA AG *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1
1) Added "Error 167: Forward reference to macro: <name>"

21-Jun-96 V2.0

29-May-96 B2.0d
1) Added Warning 8: More than one Initial Step (IST) in SB.
2) Added note to $AUTO (6.15):
NOTE: $AUTO must NOT be used in user-coded programs, it is
for use by the PG4 code generators ONLY. The syntax of this
directive will be changed for the next release.

03-May-96 B2.0c
1) SWMR 815: Simplified the $PCDVER PCD types to a set of
7 fixed types, see section 6.17.
2) I and O can now be mixed, this is now allowed:
Sym EQU I 0
STH O Sym
14-Mar-96 $19G
1) SWMR 680: Added $CPU and $STATION directives, see section
6.16.
2) SWMR 815: Added $PCDVER directive, see section 6.17.
New PCD TYPE segment in object file, see section 11.

29-Feb-96 $19E
1) SWMR 812: Added $IFTYPE and $ELSEIFTYPE directives, see
section 6.4.

23-Jan-96 $19C
1) SWMR 780: Changed AUTO declaration to $AUTO directive.
(moved 4.9 to 6.15).
2) Added Error 177: Auto-allocation array overflow: <symbol>.

30-Oct-95 $199
1) For blocks, there is now no need to use an AUTO declaration
because blocks can always be auto-allocated. If there are
any collisions with blocks defined with absolute numbers,
the SLINK now allocates a new number.

30-Aug-95 $197
1) Added collision detection for auto-allocation, data defined
with an absolute value which falls within the auto segment
generates this error:
Error 174: Auto-allocation collision: <symbol>|<type><value>
2) Added Error 175: Auto-allocation not allowed for type: <type>
Error 173: Illegal use of auto-allocated symbol
3) ST and TR numbers can now be auto-allocated.

03-Aug-95 $194
1) Added local symbol segment to OBJ file with /SYM switch,
see sections 2 and 11.
2) AUTO declaration now allows a range (e.g. start..end)
as well as a count (e.g. [count]), see 4.9.

28-Jul-95 $193
1) Added /$Iinclude switch, see section 2.
2) External symbols can now be given a type, see 4.2.
3) New automatic resource allocation feature, using the new
AUTO declaration, see 4.9. There is a new AUTO record in
the object file, see 11.
4) EQUate statements can now be used to define auto-allocated
symbols, where SLINK assigns a value to the symbol from a
range defined by the AUTO statement, see 4.3 and 4.9.
5) Added these error messages, see 9.2:
Error 170: Multi-defined AUTO type
Error 171: Auto allocation overflow
Error 172: No AUTO declaration for this type
6) Document the "@cmndfile" feature, where the SASM command
line can be supplied from a command file, see 2.
03-Jun-95 $191
1) Added $ONERROR directive, see 6.14.
2) Added Warning 7: Invalid expression between @..@ in $directive

24-Apr-95 V1.9

06-Feb-95 $18A
1) If an error occurs inside a macro, and the /NM switch is
active (don't expand macros in listing), then the line in
error is now always listed.
2) Macro replacement was carried out on macro parameter
names appearing in the $ERROR, $WARNING, $TITLE and
$STITLE directives if the directive was used inside a
macro.
e.g. FRED MACRO TOM
$WARNING TOM IS HERE
ENDM
...
FRED SMITH ---> $WARNING SMITH IS HERE
...
Macro replacement in these directives is now disabled
unless the macro parameter name is enclosed in @..@
characters, which cause the expression between them
to be evaluated.
3) Added symbol name to multi-defined error messages (685):
Error 37: Multi-defined label: <label name>
Error 41: Multi-defined symbol: <symbol name>
4) Changed error "Error 153: Too many initializers" to
"Error 153: Text/DB data too long" (686).
5) Texts can now contain formatted absolute R/T/C/I/O/F
addresses. This is useful in macros so the parameter
can be either a symbol or an absolute address. Note
that there must be a space between the mc and the
address, e.g. "R 100" not "R100" (which would be
interpreted as a symbol).
e.g. TEXT TOTO "ABCDE$", R 100.04T
generates TEXT TOTO "ABCDE$R0100" (689)
6) Added $FATAL <message> directive, which generates
"Fatal Error 20: FRED.SRC: Line 123: <message>" (714).
7) Removed $MINCLUDE directive, it caused too many problems.
$INCLUDE statements are read only when the macro definition
is assembled, NOT when the macro is called.

11-Aug-94 $187
1) Forward references are not allowed in $IFxxx statements
anymore. These now generate "Fatal error 14: Symbol in $IF
no defined: <symbol name>".
2) Changed "Fatal error 14: Out of symbol space" to "Fatal
error 8: Out of memory" (they mean the same thing).
05-Jul-94 $186
1) New error message:
Error 166: Local symbol has same name as macro parameter.
2) $INCLUDE statements can now be used in macros and the
include file name can be given as a macro parameter.
3) $INCLUDE statements now work inside conditional statements
in macros, such as $IFB <>.
4) Jump labels are now local to each $INIT..$ENDINIT section,
even if there are multiple $INIT sections in a single macro.
Labels in the macro are also local, and cannot be seen by
statements in the $INIT section.
5) $INIT..$ENDINIT sections are now allowed outside a block.
6) The $REPORT, $ERROR and $WARNING statements can now evaluate
and output an expression containing symbols and operators.
The expression must be delimited between @...@ characters,
so that SASM can determine what is text and what is the
expression to be evaluated. Full expression evaluation is
supported. See sections 6.5, 6.11 and 6.12.
E.g. FRED EQU R 10
TOM EQU FRED+1
...
$REPORT TOM is @TOM@, same as @FRED+1@
Outputs: TOM is R 11, same as R 11
7) In section 6.12, describing the $WARNING statement, the
example $IFNDEF statement contained an illegal forward
reference, which might generate a "Pass 2 phase error".
E.g. $IFNDEF Axis <────── Forward reference
$WARNING "Axis" not defined ┌─ to Axis definition
Axis EQU 0 <────┘
$ENDIF
"Axis" is not defined on pass 1, then *is* defined on pass
2. This will often cause a "Pass 2 phase error". Forward
references should NEVER be used in conditional directives,
although SASM allows it.
8) If a local symbol or label in a macro has the same name as
a macro parameter (it is inserted by macro string replace-
ment), then this does not reference the local symbol anymore.
Macro definition:
FRED MACRO ONE
SYMBOL LEQU I 10
STH SYMBOL <-- references local symbol
ANL ONE <-- references macro parameter
ENDM
Old macro call was expanded as:
FRED SYMBOL
_0SYMBOL LEQU I 10
STH _0SYMBOL
ANL _0SYMBOL <-- Error, references local symbol

It is now exanded correctly as:


FRED SYMBOL
_0SYMBOL LEQU I 10
STH _0SYMBOL
ANL SYMBOL <-- Ok, now references macro param
08-Jun-94 $185d
1) Add new TFRI/SRXMI/STXMI instructions, with register
indirect addressing.
2) New error messages:
Error 154: Register indirect, must have data type (MC)
Error 155: Register indirect, symbol must be a register
3) SRXM/SRXM now transfer data blocks.

29-Apr-94 $184
1) Add "Fatal Error 19: Program too big for n/n Starter Package".

24-Sep-93 $175
1) "/Iincludedir" switch.
2) Pre-defined symbols _BLOCKNUM_ and _BLOCKTYP_, see
section 4.8.

19-Aug-93 $174
1) Add "Error 55: Operand must be zero".

28-Jul-93 $173
1) Add CASI, CRD and CWR instructions. Add "Error 109: Invalid
counter channel".
2) New $NOXINIT and $ENDNOXINIT directives.
3) Don't process $INIT/$ENDINIT/$ERROR in false conditionals or
$SKIP sections!
4) New $WARNING directive.
5) Add "Error 29: Multi-defined macro parameter".

09-Jun-93 V1.7
1) $INIT..$ENDINIT directives, code between these is placed
in the cold start XOB 16 (6.9).
2) $ERROR directive, generates a user-defined error (6.10).
3) Supports new CPBI instruction.
4) $SASI text processing updated for new S-BUS definitions.
5) The standard ANSI mnemonics for special characters can now
be entered into texts, enclosed in angle brackets. SASM
converts these to their binary characters. E.g. "<CR><LF>" =
"<13><10>", "<BEL>" = "<7>" (3.5).
User-defined symbols for ASCII characters can also be used.
6) New "$$" constant, which is the offset from the start of the
code. This is similar to the "$" constant, which is the
offset from the start of the block. E.g. SYMBOL EQU $$ (3.3).
7) New LEQU and LDEF declarations, for defining symbols which
are local to a macro (7.5).
8) The DOC declaration now supports all data types. COB, XOB,
PB, FB, SB, ST, TR, TEXT, DB and SEMA have been added (4.5).
9) New /TEMP switch (use temporary file), which allows larger
files containing many macros to be assembled. Assembled macro
definitions are stored in a temporary file (in the "SET TEMP=
path" directory) instead of in memory (2.).
10) Check that each ST or TR has an output, issuse "Warning 4:
STep or TRansition has no output" if not.
11) Check that each SB contains an IST, issue "Warning 5: SB has
no initial step" if not.
12) Add error messages 62, 95, 160..164.
13) $LAN text processing now supports the new indirect LAN text
format.
14) On completion, SASM now outputs the number of warnings as
well as the number of errors.
22-Nov-92 $164
1) Add binary units for PUBLics.
2) Add $$ flag.

20-May-92 $162
1) Now supports TEXTs and DBs 4000..7999 in the new data
segment. TEXTs 4000..7999 can now contain the NUL <0>
character. DBs 4000..7999 can contain up to 16384 elements.
2) Supports the new indirect LAN texts.
3) New TFR instruction.

06-Dec-91 $154
1) New "/Dysm[=typ]" switch for defining symbols on the
DOS command line (SWMR 244).
2) External symbols can now be used inside Texts and Data
Blocks (SWMR 117).
3) Texts do not have to begin with "", they can now start
with a symbol. For example: 'TEXT 0 "", Fred.1' can now
be written as 'TEXT 0 Fred.1'.
4) New object file format of the text segment has be changed
to support externals in Texts and Data Blocks, and for the
forthcoming extended memory data segment.
5) Added errors 151 to 153.

04-Oct-90 $139
1) Added "Data Blocks", section 3.6. New "DB" data type,
sections 4.6, 8.2.
2) TEXTs can now have an optional length, section 3.5.
3) Object file format changed (new DB type etc.), section 11.
Add description of binary LAN text and Data Block formats.
4) Instruction set changes (see instruction set description):
PUT and GET instructions now allow X and DB media types
for copying data between Registers, Texts and Data Blocks.
5) ALGI/ALGO instructions now allow symbols for both the
channel and the base address (channel CANNOT be external).
6) TEXTs can also be defined with 'X', e.g. "SYM EQU X 10" is
the same as "SYM EQU TEXT 10", section 4.6.
7) SWMR 145/146: Added /NG switch to suppress Graftec ST/TR
IO parameter lists in listing.
8) Now detects labels defined outside a block, added
Error 38: Label outside block.
9) Sequential Blocks can only be called from COB's, added
Error 39: Illegal SB call
10) Changed description of Error 92 and Fatal Error 17.
11) Added error messages 144-149 for Data Blocks.

11-Sep-90 $137
1) SWMR 123. Indirect addressing (with @) added to $LAN texts.
2) SWMR 124 and 125. $SASI text format updated.
3) Add "Error 37: Multi-defined label".

01-Aug-90 $136
1) If an include file is not found in the current directory,
SASM now searches in the PCD directory given in the
environment string with "SET PCD=d:directory".
2) Add Error 37: Multi-defined label.
08-May-90 $133
1) New conditional directives $IFINC, $IFNINC (if included, if
not included) and $ELSEIFINC, $ELSEIFNINC.

02-Mar-90 $132
1) Now supports new data types COB, XOB, PB, FB, SB, ST, TR, TEXT,
SEMA and =, these can be used in EQU and DEF statements (4.6).
2) Added "Error 54: FB param numbers (=) can't be public",
changed error 93 to "Error 93: Missing $ENDSASI or $ENDLAN".
3) New data types in object file (11).

14-Feb-90 $131
1) Added MACROs, new section 7. SASM is now "SAIA MACRO
ASSEMBLER".
2) $IFB and $IFNB directives added, these can be used to check if
an actual macro parameter has been supplied.
3) $IFE and $IFNE directives added, these check macro parameter
strings.
4) Now allows $ELSEIFxxxx.
5) /M /NM switches added to enable/disable macro expansion in
listing.
6) New errors 71-79 for macros.
7) New warnings 2 and 3 for macros.

22-Nov-89 V1.3
1) Allows 'K' constants for LD, LDH and LDL (SWMR 17).
NOTE: K constants CANNOT be passed as FB parameters to LDH/LDL,
to do this requires a PCD firmware change.
2) Labels are now local to a block (SWMR 21).
3) Allows international character set in labels and symbols
(SWMR 32).
4) Symbols can now be referenced from inside texts according to
(SWMR 33).
5) Creates SASM.ERR file containing error messages (SWMR 71).
6) Added $SASI..$ENDSASI directives. SASI texts are checked and
converted to upper case (SWMR 74).
7) Added $SKIP..$ENDSKIP directives.
8) Now supports nested $INCLUDE files (10 deep), nesting depth
is shown in the "I" column of the listing.
9) Now supports nested $IF..$ELSE..$ENDIF statements (30 deep).
10) Gives help if invoked with an incorrect command line from DOS.
11) Put type in MC field for EQU and DEF statements.
12) The units of a symbol are now stored. The symbol is shown
in the xref list in the correct units (was always decimal).
Units are now stored in the OBJect file, so that global
symbols are shown in the correct units in the MAP file (was
always decimal). OBJect file is upward compatible with V1.2.
13) Allows IBM graphics characters in texts (┌ ═ ║ õ ü etc).
14) Supports 4-character (32-bit) ASCII constants 'abcd' etc.
15) Can now assemble a much larger file. The file is not read
entirely into memory anymore.
16) $LLAN and $NOLLAN changed to $LAN, $ENDLAN ($LLAN and $NOLLAN
are still supported by SASM).
25-Nov-88 V1.1
1) INSTALL.DAT file renamed to PCDSETUP.DAT
2) Add information about SFBREF program.
3) SASM now dsplays "To: file.SRC file.LST".
4) SASM now shows "Free memory: 123567" after assembly.
5) $LLAN and $NOLLAN directives added.
6) New listing format, without PG1 opcodes etc.
7) New "Fatal Error 17: Total text size > 64K".
8) Change "Error 100: Illegal use of mc/sc/cc" to Error 59.
9) Change Error 100 to "Illegal use of reserved word".
10) Add DOC definition (4.5).

30-May-88 V1.0

19-Mar-87 $000, preliminary


SASM - Page 1

CONTENTS
========
PAGE
1. INTRODUCTION 2
1.1 Assembler Package 2
1.2 File Naming Conventions 2
1.3 Package Diagram 3
2. INVOCATION FROM DOS 4
2.1 Return Values 6
3. SOURCE FILE FORMAT 7
3.1 Instructions 7
3.2 Symbols 7
3.3 Numeric Constants 8
3.4 Labels 9
3.5 Texts 10
3.6 Data Blocks 14
3.7 Comments 15
3.8 Reserved Words 15
4. DECLARATIONS 16
4.1 PUBLic 16
4.2 EXTerNal 16
4.3 EQUate 17
4.4 DEFine 17
4.5 DOCumentation 17
4.6 Typed Symbols 18
4.7 Scope of Symbols 19
4.8 Pre-defined Symbols 19
5. EXPRESSIONS 20
5.1 Arithmetic Operators 20
5.2 Bitwise Operators 21
5.3 Relational Operators 21
5.4 Operator Precedence 21
6. DIRECTIVES 22
6.1 $INCLUDE 22
6.2 $TITLE, $STITLE 22
6.3 $LIST, $NOLIST, $EJECT 23
6.4 $IFxxxx..$ENDIF 23
6.5 $REPORT 27
6.6 $LAN, $ENDLAN 27
6.7 $SASI, $ENDSASI 28
6.8 $SKIP, $ENDSKIP 28
6.9 $INIT, $ENDINIT 29
6.10 $NOXINIT, $ENDNOXINIT 30
6.11 $ERROR 31
6.12 $WARNING 31
6.13 $FATAL 32
6.14 $ONERROR 32
6.15 $AUTO, Automatic Resource Allocation 33
6.16 $CPU, $STATION 35
6.17 $PCDVER 35
7. MACROS 37
7.1 Defining a macro 37
7.2 Calling a macro 39
7.3 $IFB, $IFNB, $IFE, $IFNE and EXITM 40
7.4 LEQU and LDEF 41
7.5 Macro Examples 42
8. LISTING FORMATS 44
8.1 Listing 44
8.2 Cross Reference List and Symbol Table 47
9. ERROR HANDLING 49
9.1 Fatal Errors 49
9.2 Assembly-time Errors 52
9.3 Warnings 64
10. PERFORMANCE AND LIMITATIONS 65
10.1 Lexical and Syntax Analysis 65
10.2 Performance 67
10.3 Limitations 68
11. OBJECT FILE FORMAT 69
SASM - Page 2

1. INTRODUCTION
================

This document describes the use of the SAIA PCD Macro Assembler
(SASM). The assembler reads an ASCII text file (.SRC) and converts
it into a binary object file (.OBJ). This must be linked using the
linker (SLINK) to produce a file which can be loaded into the PCD
(.PCD).

1.1 Assembler Package


----------------------

SASM is part of a package which consists of the following programs:

SASM - Assembler

SLINK - Linker

SDOC - Documentation Generator

SRES - Resource Table Generator

SFBREF - Function Block parameter reference list generator and


checker.

SDISASM - Disassembler

The diagram in section 1.3 illustrates the operations which can


be carried out using the package.

1.2 File Naming Conventions


----------------------------

Several different types of files are used by the package. Each type
of file has a special 3 character extension, these are the defaults:

.SRC - Source code module, assembler input.

.LST - Listing output of assembler.

.ERR - Contains error messages after assembly.

.OBJ - Relocatable object file output of assembler, linker input


file.

.PCD - Absolute object file output of linker.

.MAP - Memory map and global symbol table output of linker.

.DOC - Documentation file, listing with absolute addresses and


evaluated externals, one per .SRC module. Created by
Documentation Generator SDOC.

.RES - Resource table file. Created by resource table generator


SRES.

.FBR - Function Block parameter reference list, created by SFBREF.


SASM - Page 3

1.3 Package Diagram


--------------------

+++++++++ +++++++++
+ .FBR + + .RES +
+--->+ to + +-->+ to +
| +printer+ | +printer+
| +++++++++ | +++++++++
| |
********* | +------+ ********* | +------+
* * | | | * * | | |
*SFBREF *---+--->| .FBR | * SRES *--+-->| .RES |
* * | file | * * | file |
********* +------+ ********* +------+
^ ^
| |
+------------------------------+-------------+
|
+------+ ********* +------+ ********* +------+
+------+| * * +------+| * * | |
| .SRC ||--+-->* SASM *--+-->| .OBJ ||------>* SLINK *--+-->| .PCD |
|files |+ | * * | |files |+ * * | | file |
+------+ | ********* | +------+ ********* | +------+
| | |
| | +------+ | +++++++++
| | +------+| | + .MAP +
| +-->| .LST || +-->+ to +
| | |files |+ | +printer+
| | +------+ | +++++++++
| | |
| | +------+ | +------+
| | | .ERR | | | |
| +-->| file | +-->| .MAP |
| | | | +---------| file |
| | +------+ | +------+
| | |
+--------------|---------------------+ |
| | |
| v v
| +++++++++ ********* +------+
| + .LST + * * +------+|
+-->+ to + * SDOC *--+-->| .DOC ||
+printer+ * * | |files |+
+++++++++ ********* | +------+
|
| +++++++++
| + .DOC +
+-->+ to +
+printer+
+++++++++

All programs use printer set-up information from file PCDSETUP.DAT for
page formatting of output files and printouts, see "Configure" program
SCONFIG.
SASM - Page 4

2. INVOCATION FROM DOS


=======================

The assembler is invoked from DOS with the command:

SASM srcfilename [switches]


or SASM @cmndfile

srcfilename The name of source text file to assemble. It can


have an optional drive and/or directory name,
which indicates where the source file is to be
found, e.g. "A:\SOURCE\FRED". The default is the
current drive and directory. Regardless of where
the source file is located, the .LST, .OBJ and
.SYM files are always created in the current
directory. The filename can also have an optional
file extension, the default is ".SRC".

[switches] Optional assembler controls which may be upper or


lower case, not necessarily separated by spaces.
The characters '/' or '-' are used to delimit the
switches.

/L /NL Generate listing or no listing. Creates a listing


file (srcfilename.LST) or sends listing to printer
if /P is in operation.
/O /NO Object file (srcfilename.OBJ) or no object file.
/X /NX Generate cross reference listing and symbol table.
/P /NP Send listing to printer, or send listing to file
(ignored if no listing or cross reference list is
generated).
/M /NM Expand macros in listing, or list only the macro
calls.
/G /NG Graftec ST/TR incoming/outgoing parameters in
listing. /NG for no parameters.
/Q /NQ Quit after first error or no quit, quits after
100 errors anyway.

/Dsym[=val] Defines a symbol, with an optional value in any


units, e.g. /DFRED=1 /dtito=1.2 /dchar='A'
/dHexVal=0ABH. If no value is given, 0 is used.
Up to 10 symbols can be defined in this way.
This symbol is often used to control conditional
assembly, see section 6.4.
/TEMP Use a temporary file to process macros. Useful if
the module contains many macros. Temporary file
SASMACRO.$$$ is created in the TEMP directory
defined in the environment.
/Iincdir "incdir" is the path name of a directory which
contains include files. The current or supplied
directory is searched first, followed by any
"incdir" directories, then the PCD directory.
Up to ten /I statements can be given.
/$Ifilename Includes "filename" at the start of the source
module by generating a $INCLUDE statement.
SASM - Page 5

Invocation from DOS continued


-----------------------------

/SYM Creates the "Local Symbol Segment" in the object


file. This segment is only needed for symbolic
debugging, and will increase the size of the
object file.

cmdfile Indirect command file containing filename and


switches. Precede the filename with a '@'
character. SASM reads the command line from this
file. If several /I, /$I or /D switches are used,
the command line will soon exceed the DOS maximum
of 128 characters. The solution is to use an
indirect command file.
"@cmdfile" can co-exist on the command line with
a source file name and switches, for example:

C:\TEST>SASM FRED @SWITCHES /NL


C:\TEST>SASM @COMMAND

Default switches are: /NL /O /NP /M /G /NQ

If an incorrect command line is given, SASM displays a help text.

Invocation example, assembles file SOURCE.SRC, producing object file


SOURCE.OBJ and listing file SOURCE.LST which includes a cross-
reference listing and symbol table:

C:\>SASM SOURCE/L/X

SAIA MACRO ASSEMBLER V1.7


Assembling: SOURCE.SRC
To: SOURCE.OBJ SOURCE.LST

Free memory: 240134

Assembly complete, 0 warnings, 0 errors

C:\>_

The "Free memory" value shows the ammount of memory left after the
assembly. Memory is used to hold the source and include files, and
the symbol table. The maximum size of source file which can be
assembled is dependent on the memory size. If this value is small,
for example less than 50K, you should not increase the size of
the source file, otherwise an "Out of memory" error may occur.

Ctrl+C or Ctrl+Break can be used to abort the assembly (BREAK must


be ON, see your DOS manual). When aborted, "Aborted" is displayed,
the output files are closed (left incomplete) and the printer (if
used) is de-initialized. There may be some delay between pressing
Ctrl+C and the abort.
SASM - Page 6

2.1 Return Values


------------------

SASM returns a value to DOS on exit. This value can be used by a


parent process or by a batch file which invoked SASM (using the
ERRORLEVEL condition parameter).

0 Assembly completed without errors.

1 Assembly completed, but recoverable assembly-time


errors have occurred. The object file has not been
created.

2 A fatal error occurred, assembly was not completed.


There is no object or listing file.

3 Aborted with Ctrl+C or Ctrl+Break, the state of the


object and listing files is undefined.
SASM - Page 7

3. SOURCE FILE FORMAT


======================

In the following descriptions, the use of square brackets means that


the item inside the brackets is an optional entry. For example
[;comment] means that ";comment" is optional and need not be present.

3.1 Instructions
-----------------

Each instruction line or statement has the form:

[label:] [mnemonic] [operator] [operand] [;comment] <CR>

Each field must be separated by one or more spaces or tabs as a


delimiter, except for the comment field where the ';' character is
the delimiter.

The instruction format is as specified in the PCD6 CPU Manual.

3.2 Symbols
------------

Symbolic names can be any length, but only the first 10 characters are
significant, and only the first 10 characters appear in any symbol
tables etc.

Symbols are not case sensitive unless they contain foreign characters,
"MotorOn" is the same as "MOTORON", but "FÜHRER" is NOT the same as
"führer".

Reserved words (see section 3.8) cannot be used as symbols.

Symbols cannot begin with a digit (0-9).

Characters allowed in symbols are:

A-Z
a-z
0-9
_ (underscore)
Foreign characters with ANSI character codes

SASM pre-defines some useful symbols, see section 4.8.


SASM - Page 8

3.3 Numeric Constants


----------------------

The default base for numeric constants is decimal. All constants are
stored as 32-bit signed integers. If a constant is too big or too
small to be represented as a signed 32-bit value, an error is
generated.

The following numeric constant types are supported:

* DECIMAL CONSTANTS

Decimal values have the range -2147483648 to +2147483647.

* BINARY CONSTANTS
* HEXADECIMAL CONSTANTS

Binary or hexadecimal bases can be used by postfixing the number


with a base indicator character:

Y or Q Binary, e.g. 1001Q.


H Hexadecimal, e.g. 0ABCDEH.
A Hex value must always begin with a digit,
otherwise it is interpreted as a symbol.

Binary and hex constants have the range 0 to FFFFFFFFH. Note that
FFFFFFFFH is -1 decimal and 80000000H is -2147483648 decimal.

* ASCII CHARACTER CONSTANTS

These can be entered by enclosing the characters in single quotes,


one to four characters can be entered (to make up to 32 bits).
E.g. 'A' 'ab' '?' 'abcd' 'â'.

* FLOATING POINT CONSTANTS

Floating point values must contain a decimal point '.', and/or an


'E' (or 'e') followed by an exponent, e.g. .23, 1.234, 1E10, 1e-10.
Floating point constants are handled in expressions as though they
are 32-bit signed integers. Expressions doing arithmetics with
floating point values will not produce meaningful results. Floating
point values have the range +/-2.710505E-20 to +/-9.223371E+18.

* $ CONSTANT

This has the value of the address offset into the current code
block (COB, XOB, PB, FB, SB, IST, ST or TR). It is used primarily
when and address needs to be made public (for loading into a
register etc).

$ must NOT be used to create labels for relative jumps (JR), but
may be used for direct jumps (JPD), for loading a register with
an address using the LD instruction, or as an address for the
RCOB instruction. $ cannot be used inside a $INIT segment.

$ constants can also be made PUBLic, whereas labels cannot


because labels are always local to the block in which they are
defined.
SASM - Page 9

Example: LABEL EQU $


...
LD R 0
LABEL

* $$ CONSTANT

Similar to the $ constant above, but this has the value of the
offset from the start of the code (always 0), and is assigned a
value by the Linker. This value can also be made PUBlic. The
value of the constant may be useful for documentation or debug
purposes if its public value is listed in the MAP file.

Example: START_FB_0 EQU $$


PUBL START_FB_0
FB 0
....
EFB

*** NOTE ***

Forward references to public $$ symbols defined in other modules


are not allowed. If a symbol containing $$ is made public, its
actual value is not known until the module is processed by the
linker. Therefore it must not be referenced by any modules which
are linked before it, because the value of $$ will be unknown.
$$ symbols cannot be used inside a $INIT segment.

3.4 Labels
-----------

Characters allowed in labels are the same as those of symbols (see


section 3.2). Labels can appear anywhere in the source file, but
should be within a code block (COB, PB etc.), and must not be inside
a multi-line instruction.

The value assigned to a label is its offset within the code block
where it is defined. All labels are local to the block in which they
are defined, the same label can be used many times in a the same
source module, providing it is always in a different block. Jumps to
labels defined in another block are not allowed.

Labels cannot be PUBLic, since all labels are local to the block
in which they are defined, and jumps between source modules are not
allowed. '$' can be used to create untyped symbols containing the
offset into the code block, which may be made public or can be
referenced from another block (by the LD or RCOB instructions).

Example:
...
PUBL LAB1 ; LAB1 is declared public
LAB1 EQU $
...
LAB2: STH I 0 ; LAB2 is a label for a wait loop
JR L LAB2
...
SASM - Page 10

3.5 Texts
----------

Texts are entered as ASCII strings enclosed in double quotes "...".


Texts can consist of one or more lines of text, each line must be
opened and closed with double quotes. Texts can be defined anywhere
in the source module, except within a multi-line instruction.

Format:

TEXT number [ '['length']' ] "text line 1" [;comment]


[ "text line 2" [;comment]
. . . .
"text line n" [;comment] ]

The "number" and "length" can be any expression or symbol combination.


The "length" is an optional text length, which must be enclosed in
square brackets, e.g. "[10]", "[MaxTextLen]". The text length defines
texts for use with the PUT and GET instructions, which can copy blocks
of Registers to and from texts. If the length is present, then text
in double quotes can be omitted, and the text is filled with space
characters. If both the length and text are defined, the text is
padded with space characters up to the given length.

Examples:

ONE EQU TEXT 1


TWO EQU X 2 ; X and TEXT (data types) are the same

TEXT 0 [100] ; Defines TEXT 0 as 100 spaces


TEXT ONE [5] "123" ; Defines TEXT ONE as "123 "
TEXT TWO "123 " ; Text TWO is the same as text ONE

Texts can also contain symbolic references. The value, and optionally
the type, of the symbol is inserted into the text. The symbol is
written outside the text in double quotes, and must be separated from
this or other symbols by a comma. After the symbol, an optional field
width and prefix type can be given. Symbols in texts have this format:

symbol[.[[-][0]width][t|T]]

Where: symbol The symbol name. This can actually be any expr-
ession which includes a symbol, for example:
MotorOn+100, IOBase+Offset etc.
Symbols with floating point values are not
permitted.
. The dot immediately after the symbol indicates
that a field width and/or prefix is present.
width The field width, the number of digits or spaces
for the number (1..20). If the number is longer
(e.g. width=3, number=1234), then the width is
automatically increased so the number is not
truncated.
0 If the width begins with a 0, leading zeros are
inserted to padd the field to "width" characters.
- If "width" is preceded by a '-' sign, the data is
left justified in the field, the default is right
justified. No leading zeros are inserted, even if
the width begins with '0'.
SASM - Page 11

Texts continued
---------------

t|T Optional prefix type 't' or 'T'. If 't', the


value is prefixed with the symbol's type in
lower case (o, f, r etc.). If 'T', the symbol's
type is in upper case (O, F, R etc.).

Examples of texts containing symbolic references:

Flag EQU F 123


Output EQU O 32
Reg EQU R 999

TEXT 0 "$", Flag.04T ; TEXT 0 IS "$F0123"


TEXT 1 Flag ; TEXT 1 IS "123"
TEXT 2 "DIAG:", Output.T, ",", Reg.T
; TEXT 2 IS "DIAG:O32,R999"
TEXT 3 "55:", Flag.T, "-", Flag+7, ":", Output.T, "-", Output+7
; TEXT 3 is "55:F123-130:O32-39"
TEXT 4 "FLAG NUMBER: *", Flag.-8, "*"
; TEXT 4 IS "FLAG NUMBER: *123 *"

Texts can also contain formatted absolute R/T/C/I/O/F addresses.


This is useful in macros so the parameter can be either a symbol or
an absolute address. Note that there must be a space between the mc
and the address, e.g. "R 100" not "R100" (which would be interpreted
as a symbol).

For example, TEXT TOTO "ABCDE$", R 100.04T


generates TEXT TOTO "ABCDE$R0100"

The maximum number of characters allowed in a text is 3072 (3K).

Any character can be entered into a text, except that TEXTs 0..3999
do not allow the NUL character (ASCII code 0) because this is used
as the end-of text character.
SASM - Page 12

Texts continued
---------------

Special characters can be entered as ASCII codes in decimal, or as


standard ASCII mnemonics. Decimal codes and mnemonics must be
enclosed in angle brackets, e.g. "<CR><LF>" or "<10><13>". For decimal
codes, the allowed range is 1..255 (leading zeros accepted). The ASCII
mnemonics are:

Mnemonic Dec Hex Mnemonic Dec Hex


---------------------------------------------
<NUL> 0 00H <DLE> 16 10H
<SOH> 1 01H <DC1> 17 11H
<STX> 2 02H <DC2> 18 12H
<ETX> 3 03H <DC3> 19 13H
<EOT> 4 04H <DC4> 20 14H
<ENQ> 5 05H <NAK> 21 15H
<ACK> 6 06H <SYN> 22 16H
<BEL> 7 07H <ETB> 23 17H
<BS> 8 08H <CAN> 24 18H
<HT> 9 09H <EM> 25 19H
<LF> 10 0AH <SUB> 26 1AH
<VT> 11 0BH <ESC> 27 1BH
<FF> 12 0CH <FS> 28 1CH
<CR> 13 0DH <GS> 29 1DH
<SO> 14 0EH <RS> 30 1EH
<SI> 15 0FH <US> 31 1FH
<DEL> 127 7FH

To include the <, > and " characters in a text, these must also be
enclosed in angle brackets: <<>, <>>, <">.

In fact, the character value between angle brackets can be any


expression, even containing user-defined symbols, providing the
value produced is in the range 0..255.

Examples:

TEXT 100 "<13><10>" ; THIS IS CARRIAGE RETURN, LINE FEED


TEXT 101 "<CR><LF>" ; SAME AS TEXT 100 ABOVE
TEXT 102 "<">Hello world!<">" ; TEXT IS "Hello world!"

EndOfText EQU 2
TEXT 103 "<EndOfText>" ; SAME AS "<2>"
TEXT 104 "<EndOfText+1>" ; SAMD AS "<3>"

The $LAN..$ENDLAN and $SASI..$ENDSASI directives can be used to


delimit texts which are to be specially processed by the assembler,
refer to sections 6.6 and 6.7.
SASM - Page 13

Texts continued
---------------

*** NOTES ***

Texts and Data Blocks share the same numbering. For example, if TEXT
10 is defined, then DB 10 cannot be defined, and vice versa.

Texts 0..3999 are stored in text memory. Texts 4000..7999 are only
available on a PCD with extension memory. The PCD2 supports only
Texts/DBS 0..5999.

For texts 0..3999, the first character of a text CANNOT be <253>,


<254> or <255>. These characters are reserved to indicate that the
text is in a special format (binary LAN text or Data Block).

An empty text ("") does not create a text in a .PCD file, but it DOES
define the text number for the assembler and linker, thus preventing
that text from being re-defined. However, the PCD's CPU treats an
empty text as though the text doesn't exist.
SASM - Page 14

3.6 Data Blocks


----------------

A "Data Block" is an area of memory which is used for storing 32-bit


data, which can be transferred to and from Registers, Timers and
Counters. For DBs 0..3999, up to 383 Register values (4-byte values)
can be stored. For DBs 4000..7999, up to 16384 values can be stored.
DBs 4000..7999 are only available in a PCD containing extension
memory.

The PUT instruction transfers data from Registers into a Data Block,
and the GET instruction transfers all the data from a Data Block into
a block of Registers. The number of Registers copied depends on the
Data Block length, which is defined in the source file in the DB
declaration. The TFR (TRansFer) instruction transfers single elements
to or from a Data Block.

Format:

DB number '[' [length] ']' [value1 [, value2]...]

The Data Block length must be given, enclosed in square brackets,


e.g. DB 10 [100], followed by an optional list of initial values.
If the length is empty "[]", then the length is determined from the
number of values. Either the length and/or one or more values must
be given. If only the length is supplied, the data is initialized to
zeros. For DB 0..3999 the length can be 0..382, for DB 4000..7999
the length can be 0..16383.

Values can be decimal, hex, floating point or ASCII, or can be any


expression or symbol combination producing an integer or floating
point value.

Examples:

DB 100 [10] ; DB 100 HOLDS 10 ITEMS,


; ALL SET TO 0
DB 101 [4] 1,2,3,4.1 ; DB 101 HOLDS 4 ITEMS,
; SET TO 1, 2, 3 AND 4.1
DB 102[4] 1,2,3 ; DB 102 HOLDS 4 ITEMS,
; SET TO 1, 2, 3, 0
DB DATA[LEN] VAL1,,,4H ; DB DATA HOLDS "LEN" ITEMS,
; SET TO VAL1, 0, 0, 4

*** NOTES ***

If the PCD contains EPROM memory, Data Blocks 0..3999 cannot be


written to. Data Blocks 4000..7999 reside in the PCD extension data
memory (always RAM).

At present, Data Blocks 0..3999 are stored in Text memory. If the


first character of a text is FFH (255), then it is treated as a Data
Block. The data is encoded in a special way, so that NUL <0> bytes
do not occur in the text. Data Blocks 4000..7999 are stored in data
memory in binary, and are not encoded. These can contain the NUL
character.

Data Blocks share the same numbering as Texts. For example, if Data
Block 10 is defined, then Text 10 is unavailable, and vice versa.
SASM - Page 15

3.7 Comments
-------------

Comments can appear anywhere in the source file (except after some
directives such as $TITLE, $ERROR, $REPORT), even between lines of
multi-line instructions. Comments begin with a semi-colon character
';'. All characters after ';' are ignored until the start of the
next line. Comments can contain any characters.

The comments appearing after EQU, DOC or EXTN statements are used as
the "automatic comments" by the Documentation Generator (SDOC).

Format:

[statement] ; [comment]

NOTE: Comments in macro definitions which are preceded by two semi-


colons ";;" are removed when the macro is expanded, allowing
larger programs to be assembled, see section 7.1.

3.8 Reserved Words


-------------------

The following words are reserved, and cannot be used as symbol names:

Assembler declarators (PUBL, EXTN, EQU, DEF, MACRO, ENDM, EXITM).

Medium control codes and data types (I, O, F, R, C, T, K, M,


COB, FB, TEXT, X, SEMA, DB).

MOV instruction special codes (N, Q, B, W, L, D).

Condition codes (H, L, P, N, Z, E).

All instruction mnemonics.

Pre-defined symbols, see section 4.8.

Internal symbols used for automatic resource allocation, which


begin with six or more underscores: "______". E.g. "______TEXT",
"_________F".

Internal "__CSTART__" symbol, used for $$ assignments.


SASM - Page 16

4. DECLARATIONS
================

4.1 PUBLic
-----------

Format:

PUBL <symbol name> [ [,] <symbol name> ... ] [;comment]

When a symbol is declared PUBLic, its value is global, the symbol can
be referenced from any module as an external, see section 4.2.

One or more symbolic names can follow the PUBLic statement. Each symbol
must be separated by one or more spaces or tabs, and/or by a comma. The
comma is not required, but can be present if prefered.

Labels cannot be declared public, but '$' may be used to generate a


public label, see section 3.3. DEFined symbols cannot be made public.

Forward references are allowed, the <symbol name> can be defined after
the PUBLic statement.

4.2 EXTerNal
-------------

Format:

EXTN <symbol name> [<type>] [[,] ... ] [;comment]

If a symbol is declared PUBLic in one module, it may be referenced


from another module by declaring it as EXTerNal. It can also be
assigned an optional type (R, I, F, TEXT, DB, COB, FB etc.), which
allows SASM to do type checking when the external symbol is used.
The symbol's actual value is unknown until the modules are linked
together by SLINK, and the associated PUBLic symbol is found.

One or more symbolic names and optional types can follow the EXTN
statement. Each symbol must be separated by one or more spaces or
tabs, and/or by a comma. The comma is not required, but can be used
if preferred.

Forward references are allowed, the <symbol name> can be defined after
the EXTN statement.

If a comment appears on the same line as the EXTN, this comment is


used as the "automatic comment" for all the external symbols by the
Documentation Generator (SDOC).
SASM - Page 17

4.3 EQUate
-----------

Format:

<symbol name> EQU [<type>] [<expression>] [;comment]

EQU defines a constant. It assigns the value of an expression to a


symbol name. The symbol cannot be defined anywhere else in the module.
An optional type can precede the <expression> to give the symbol a
data type, see section 4.6.

The <expression> can contain arithmetic operators, see section 5.


If the <expression> contains an external, the resulting symbol also
has external scope.

If a comment is supplied, this is used as the "automatic comment"


the symbol by the Documentation Generator (SDOC).

4.4 DEFine
-----------

Format:

<symbol name> DEF [<type>] <expression> [;comment]

DEF defines a variable. This is the same as EQUate, except that the
<symbol name> can be re-DEFined in the module, and the <expression>
cannot contain an external. The symbol must not be defined anywhere
else in the module unless it is re-defined with a DEF statement.

DEFined symbols cannot be made PUBLic.

4.5 DOCumentation
------------------

Format:

DOC <type> <expression> ; automatic comment

This declaration is not used by the assembler. It is used by the


Documentation Generator (SDOC), to assign an "automatic comment" to
an item if the item has not been defined with a symbol name (using
EQUate). When the documentation file (.DOC) is made for this module,
wherever the item is referenced, the automatic comment can be shown
in the DOC listing. Refer to the Documentation Generator (SDOC)
Functional Specification for details.

The <type> can be: I, O, F, T, C, R


COB, PB, FB, SB, IST, ST, TR
TEXT (or X), DB
SEMA (or S)
SASM - Page 18

4.6 Typed Symbols


------------------

When is symbol is EQUated, DEFined or declared as EXTN, an optional


data type can be assigned to the symbol.

If symbols are given a type, the type is checked whenever the symbol
is used and provides added security. It is illegal to use a symbol
with an invalid type in an instruction, or to mix symbols of different
types in an expression. PUBLic symbols retain their type information
which is checked by the Linker in the same way.

If a symbol has an element type (I, O, F, T, C, R, K or M), it is not


necessary to use the type in the instruction, although it is allowed.
For example:

INPUT EQU I 1 ; DECLARE "INPUT" AS INPUT NUMBER 1


. . .
STH INPUT ; SAME AS "STH I 1"
STH I INPUT ; SAME AS ABOVE, BUT THE "I" IS NOT NEEDED
STH F INPUT ; GENERATES AN ERROR BECAUSE "F" DOES NOT
; MATCH THE SYMBOLS TYPE

Permitted symbol types are:

I Input
O Output
I|O Input or output (both use the same numbering)
F Flag
R Register
T Timer
C Counter
T|C Timer or Counter (both use the same numbering)
K Constant (13-bits unsigned)

COB Cyclic Organization Block


XOB Exception Organization Block
FB Function Block
PB Program Block
SB Sequential Block
ST Step (or Initial Step)
TR Transition
TEXT or X Text
DB Data Block
SEMA or S Semaphore (for LOCK and UNLOCK)
= Function Block parameter number (not for EXTN symbols)

A symbol can also have type "label" if it is declared as a label,


see section 3.4.

The symbol's type appears in the TYPE field of the cross reference
list, see section 8.2.
SASM - Page 19

4.7 Scope of Symbols


---------------------

Unless explicitly declared public (global) using PUBL, all symbols


have scope only within the module in which they are defined.

Symbols defined with DEF have scope from the definition point to the
end of the source file (unless re-DEFined), allowing backward
references only.

EXTerNal and EQUated symbols can be both forward and backward


referenced, they can be defined anywhere in the source module, and
referenced from anywhere in the module.

Labels are usable only within the code block in which they are defined,
and are local to that block. To create a label which can be referenced
from any block or can be made PUBLic (for use by the LD or RCOB
instructions), "<label> EQU $" can be used, see section 3.3.

*** NOTE ***

All COB, XOB, PB, FB, SB, IST, ST, TR, TEXT and DB numbers are global,
even if their symbols (if used) are not explicitly declared PUBLic.
There can be only one block or text with the same type and number in
each program.

4.8 Pre-defined Symbols


------------------------

SASM defines some useful symbols internally. These can be referenced


by the user program as normal symbols, with some restrictions: they
cannot be made public; they cannot be used in EQUate statements
(they *can* be used in DEFine statements); and _BLOCKNUM_ cannot be
used if the block number is an external. Using a pre-defined symbol
in the wrong place gives an "Illegal use of reserved word" error,
or "Illegal use of external" if the block number is an external.

_BLOCKNUM_ The number of the current block, or -1 (0FFFFFFFFH)


if outside a block.
E.g. PB 123 PB 123
LD R 0 LD R 0
_BLOCKNUM_ --> 123
EPB EPB

_BLOCKTYP_ The type of the current block:


-1 = outside block (0FFFFFFFFH)
0 = COB
1 = XOB
2 = PB
3 = FB
4 = IST
5 = ST
6 = TR
SASM - Page 20

5. EXPRESSIONS
===============

An expression can consist of any combination of operators, symbol


names and constants in any number base, with the following
exceptions:

* Expressions can contain only one external symbol, if so, the


result of the expression is also external.

* Operations permitted on an external symbol are:

<external> + <constant expression>


<external> - <constant expression>
<constant expression> + <external>

All other operations are illegal on externals.

* If the expression contains typed symbols, the types must be


the same, the expression evaluates to this type. This includes
labels.

* Expressions should NOT contain floating point values, since


these are treated as 32-bit signed integers when the expression
is solved. However, the relational operators "=" (is equal to)
and "<>" (is not equal to) will work correctly.

An expression can appear in a declaration, a directive, or as an


operand to an instruction, in fact, an expression can be used
anywhere that a single number can be used.

All expressions are evaluated to 32-bit signed integers, overflow of


expressions is not detected, but overflow of a single constant is
detected.

An expression can contain forward references, but these should be used


with care since the value of the symbol will be undefined on the first
pass of the assembler. This may have disasterous effects, and may
cause a "Pass 2 phase error".

5.1 Arithmetic Operators


-------------------------

+ (unary +ve, no operation since +ve is the default)


- (unary -ve, 2's complement )
+ add
- subtract
* multiply
/ divide
% modulo (returns the remainder)
SASM - Page 21

5.2 Bitwise Operators


----------------------

& AND
| OR
^ XOR
! NOT (1's complement)
>> Shift right
<< Shift left

AND, OR, XOR and NOT behave as unary operators on TRUE and FALSE
values generated by the relational operators below.

The shift operators are used as follows:

<constant expr> << <number of bits>

The <number of bits> expression is evaluated, and the <constant


expression> is shifted left this number of bits.

5.3 Relational Operators


-------------------------

= equal to
<> not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to

The result of expressions containing these is either TRUE (7FFFFFFFH)


or FALSE (0).

These operators can appear only in expressions following conditional


assembly directives, see section 6.4.

5.4 Operator Precedence


------------------------

"Precedence" means the order in which operators are evaluated in an


expression. Operators with higher precedence are evaluated first.
Parentheses can be used to change the order of precedence. Operators
of equal precedence are evaluated left to right.

High
1 ! + - (unary)
2 * / %
3 + - (binary)
4 << >>
5 = <>
6 > >= < <=
7 &
8 ^
9 |
Low
SASM - Page 22

6. DIRECTIVES
==============

All directives consist of a '$' immediately followed by the directive


name. No space can appear between the '$' and the name.

6.1 $INCLUDE
-------------

Format: $INCLUDE [d:][path]filename[.ext]

When an include statement is encountered, the given file is read and


processed as though it is part of the source file being assembled.
If the include file is not found in the current directory, SASM
searches in the PCD directory given in the environment by "SET PCD=
d:directory".

Include files can be nested up to 10 deep, this means that an included


file can itself contain a $INCLUDE statement to include another file
and so on until 9 further files have been included.

6.2 $TITLE, $STITLE


--------------------

Format: $TITLE [ <text> ]


$STITLE [ <text> ]

$TITLE provides the title which appears on the second line of every
page of the listing, $STITLE provides the subtitle which appears on
the third line of every page of the listing.

The title or subtitle <text> begins from the first character following
the directive which is not a space or a tab, and ends at the end of the
line. The maximum length of a title or subtitle text is 70 characters,
characters after this are ignored. If no text appears after the
directive, any existing title or subtitle is removed.

The title appears on each page of the listing, the subtitle appears on
all pages following the one in which the $STITLE directive appears.
If more than one $TITLE appears, the last one in the module is used.
SASM - Page 23

6.3 $LIST, $NOLIST, $EJECT


---------------------------

Format: $LIST
$NOLIST
$EJECT

$LIST resumes sending output to the listing file or printer following


a $NOLIST directive. All statements following a $NOLIST directive are
not sent to the listing file or printer, until a $LIST directive is
encountered. $EJECT forces a new page in the listing file. It is
ignored if $NOLIST is in operation.
SASM - Page 24

6.4 $IFxxxx..$ENDIF
--------------------

These are the "conditional assembly" directives. These are evaluated


when the program is assembled, NOT when it is executed. Each directive
is terminated with $ENDIF, and may contain optional $ELSE or $ELSEIFxxx
directives (xxxx is the condition type, see below).

Conditional directives are typically used to produce different versions


of a program where most of the code is the same for each version, or
to include special code during the debug phase of a program. They are
also very useful inside a macro, some of these directives are designed
specifically for use inside macros ($IFB, $IFE), see section 7.

Statements following a $IFxxxx are processed if the condition is


satisfied, statements following $ELSE or $ELSIFxxxx are processed if
the condition is not satisfied.

Statements following $IFxxx, $ELSE or $ELSEIFxxxx can be any statements


or directives including further $IF statements. $IF statements can be
nested up to 30 deep.

These are the $IFxxxx directives:

$IF <conditional expression>


If the result of <conditional expression> is non-zero.

$IFN <conditional expression>


If the result of <conditional expression> is zero (if Not).

$IFDEF <symbol>
If the <symbol name> is DEFined, EQUated, declared EXTerNal,
or is a label declared in the current block.

$IFNDEF <symbol>
If the <symbol name> is NOT DEFined, EQUated, declared EXTerNal
or a label.

$IFINC
If $INCLUDE file (TRUE if this module has been included in
another module).

$IFNINC
If not $INCLUDE file (TRUE if module is main module).

$IFTYPE <expr> = <type>


$IFTYPE <expr> <> <type>
If the <expr>'s type is equal to <type> (K, R, T, TEXT etc).
Can also use '<>' in place of '=' for not equal to <type>.

$IFB If blank. } These are for use inside macros for checking
$IFNB If not blank. } macro parameter strings, and are described
$IFE If equal. } in section 7.3.
$IFNE If not equal. }
SASM - Page 25

$IFxxxx..$ENDIF continued
-------------------------

Format:

$IFxxxx <conditional expression> [;comment]


<statements>
[ $ELSEIFxxxx <conditional expression> [;comment]
<statements> ]
[ $ELSE [;comment]
<statements> ]
$ENDIF [;comment]

For $IF and $IFN, <conditional expression> is:

<constant expression> [<relational operator> <constant expression>]

For $IFDEF and $IFNDEF, <conditional expression> is just a symbol or


label name.

For $IFTYPE, <conditional expression> is:

<expr> = <type> ; is equal to <type>, e.g. Fred = R, R 0=R


or <expr> <> <type> ; is NOT equal to <type>, e.g. Fred<>R

For $IFB and $IFNB, <conditional expression> is any string or macro


parameter name enclosed in angle brackets, see section 7.3.

There is no <conditional expression> for $IFINC and $IFNINC.

These $ELSEIFxxxx directives are supported, they work in the same


way as a combination of $ELSE with the associated $IF directive:

$ELSEIF $ELSEIFN
$ELSEIFDEF $ELSEIFNDEF
$ELSEIFB $ELSEIFNB
$ELSEIFE $ELSEIFNE
$ELSEIFINC $ELSEIFNINC
$ELSEIFTYPE

Examples:

Version EQU 1 ; Define version number

$IF Version = 1
STH I 1000 ; Code for version 1
$ELSEIF Version = 2
STH I 10 ; Code for version 2
$ELSE
STH F 100 ; Code for all other versions
$ENDIF
SASM - Page 26

$IFxxxx..$ENDIF continued
-------------------------

Examples:

$IF version=1 & !testing ; If assembling version 1 and not


SET O 0 ; testing the program
$ELSEIF !testing ; Else if not testing
SET O 32
$ENDIF

;------------------------------------

DEBUGGING EQU 1 ; Set DEBUGGING to 1 (true)

$IF DEBUGGING ; If DEBUGGING is not zero (true)


label: JR label ; then include this loop in the code
$ENDIF

;------------------------------------

$IFNINC ; If not $INCLUDEd file,


FB ONE ; then assemble the FB code
OnSwitch DEF = 1 ; FB parameter definitions, available
Output DEF = 2 ; to including module. FB code is only
..... ; assembled once, it is not assembled
$ENDIF ; where it is $INCLUDEd.

;------------------------------------

$IFTYPE MySymbol = R ; If MySymbol is a Register


$REPORT MySymbol is a Register
$ELSEIFTYPE MySymbol <> X ; If MySymbol is NOT a Text
$REPORT MySymbol is not a text
$ENDIF

*** NOTES ***

The use of forward references in <conditional expression> and <symbol


name> is NOT allowed, except for $IFDEF and $IFNDEF. All symbols must
be defined BEFORE they can be used in $IFxxx statements.

$IFxxx cannot be used inside a multi-line instruction or FB parameter


list etc, the entire instruction must be enclosed by the $IF..$ENDIF
statements.
SASM - Page 27

6.5 $REPORT
------------

Format: $REPORT <text>

The <text> is output to the console when the $REPORT directive is


processed during Pass 2 of the assembly. This directive is useful for
displaying messages at specific points during a long assembly, or can
be used inside $IF..$ENDIF statements to indicate which conditional
code is being generated etc.

The <text> begins from the first character following $REPORT which is
not a space or a tab. If no text is present, a line feed is output to
the console.

The <text> can contain expressions and macro parameter references,


enclosed in @..@ characters. The expression is evaluated before the
text is output, which allows the values of symbols to be shown. To
place an @ character in the text, use @@. See the example in 6.11
for $ERROR.

Example:
FRED EQU R 10
TOM EQU FRED+1
...
$REPORT TOM is @TOM@, same as @FRED+1@

This outputs the text:


TOM is R 11, same as R 11

6.6 $LAN, $ENDLAN


------------------

Format: $LAN
<text definitions>
...
$ENDLAN

These two directives are used to delimit texts which are to be pre-
processed by the assembler into a special binary format for the SAIA
LAN 2 (PCD6.T100 with firmware V003 or above).

All texts between the $LAN...$ENDLAN directives, or all texts that


follow $LAN up to the end of the file, are checked by the assembler
and converted from ASCII into a binary format. These binary texts can
be processed much faster by the T100 LAN module. The assembler also
detects any invalid LAN texts.

LAN texts must be defined on one line, it is illegal to break the


text into several lines.

Example:

$LAN
TEXT 0 "2:I0-255:F0-255" ; These are binary LAN texts
TEXT 1 "2:O0-255:O0-255"
$ENDLAN
TEXT 10 "This a standard ASCII text"
SASM - Page 28

6.7 $SASI, $ENDSASI


--------------------

Format:

$SASI
<SASI text definitions>
. . .
$ENDSASI

These directives are used to delimit texts which are used by the
SASI instruction (Assign Serial Interface). These SASI texts are
fully checked by the assembler and invalid texts are detected. The
texts are also converted to upper case as required by SASI. If
$SASI..$ENDSASI are not used, it is possible to enter an invalid
text which may cause incorrect initialization of the serial port.

Example:
. . .
SASI 0 ; Initialize serial channel 0
100 ; using text 100
. . .

$SASI ; Text 100 is checked by assembler


TEXT 100 "UART:9600,7,E,1;MODE:MC0;DIAG:F1000,R4000;"
$ENDSASI

6.8 $SKIP, $ENDSKIP


--------------------

Format:

$SKIP
<statements to be ignored>
. . .
$ENDSKIP

All statements between the $SKIP and $ENDSKIP directives, or all


statements after $SKIP until the end of the file, are totally ignored
by the Assembler. The ignored section does not appear in the listing
file (.LST) or in the documentation file (.DOC) produced by the
Documentation Generator (SDOC).

These directives can be used to delimit special comments or to


temporarily patch out sections of code.

The $IF 0 .. $ENDIF conditional directives (0 is always false) can


be used to delimit sections without preventing them from appearing
in the .LST and .DOC files, see section 6.4.

$SKIP cannot be used inside a $IFxxx..$ENDIF conditional block


unless $ENDSKIP appears before the $ENDIF, because the $ENDIF will
be skipped!
SASM - Page 29

6.9 $INIT, $ENDINIT


--------------------

All code between these directives is placed in the start-up XOB 16,
and executed on power up or restart cold. This allows initialization
code to be written close to the code which uses it, rather than in
the XOB 16 module, and improves modularity.

If XOB 16 does not exist, it is created. If XOB 16 is defined, then


the $INIT code is placed after any existing code in the XOB, in the
order is appears in the source module, and in order each module is
linked.

Module 1: Module 2: Module 3: After linkage:

PB 1 PB 2 XOB 16 XOB 16
$INIT $INIT LD R 0 LD R 0
LD R 1 LD R 2 0 0
100 200 EXOB LD R 1 \ from Module 1
$ENDINIT $ENDINIT 100 /
... ... LD R 2 \ from Module 2
EPB EPB 200 /
EXOB

Since all code between the $INIT..$ENDINIT statements is moved into


XOB 16 at an unknown location, there are some restrictions when using
labels:

To reference a label defined outside the $INIT section, the label


must be defined with EQU (e.g. LABEL EQU $), because labels defined
in another block cannot be referenced (code in the $INIT section is
actually in XOB 16).

Ok: PB 10 Fails: PB 10
$INIT $INIT
LD R 0 LD R 0
LABEL LABEL
$ENDINIT $ENDINIT
LABEL EQU $ LABEL: NOP
NOP

Because SASM does not know the location of the $INIT segment, use of
the $ and $$ symbols is not allowed between $INIT..$ENDINIT, because
the value would be incorrect.
SASM - Page 30

6.10 $NOXINIT, $ENDNOXINIT


---------------------------

Format: $NOXINIT
<text and DB definitions, TEXT/DB 4000..7999>
$ENDNOXINIT

Delimits uninitialized texts and data blocks in extension memory.

Texts and DBs 4000..7999 are stored in extension memory, which is


always RAM (read/write). Code and texts/DBs 0..3999 can be stored
in EPROM memory (read-only). If the battery backup for extension
memory fails, then texts/DBs 4000..7999 are lost. To prevent this
problem, an "extension memory initialization segment" is programmed
into EPROM by the EPROM Programming utility (SPROM), in an unused
area of text memory. This is used to restore extension memory data.
Initialization data is defined in the source file (e.g. DB 4000 [5]
1,2,3,4,5 ;1..5=initialization data), and this is stored in the
initialization segment in EPROM by default.

The $NOXINIT directive stops the initialization data being stored


in EPROM, only text/DB numbers and sizes are stored. If a text/DB
in extension memory is restored without initialization data, a
text will contain all spaces, and a DB will contain zeros.

If $NOXINIT is used, then initialization data values must be


downloaded from the .PCD file into extension memory using the
"Up/download" menu's DOWNLOAD EXTENSION MEMORY command (or "SDNLD
<filename> /X").
*** NOTE ***

The EPROM Programming utility (SPROM) has two command-line switches


which can also be used to control creation of the extension memory
init segment, if SPROM is run from the Ms-dos prompt. "/NX" (No
eXtension) stops the creation of the extension memory initialization
segment. "/CX" (Compact eXtension) creates a compact extension
memory initialization segment with NO initializer data for any
text/DB, this is the equivalent of $NOXINIT for every text/DB in
extension memory. These switches may be useful if PCD memory is full,
and there's not enough space for the extension memory initialization
segment.
SASM - Page 31

6.11 $ERROR
------------

Format: $ERROR <text>

Displays a user-defined error message, and increments the error


count. This would normally be used inside a $IF..$ENDIF statement,
which can be used to detect the error, i.e. if a user-defined
constant was out of range. If an error is generated, then no OBJect
file is produced, and SASM returns 1 to DOS (which can be checked
from a batch file via the ERRORLEVEL value).

The <text> can contain expressions and macro parameter references,


enclosed in @..@ characters. The expression is evaluated before the
text is output, which allows the values of symbols to be shown. To
place an @ character in the text, use @@.

Example:

$IF Axis > 4


$ERROR "Axis" is out of range: @Axis@
$ENDIF

If Axis is greater than 4 (e.g. 10), then SASM generates an error


message:

Error 165: AXIS.SRC: Line 45: "Axis" is out of range: 10

6.12 $WARNING
--------------

Format: $WARNING <user warning message>

Displays a user-defined warning message, and increments the warning


count. This would normally be used inside a $IF..$ENDIF statement,
which can be used to detect the warning. Warnings do not prevent
and OBJect file from being produced, and SASM returns 0 to DOS.

The <text> can contain expressions and macro parameter references,


enclosed in @..@ characters. The expression is evaluated before the
text is output, which allows the values of symbols to be shown. To
place an @ character in the text, use @@. See the example in 6.11
for $ERROR.

Example:

$IFNDEF Axis
$WARNING "Axis" is not defined
$ENDIF

If "Axis" is not defined, then the Assembler generates a warning:

Warning 6: AXIS.SRC: Line 32: "Axis" is not defined


SASM - Page 32

6.13 $FATAL
------------

Format: $FATAL <user-defined fatal error message>

Generates a fatal error message, assembly is aborted, and no object


file or listing is produced. This is normally used inside a $IF..
$ENDIF statement, which can be used to detect the fatal error. This
directive might be used to ensure a particular symbol is correctly
defined, or the correct version of an include file has been used.

The <text> can contain expressions and macro parameter references,


enclosed in @..@ characters. The expression is evaluated before the
text is output, which allows the values of symbols to be shown. To
place an @ character in the text, use @@. See the example in 6.11
for $ERROR.

Example:

$INCLUDE fred.inc
$IF fred_version < 3
$FATAL Wrong version of FRED.INC
$ENDIF

If symbol "fred_version" in FRED.INC is less than 3 then this


fatal error is generated:

Fatal Error 20: TEST.SRC: Line 32: Wrong version of FRED.INC

6.14 $ONERROR
--------------

Format: $ONERROR <text>

Defines a text which is output immediately after the error message


when an error occurs. The text is displayed on the console, appears
in the listing file, and is written to the SASM.ERR log file preceded
by "$ONERROR". The "on error" text remains valid until the next
$ONERROR statement. If there is no text after $ONERROR then text is
cleared.

The <text> can contain expressions and macro parameter references,


enclosed in @..@ characters. The expression is evaluated before the
text is output, which allows the values of symbols to be shown. To
place an @ character in the text, use @@. See the example in 6.11
for $ERROR.

Example:

$ONERROR In FB 100 ; "In FB 100" is displayed after


STH Q 100 ; each error message.
$ONERROR ; This removes the on error text.
STH Q 100
SASM - Page 33

6.15 $AUTO, Automatic Resource Allocation


------------------------------------------
NOTE: $AUTO must NOT be used in user-coded programs, it is for use
by the PG4 code generators ONLY. The syntax of this directive will
be changed for the next release.

In many cases, the actual number of an element such as a Register


or Flag is not important. For example, it makes no difference to
the program which Register is used to hold a temporary value,
providing it is not used by another part of the program while the
data it holds is still needed. "Automatic resource allocation"
means that you do not need to assign unique element numbers to
every symbol, they can be automatically assigned by the Assembler
and Linker.

Types which can be automatically assigned are:

Media: R, T, C, F, TEXT (or X), DB, SEMA (or S)


Code blocks: COB, SB, FB, PB, ST, TR

Numbers are allocated from within a range defined by the new $AUTO
directive:

$AUTO <type> <start> .. <end>


or $AUTO <type> <start> '['<count>']'

The $AUTO directive assigns a start and end element number, or


a start element and a number of elements [count]. A range is two
numbers separated by two dots '..', a count is a value enclosed
in square brackets, e.g. [10]. The start, end or count values can
contain symbols or arithmetic expressions, but they cannot contain
any external or forward references.

Excluding code blocks, texts and data blocks, each type to be auto-
matically assigned must have its own $AUTO directive. The user
program must not access any elements within the defined auto range
using direct addressing, this will generate an "auto-allocation
collision" error. This data can only be accessed via auto-allocated
symbols.

For example, to allow the automatic assignment of Register numbers


between 3500 and 4095 use:

$AUTO R 3500..4095 ; Registers 3500..4095


or $AUTO R 3500 [1096] ; 1096 Registers, 3500..4095

For code blocks, texts and data blocks, the $AUTO directive is
optional. If not supplied, then blocks are automatically allocated
from 0. If a block is defined with a direct address, e.g. FB 100,
then that address is reserved and is not used for automatic alloc-
ation. However, if a $AUTO directive supplied for the block, then
any blocks defined with direct addresses within the auto range will
generate a collision error.

Every source file to be linked must contain EXACTLY THE SAME $AUTO
directives. This is checked by the Linker. It is recommended that
all $AUTO directives are placed in a single include file, which is
$included at the start of every source module.
SASM - Page 34

A typical include file might be like this:

; Include file defining the automatic allocation regions

$AUTO R 3500..4095 ; Registers


$AUTO T 10..19 ; Timers (see DEFTC instruction)
$AUTO C 1000..1599 ; Counters (see DEFTC)
$AUTO F 7000..8191 ; Flags
$AUTO TEXT 3000..3999 ; Texts
$AUTO DB 2000..2999 ; Data Blocks
$AUTO SEMA 0..99 ; Semaphores
$AUTO COB 10..15 ; COBs ---+
$AUTO SB 16..32 ; SBs | These are optional. If not
$AUTO FB 800..999 ; FBs | present then block numbers
$AUTO PB 200..299 ; PBs | are automatically allocated
$AUTO ST 1000..1999 ; STs | from the entire range.
$AUTO TR 1000..1999 ; TRs ---+

Once the ranges for automatic allocation have been defined, symbols
can be assigned with EQUate statements, leaving out the expression
which defines the element's number, only the type is required. The
Assembler and Linker will assign absolute values to these symbols
from within the auto range.

WorkReg1 EQU R ; Reserve single workspace elements


WorkReg2 EQU R
TempFlag1 EQU F
TempCounter EQU C

To reserve an array of elements, an optional count can be given,


enclosed in square brackets:

TenRegs EQU R [10] ; Reserve 10 registers


FiveFlags EQU F [5] ; Reserve 5 flags

This is useful if an offset is used when referencing the symbols,


and saves having to assign a symbol for every element used:

ADD TenRegs
TenRegs+1
TenRegs+2
STH FiveFlags+4 ; References the last flag

Automatically assigned symbols can be used in the same way as


symbols with absolute values. They can be made public, or can
be external.

In the listing file, automatically assigned symbols are shown with


an "A" in the external (E) column, and "AUTO" in the scope column
of the cross-reference listing.
SASM - Page 35

6.16 $CPU, $STATION


--------------------

Format: $CPU <destination CPU number>


$STATION <destination S-BUS station number>

These directives make it possible to define the destination CPU


and/or S-BUS station number for the program. The downloader will
not allow the program to be downloaded into any other CPU or S-BUS
station.

These directives are particularly useful when using an S-BUS


network, since they ensure that the program cannot be downloaded
into the wrong station.

6.17 $PCDVER
-------------

Format: $PCDVER <type> <version> [ <internal version> ]

This directive defines the earliest PCD firmware version on which


the program will run. Different PCD firmware versions support
different instructions, using this directive allows the downloader
to check that the destination CPU supports the instructions in the
user program.

<type> The PCD type, which must be one of the strings listed
below. This is compared with the PCD type read from
the PCD. If the types match, then the <version> and
optional <internal version> are compared.

<type> PCD models


----------------------------------------------
PCD1.M1xx PCD1.M110/M120
PCD2.M1xx PCD2.M110/M120
PCD4.Mxx0 PCD4.M110/M120/M140/M240/M340/M440
PCD4.Mxx5 PCD4.M125/M145/M445
PCD6.M54x PCD6.M540
PCD6.M1xx PCD6.M100
PCD6.M2xx PCD6.M210/M220/M230/M250/M260
PCD6.M3xx PCD6.M3xx

<version> The earliest official firmware version for the defined


PCD type upon which this program will run. Must be 3
characters, e.g. 004. To prevent the program running
on a particular PCD type, use "NONE", e.g. to prevent
the program be loaded into a PCD 1 use:

$PCDVER PCD1.M1xx NONE

<internal version> This is optional. Preliminary PCD firmware is


often released with an internal version number, such
as B3A, $41 etc. Must be 2 digits, it excludes the
first character (usually 'B', 'X' or '$'), e.g. 3A, 41.
SASM - Page 36

$PCDVER Continued
-----------------

Examples:

;On a PCD6.M1xx, the firmware version must be V004 or above


$PCDVER PCD6.M1xx 004

;On a PCD6.M540, the firmware version must be V003 or B2A or above


$PCDVER PCD6.M54x 003 2A

;The program cannot be run on a PCD6


$PCDVER PCD6.M1xx NONE
$PCDVER PCD6.M2xx NONE
$PCDVER PCD6.M3xx NONE
SASM - Page 37

7. MACROS
==========

A macro is a block of code which is defined once, with a special name,


and can be called many times in the program using the macro name in
the same way as an instruction mnemonic. Macros can also be given
parameters which can be used in the same way as instruction operands.
The macro can be called with different parameters which are referenced
by the code inside the macro. Thus macros can be used to define the
equivalent of new instructions.

Whenever a macro name is found in the program, the block of text from
the macro definition is assembled. The macro name is "expanded" into
the full text of the macro. This is similar to an include file, but
the power of macros lies in their ability to be called with different
parameters.

7.1 Defining a Macro


---------------------

Format:

<macro name> MACRO [param1] [, param2 ...] [;[;] auto comment]


[paramx [, paramy ...]] [;[;] comment]
<statements> [;[;] comment]
...
ENDM

Example:

ANDGATE MACRO INPUT, OUTPUT ; Macro name and parameters


STH INPUT ;; Local comment }
ANH INPUT+1 ; Comment } Macro body
OUT OUTPUT }
ENDM ; End of macro

When a macro is defined it is given a name (e.g. ANDGATE), optional


"formal" parameters, and a macro body.

Macros can have up to 128 formal parameters which can be supplied on


one or more lines, separated by commas. If the macro has parameters,
the name of the first parameter must be on the same line as the MACRO
statement. The parameter names can be used inside the macro body.
When the macro is called, all refernces to the "formal" parameters are
replaced by the "actual" parameters, see section 7.2.

The macro body can contain any statements or directives. If a comment


in the macro body is preceded by two semi-colons ";;", the comment will
not appear when the macro is expanded.

The ENDM statement ends the macro definition. ENDM must not be preceded
by a label on the same line, e.g. LAB1: ENDM is illegal. Instead, put
the label on the preceding line.

NOTE: Macros cannot be referenced before thay have been defined in a


source file.
SASM - Page 38
Notes on macro definitions
--------------------------
* Macro names are up to 10 characters long and can contain the same
characters as symbols. Macros are listed in the XREF table in the
same way as symbols - where they are defined and where they are
called is shown.

* Macro names and macro parameters cannot have the same name as any
other symbol or reserved word (including mnemonics).

* Macro parameters can have the same name as symbols or labels defined
outside the macro - the macro parameter names are local to the
macro.

* Macro definitions can contain macro calls, which can themselves


contain macro calls, and so on up to a nesting depth of 9.

* Labels inside a macro are always local to the macro. It is illegal


to jump into a macro from outside, or to jump out of a macro. Dummy
labels are generated by the assembler. However, "<label> EQU $" can
be used. Keep local label names as short as possible.

* The DEF statement should be used to define the names of symbols used
in macros. If EQUate is used in a macro, an error occurs if the
macro is called more than once in the same module.

* $INCLUDE in a macro includes the file in the macro definition, NOT


in each macro call. The file is included only once.

* $IFDEF and $IFNDEF do not work with macro parameters. Use $IFB and
and $IFNB instead, see section 7.3.

* To compare actual macro parameter strings use $IFE and $IFNE, see
section 7.3.

* Other $IFxxx..$ELSE..ENDIF statements inside a macro are treated


normally. These statements can contain macro parameters.

* The /M and /NM switches can be used to enable/disable the expansion


of macros in the listing file (.LST). Macros are always expanded in
the documentation file (.DOC).

* Macros must be defined before they can be called. Macros must be


expanded during pass 1 assembly.

* Nested macro definitions are not allowed - macros cannot be defined


within macros.

* The '#' character can be used as a delimiter between a formal


parameter and another text in the macro so that symbol names,
mnemonics or new expressions can be created:

FRED MACRO STR1, STR2


STH INPUT#STR1
STR2#L I 1
ENDM

Call: Expands to:


FRED (100, AN) STH INPUT100
ANL I 1
SASM - Page 39

7.2 Calling a Macro


--------------------

Format:

<macro name> [(] [param1] [, param2 ...] [;[;] comment]


[paramx [, paramy ...]] [)] [;[;] comment]

Example:

ANDGATE I 0, O 32
or ANDGATE (I 0, O 32) ; The brackets are optional

Using the definition in section 7.1, this is expanded to:

STH I 0
ANH I 1 ; This is a comment
OUT O 32

To call a macro, the macro name is used as if it is an instruction


mnemonic. It must be the first name on the line, unless preceded by
a label. Actual parameters are supplied as a list separated by commas
which can be on one or more lines.

As the macro is expanded, the formal parameters inside the macro body
are replaced by the actual parameters. This is done by simple string
replacement. The parameter name is replaced by the string supplied
as the actual parameter. The assembler detects errors where the actual
parameters are used in the macro body.

If a macro has been defined to accept parameters, it is not necessary


to supply all the parameters. The $IFB and $IFNB directives can be
used to check for the existence of a parameter. The $IFE and $IFNE
directives can be used to compare a parameter string with a given
string.

If parameters are left out, the correct number of commas must still
be present so that the parameters are in the correct positions. For
example, in this macro call parameters 1 and 3 are not supplied:
"FRED ,param2,,param4". If the last parameter (or last few parameters)
will be left out, the trailing commas should also be left out, unless
the parameters are enclosed in brackets, e.g. "FRED (param1,param2,,)".
Because parameters can be on more than one line, the string after the
last comma is interpreted as a parameter if brackets are not used.

*** NOTES ***

* Macros cannot be called before they have been defined, the macro
definition must appear first in the source file.

* Parameters are NOT replaced inside comments or texts.

* The list of actual parameters can be optionally enclosed in


brackets. The brackets should be used to prevent the trailing comma
problem desribed above.

* Actual macro parameters CANNOT contain the ( ) or ; characters.

* Leading and trailing spaces are stripped from each actual


parameter.
SASM - Page 40

7.3 $IFB, $IFNB, $IFE, $IFNE and EXITM


---------------------------------------

These directives can be used to control the expansion of a macro


according to the actual parameters supplied with the macro call.

$IFB and $IFNB mean "if blank" and "if not blank". These are used to
determine if an actual parameter was supplied or not.

Format:
$IFB <parameter> ; The < and > must be present!!
... ; $ELSE and nested $IF's are allowed
$ENDIF

Example:
ANDGATE MACRO INPUT, OUTPUT
STH INPUT
ANH INPUT+1
$IFNB <OUTPUT> ; If "OUTPUT" is defined,
OUT OUTPUT ; then write to output, else
$ENDIF ; leave result only in ACCU
ENDM

Call: Expands to:


ANDGATE I 32 STH I 32
ANH I 33

$IFE and $IFNE mean "if equal" and "if not equal". These compare an
actual parameter string with a given string, or compare two actual
parameter strings. The comparison is not case sensitive (unless the
foreign characters are used). NOTE: The STRINGS themselves are
compared, NOT the symbol values. To compare symbol values and numbers
use $IF or $IFN. To check symbol types use $IFTYPE.

Format:
$IFE <param1> <param2> ; Enclosing < > must be present!!
... ; $ELSE and nested $IF's are allowed
$ENDIF

Example: (NOTE: This example has been superseded by $IFTYPE.)


MOVE MACRO SrcType, SrcValue, DestType, DestValue
$IFE <SrcType> <K> ;; If SrcType string is
LD DestType DestValue ;; "K" then use the LD
SrcValue ;; instruction
$ELSE
COPY SrcType SrcValue ;; If source type is not
DestType DestValue ;; K then use COPY
$ENDIF
ENDM

Call: Expands to:


MOVE R, 1, R, 2 COPY R 1
R 2
MOVE K, 234, R, 2 LD R 2
234
SASM - Page 41

$IFB, $IFNB, $IFE, $IFNE and EXITM continued


--------------------------------------------

EXITM ends the expansion of the macro, this can be used inside
conditional directives. This is useful to exit from deeply nested
$IFxxxx statements. For example:

ANDGATE MACRO INPUT, OUTPUT


STH INPUT
ANH INPUT+1
$IFB <OUTPUT> ; If "OUTPUT" is blank,
EXITM ; stop macro expansion
$ENDIF
OUT OUTPUT ; else write the output
ENDM

Call: Expands to:


ANDGATE (I 0) STH I 0
ANH I 1

ANDGATE (I 0, O 32) STH I 0


ANH I 1
OUT O 32

7.4 LEQU and LDEF


------------------

These are exactly the same as the EQU and DEF statements in
sections 4.3 and 4.4, except they are for use inside macros, and
define symbols which are local to the macro. This allows symbols
to be defined within macros which do not produce "multi-defined
symbol" errors if the macro is called more than once in the same
module. Keep local symbol names as short as possible.

Format:

<local symbol name> LEQU [type] <expression> [;comment]


<local symbol name> LDEF [type] <expression> [;comment]
SASM - Page 42

7.5 Macro Examples


-------------------

This macro is useful for defining public symbols. It illustrates


how macros can be used to save repetative typing.

PUBLIC MACRO SYMBOL, VALUE


PUBL SYMBOL
SYMBOL EQU VALUE
ENDM

; PUBLIC DATA (GLOBAL SYMBOL DECLARATIONS)

; RESULTING CODE:
PUBLIC Reg, R 100 ; PUBL Reg
; Reg EQU R 100
PUBLIC CBase, C 16 ; PUBL CBase
; CBase EQU C 16
PUBLIC Float, 1.2e6 ; PUBL Float
; Float EQU 1.2e6
PUBLIC Char, 'C' ; PUBL Char
; Char EQU 'C'
SASM - Page 43

Macro examples continued


------------------------

The following example defines the old PCA instructions WIH and WIL
which are not included in the PCD's instruction set. If shows how
macro call can be nested. NOTE: These macros are not suitable for
true cyclic programs (because they may wait forever in a loop), and
are included as an example only.

TBASE EQU 256 ; TIMERS ARE 256..287


FBASE EQU 288 ; FLAGS ARE 288..999, I/Os ARE 0..255

;; WAIT IF - USED BY "WAIT IF HIGH" AND "WAIT IF LOW"

WI MACRO OPCODE, ELEMENT


LOOP:
$IF ELEMENT >= FBASE ; IS IT A FLAG ?
OPCODE F ELEMENT
$ELSEIF ELEMENT >= TBASE ; IS IT A TIMER/COUNTER ?
OPCODE T|C ELEMENT
$ELSE ; MUST BE AN INPUT/OUTPUT
OPCODE I|O ELEMENT
$ENDIF
JR H LOOP ; LOOP UNTIL ACCU HIGH
ENDM

;; WAIT IF HIGH

WIH MACRO ELEMENT


WI STH, ELEMENT ; USE STH MNEMONIC
ENDM

;; WAIT IF LOW

WIL MACRO ELEMENT


WI STL, ELEMENT ; USE STL MNEMONIC
ENDM

; EXAMPLE PROGRAM USING THE "WIH" AND "WIL" MACROS

COB 0
0
WIH 0 ; WAIT IF INPUT 0 IS HIGH
...
WIL 256 ; WAIT IF TIMER 256 IS LOW
...
WIH 288 ; WAIT IF FLAG 288 IS HIGH
...
ECOB
SASM - Page 44
8. LISTING FORMATS
===================

A listing file is only produced if the /L switch is used. The listing


is produced even if there are assembly-time errors. Listings are
useful for examining the code generated by macros, and for examining
the location of errors.

The listing width is 122 characters, and must be printed either on


132 column paper, or on 80 column paper with the printer set to
"compressed print" mode. The page sizes, and printer initialization
and de-initialization strings can be defined from the "Configure"
menu, or by running SCONFIG from the DOS prompt. The configuration
is read from the file PCDSETUP.DAT.

For unsatisfied conditionals (an $IFxxxx which is not TRUE), the ADDR,
OPC M OPERAND and IP fields are left blank, statements within the
unsatisfied block are not processed. Statements between $SKIP..$ENDSKIP
directives do not appear in the listing.

8.1 Listing
------------

Listing format example, see next page for description:

*** SAIA PCD MACRO ASSEMBLER V1.7 *** FILE: X.SRC ( 2.01.90 9.23 ) ASSEMBLED: 2.01.90 9.23 PAGE 1
<registered user name>
<title>
<subtitle>

LINE ADDR MNEMO MC OPERAND IEM SOURCE

0001 ; LISTING FILE FORMAT


0002
0003 $TITLE <title>
0004 $STITLE <subtitle>
0005
0006 EXTN Valve
0007 PUBL Motor
0008 I|O 0 On EQU I 0 ; On switch
0009 I|O 33 Motor EQU O 33 ; Turns on the motor
0010 F 100 Error EQU F 100 ; Error flag
0011 F 101 MotorOn EQU F 101 ; High is motor is on
0012
0013 ;------ MOTOR CONTROL BLOCK
0014
0015 0 PB 0 PB 0
0016 1 STH I|O 0 STH On ; If ON switch pressed
0017 2 ANL F 100 ANL Error ; and no error flag
0018 3 OUT I|O 33 OUT Motor ; turn on the motor
0019 4 OUT F 101 OUT MotorOn ; and set the flag
0020 5 OUT 0 0 E OUT Valve ; and open the valve
0021 6 OUT 0 OUT Lamp ; and turn on the lamp
^
**** Error 42: X.SRC: Line 21: Symbol not defined: Lamp
0022 7 EPB EPB
0023
0024 ;------ END OF MOTOR CONTROL BLOCK
0025

Assembly complete, 0 warnings, 1 errors


SASM - Page 45

Listing continued
-----------------

TOP LINE:

The top line of each page shows the Assembler version number,
the source file name and its creation date and time, the date
and time of assembly, and the page number. The date and time
are formatted according to the country, month first if US etc.

<registered user name>


<title>
<subtitle>

The registered user name, and an optional title and subtitle


appear on the next three lines of each listing page. <title>
is generated by the $TITLE directive, <subtitle> is generated
by $STITLE.

LINE field:

Source file line number. 4 digits with leading zeros (0001-


9999). For include files, this changes to the include file
line number, then back to source file line number at the end
of the include file.

ADDR field:

Relocatable program line number. Up to 5 digits without


leading zeros. Starts from 0 in each module listing.

MNEMO MC OPERAND field:

Shows the instruction mnemonic, medium/special/conditional/


channel/priority code. Externally declared operands are shown
as 0, or their partial value if addition or subtraction has
been performed using an external symbol.

IEM field:

I A number in this column indicates that the line is


from an include file. The number shows the include
file nesting level (1..9). If the number is 1, the
the line is from the first include file; if it is 2,
the line is from an include file which was included
by the first include file etc.

E Indicates the line contains an external identifier


A (actual value not yet resolved), the operand field
contains the partial value of the operand. For
automatically assigned symbols, this column will
show an 'A'.

M A number in this column shows that the line is from


a macro. The value is the macro nesting depth (1..9).
SASM - Page 46

Listing continued
-----------------

SOURCE field:

Contains users source file line, exactly as it is in the source


file. If the line is longer than the page width specified by
in the configuration program, the line wraps around onto the
next line in the listing.

Error Messages:

Assembly-time error messages are formatted as shown in the


listing example. The error message shows the error number,
the name of the file containing the error (which may be an
include file), the source file line number of the error, an
error message text and a caret (^) pointing to the position
of the error on the source line.

In the case of blocks which contain no closing statement, for


example "FB n" with no closing "EFB" or "$IFxxxx" with no
closing "$ENDIF", the error message appears at the end of the
file.
SASM - Page 47

8.2 Cross Reference List and Symbol Table


------------------------------------------

The cross reference list and symbol table are merged into one list,
called the "cross reference list".

The cross reference list is appended to the listing if requested on


the command line. It always begins on a new page.

Symbol Table format example, see next page for description:

*** SAIA PCD MACRO ASSEMBLER V1.7 *** FILE: X.SRC ( 2.01.90 9.23 ) ASSEMBLED: 2.01.90 9.23 PAGE 1
<registered user name>

CROSS REFERENCE LISTING AND SYMBOL TABLE


SYMBOL TYPE VALUE SCOPE CROSS REFERENCE LIST

Error F 100 10# 17


Motor I|O 33 PUBL 7 9# 18
MotorOn F 101 11# 19
On I|O 0 8# 16
Valve 0 EXTN 6# 20

Assembly complete, 0 warnings, 1 errors

TOP LINE and <registered user>

As described in section 8.1. The title and subtitle do not


appear.

SYMBOL field:

First 10 (significant) characters of symbol. The list is in


alphabetical order, where "_" comes after "Z". If foreign
characters are used in the symbols, the symbols may not be
in the correct order because of the extended ASCII codes
assigned to these characters.

SCOPE field:

EXTN means external symbol, PUBL means public symbol, DEF


means DEFined symbol, AUTO means value will be automatically
assigned (see section 6.15), blank means local symbol.
SASM - Page 48

Cross reference list and symbol table continued


-----------------------------------------------

TYPE field:

Description of the type attribute of the symbol. Types


are given where the symbol is defined (e.g. Symbol EQU I 0).

blank Untyped constant or external symbol (type


unknown)
I|O Input or Output (share same address space)
F Flag
T|C Timer or Counter (share same address space)
R Register
K K constant
COB Cyclic Organization Block
XOB Exception Organization Block
PB Program Block
FB Function Block
SB Sequential Block
ST Step or Initial Step
TR Transition
TEXT Text
DB Data Block
SEMA Semaphore (for LOCK and UNLOCK)
= Function Block parameter number
LABEL Label
MACRO Macro
? The type cannot be determined due to an
assembly-time error.

VALUE field:

The actual value of the symbol. Externally declared operands


are shown as "0" or their partial value if arithmetics have
been performed. A "?" is shown if the value cannot be computed
due to an assembly-time error.

For labels, the offset from the start of the labels code block
is shown.

CROSS REFERENCE LIST field:

Contains each source program file text line number where each
symbol is referenced or defined, in numerical order. The line
number where the symbol is defined is postfixed with a "#".
Note that more than one "#" may appear if "DEF" is used.

If the identifier is defined in an include file, the line


number is that of the $INCLUDE directive.

Line numbers are displayed without leading zeros.


SASM - Page 49

9. ERROR HANDLING
==================

9.1 Fatal Errors


-----------------

A fatal error causes the assembly to be aborted, any open files are
closed. If the error is not a command line error (if it occurs after
assembly has started), the object file is deleted. This prevents the
linker from being able to create a .PCD file if the object file was
not properly created.

If invoked from DOS, disk file read/write errors are initially


handled by DOS, which displays an error message and prompts the user
to "Abort, Retry or Ignore". Pressing 'A' to abort will close files
and exit, perhaps leaving incomplete or empty output files on the
disk. Also, if the printer is used, the printer de-initialization
string will not be sent. Pressing 'R' causes the operation to be
retried. Pressing 'I' causes a return to the assembler program,
which will display a fatal error message (4, 5 or 6), delete the
object file, de-initialize the printer (if used), and exit.

Fatal Error 0: No file name

No source file name entered on the command line.

Fatal Error 1: Too many parameters

There is more than one file name or more than 10


/Dsym[=val] switches on the command line.

Fatal Error 2: Invalid switch "switch"

The indicated switch is not a valid assembler switch.


For /Dsym[=val] switches, make sure the symbol name is
not a reserved word and is not multi-defined.

Fatal Error 3: Invalid file name: <filename>

The name of the source file name is not a valid DOS


filename.

Fatal Error 4: Can't open file: <filename>

For reads: the source file does not exist.


For writes: the disk is write protected, or full.
May also be caused if there is not enough memory
available for the file I/O buffers.

Fatal Error 5: Read error on file: <filename>

The indicated source file cannot be read correctly.

Fatal Error 6: Write error on file: <filename>

The indicated listing or object file cannot be written.


The disk may be full or write protected.
SASM - Page 50

Fatal errors continued


----------------------

Fatal Error 7: Printer not ready

Switch /P was given and the printer is not ready.

Fatal Error 8: Out of memory

The computer does not contain enough memory to assemble


the source file. If many macros are being used, use the
/TEMP switch (use temporary file). If the source file is
very large, it can be split into several smaller source
modules which will assemble correctly using less memory.
Try removing any large memory-resident programs such as
SHELP before assembling.

Fatal Error 9: Line n: Line too long

The maximum length of a source file line is 300 characters.

Fatal Error 10: Too many lines

The maximum number of lines allowed in a source file is


9999. However, a more practical maximum is about 2000
lines, so that the module doesn't take too long to be
assembled.

Fatal Error 11: Invalid include file name: <include file name>

The include file name following a $INCLUDE directive is not


a valid DOS file name, or is a device name (PRN, CON etc).

Fatal Error 12: Can't open include file: <include file name>

The include file cannot be found in the current directory,


or the PCD directory given in the environment by "SET PCD=
d:directory".

Fatal Error 13: Include file nesting too deep: <include file name>

$INCLUDE files can be nested up to 10 deep. An include


file can include another file, which in turn can include
another file and so on, up to 10 times. This error can
be caused by an include file which includes itself.

Fatal Error 14: Symbol in $IF not defined: <symbol name>

If a symbol is used in a conditional statement, it must


be defined BEFORE the statement. Forward references are
not allowed in conditional statements.

Fatal Error 15: Error count exceeds 100

Assembly is always aborted if more than 100 errors are


detected.
SASM - Page 51

Fatal errors continued


----------------------

Fatal Error 16: PCDSETUP.DAT not found or invalid


Fatal Error 16: Program not licensed

The correct version of this file should be either in the


current directory, or in the PCD directory given in the
environment defined by "SET PCD=path".

Fatal Error 17: Recursive $INCLUDE file: <include file name>

An include file includes itself. Not that it may not


directly include itself, but may be included by a file
which it includes.

Fatal Error 18: Line n: Stack overflow

An expression is too long or too complex to be evaluated.

Fatal Error 19: Program too big for n/n Starter Package

The "Starter Package" has a restricted PCD memory size


and does not allow use of extension memory (TEXTs/DBs
4000..7999). This error occurs if the code or text in
the module is too large, or extension memory has been
used. "n/n" shows the max. code size in lines/text size
in bytes, e.g. 128/64 = max. 128 code lines + max. 64
text characters.

Fatal Error 20: <user-defined message>

This fatal error is generated by the $FATAL statement


in the user program, see section 6.13.

Fatal Internal Error: <file>: Line <line>: Reference <text>

SASM detected an internal error, <text> indicates the


module and position. Notify Matt Harvey at SAIA, MURTEN
immediately.
SASM - Page 52

9.2 Assembly-time Errors


-------------------------

If there are any non-fatal assembly-time errors, the object file


is also deleted.

If source file errors are discovered during assembly, they are


reported to the console, and the error message also appears in the
listing, with a caret (^) pointing to the location of the error.

Assembly-time error messages have the form:

Error <errnum>: <file>: Line <line number>: <description>

Where:

<errnum> Is the error number.


<file> Is the name of the source or include file
where the error was detected.
<line number> Is the line number in the source or include
file where the error has occurred (1-9999).
<description> Is the error message text.

For simplicity only the error numbers and texts are shown in the
following list of errors, and errors with self explanatory messages
are not accompanied by a detailed description.

Error 20: $IF nesting too deep

$IFxxx statements can be nested up to 30 deep.

Error 21: $ELSE without $IF

An unexpected $ELSE, $ELSE must be preceded by $IF.

Error 22: Missing $ENDIF

A $IF statement has no closing $ENDIF.

Error 23: $ENDIF without $IF


Error 24: $ENDSKIP without $SKIP
Error 25: $ENDLAN without $LAN
Error 26: $ENDSASI without $SASI

These closing directives must be preceded by the opening


directive.

Error 27: $ELSEIF after $ELSE

$ELSEIF cannot follow $ELSE because $ELSE has no condition,


(ELSE is always the inverse of the state of the preceding
IF).
SASM - Page 53

Assembly-time errors continued


------------------------------

Error 28: EXITM outside macro

The EXITM statement is for use inside a macro definition.

Error 29: Multi-defined macro parameter

The same formal macro parameter name has been used more
than once in a macro definition.

Error 30: Unknown directive

The $directive is not valid.

Error 31: Syntax error

An invalid, unknown or unexpected character or statement.


Invalid use of operators, missing opening or closing
parentheses etc.

Error 32: Invalid expression

The expression contains an invalid constant (out of range),


divide by zero, or is an unknown mnemonic or statement.

Error 33: Extra character(s) on line

After processing all the valid tokens on the source line,


extra characters are still present, these are not processed.

Error 34: Missing operand

The preceding instruction requires more operands.

Error 35: Invalid operand

The operand is completely incorrect, a more detailed error


message cannot be provided.

Error 36: Unexpected operand

The operand is not required by the preceding instruction.

Error 37: Multi-defined label: <label name>

The same jump label has been defined more than once in the
same block. Labels cannot have the same name as a symbol.

Error 38: Label outside block

Since jump labels are local to the block in which they are
defined, a label cannot be defined outside a block. Labels
can address the first line of a block, providing they are
on the same line as the first mnemonic, e.g. "LABEL: PB 0".
SASM - Page 54

Assembly-time errors continued


------------------------------

Error 39: Illegal SB call

Sequential Blocks can only be called from a COB, FB or PB.

Error 40: Illegal symbol

The symbol contains invalid characters.

Error 41: Multi-defined symbol: <symbol name>

The symbol has been defined more than once. Labels cannot
have the same name as a symbol.

Error 42: Symbol not defined

The symbol or label has not been defined.

Error 43: Symbol not evaluated

Another error has prevented the symbol's value from being


properly evaluated.

Error 44: Symbol has incompatible type

Typed symbols in an expression do not have the same type,


or the expression's type prefix does not match the type of
the symbol(s) in the expression. Also occurs if the symbol
is defined as a macro.

Error 45: Illegal use of typed symbol

A typed symbol cannot be used in this context.

Error 46: Invalid type

The medium type or the symbol's type is invalid.

Error 47: Already declared external


Error 48: Already declared public

The symbol has more than one EXTN or PUBL declaration.

Error 49: Labels can't be public

Labels are always local to a module. Use a symbol equated


to $ or $$, and make that public.

Error 50: DEFined symbols can't be public

The value of DEFined symbols can change within the source


module. SASM would not know which value to make public.
SASM - Page 55

Assembly-time errors continued


------------------------------

Error 51: Illegal use of external

Externals cannot appear in conditional directive expressions,


and cannot appear in expressions which do more than add or
subtract a constant from an external, or add an external to
a constant. The pre-defined symbol _BLOCKNUM_ cannot be
used if the block number is external. $ and $$, and symbols
defined with $ or $$, cannot be used in $INIT segments
because the INIT segment location is unknown and so is the
$ or $$ address.

Error 52: More than one external reference

An expression can contain only one external component.

Error 53: Missing symbol

A symbol is missing in an EXTerNal or PUBLic declaration.

Error 54: FB param numbers (=) can't be public

If Function Block parameter numbers are defined with symbols


(using "symbol EQU = number"), these symbols cannot be made
PUBLic. The EQUates should be used in an include file.

Error 59: Illegal use of type or condition code

A medium control code, special codes or condition code


cannot be used in this context.

Error 60: Illegal label

Illegal characters in a label's symbol.

Error 61: Illegal use of label

A symbol with type "label" is illegal in this context.

Error 62: Label not defined

The label is not defined, or is not in the current block.

Error 63: Multi-defined block

The COB, XOB, PB, FB, SB, IST, ST or TR has already been
defined in this source module.

Error 64: Block within block

Definitions of COB, XOB, PB, FB and SB code blocks cannot


appear within a code block.
SASM - Page 56

Assembly-time errors continued


------------------------------

Error 66: Missing end of block statement

Each code block must have an end of block statement,


(COB..ECOB, XOB..EXOB, PB..EPB, FB..EFB, SB..ESB, ST..EST,
TR..ETR).

Error 67: Not in Sequential Block

STep and TRansition definitions can appear only inside an


SB definition.

Error 68: Wrong end of block statement

The end of block statement does not match the start of block
statement, e.g. COB..EXOB.

Error 69: Instruction(s) outside block

All instructions must be within a code block (COB, PB etc).


Inside an SB, all instructions must be inside step or
transition blocks (IST..EST, ST..EST or TR..ETR).

Error 70: Illegal FB parameter reference

The FB parameter reference (using '=') can be used only on


instructions within an FB, or the instruction does not allow
parameter references.

Error 71: Missing ENDM

A macro definition must be terminated by ENDM. ENDM cannot


be preceded by a label.

Error 72: Missing macro parameter

A formal parameter in the macro definition is missing.

Error 73: Too many macro parameters

Macros can have up to 128 parameters.

Error 74: ENDM without MACRO

ENDM can only be used to end a macro definition.

Error 75: Macro call nesting too deep

A macro can call a macro, which in turn can call another


macro up to a nesting depth of 9.

Error 76: Nested macro definition

Macros cannot be defined inside macro definitions. Each


macro must be defined separately.
SASM - Page 57

Assembly-time errors continued


------------------------------

Error 77: Recursive macro call

A macro calls itself. This may be an indirect call via


another macro.

Error 78: Illegal use of macro

The macro name cannot be used in this context. For example,


macros cannot be made public.

Error 79: Missing < or >

For the $IFB and $IFNB directives, the string must be


enclosed in angle brackets <...>.

Error 80: Unexpected text

A text definition inside double quotes "..." is not related


to any TEXT statement.

Error 81: Missing text

A TEXT statement is not followed by any text, or the text


ends in a comma ',' so SASM was expecting a formatted
symbol.

Error 82: Multi-defined text

The TEXT number has already been defined.

Error 83: Missing closing quote

A TEXT definition has no closing double quote before the end


of the line.

Error 84: Invalid character in "< >"

The character is not '<', '>', '"' or a decimal number.


Numeric characters inside square brackets can be between
between <1> and <255>.

Error 85: Invalid character in text

The ASCII NUL character (0) is not allowed in a text, this


character is used to delimit the end of the text.

Error 86: Text too big

The text is longer than the given length, or the text is


longer than 3072 (3K) bytes (including the terminating NUL).
SASM - Page 58

Assembly-time errors continued


------------------------------

Error 87: Missing closing bracket '>'


Error 88: Unexpected closing bracket '>'

Each opening '<' must have a closing '>' in the text. '<'
and '>' characters must themselves be enclosed in angle
brackets to enter these into a text: <<> <>>.

Error 89: Invalid text number

Text numbers can be between 0 and 3999. NOTE: For PCD


firmware version V002 or below, text numbers are 0-999.
Text numbers 1000-3999 are available ONLY with version
V003 and above.

Error 90: Invalid text length

The text length given in square brackets is invalid, max


3072 characters.

Error 91: Invalid LAN text

The text between the $LAN..$ENDLAN directives is not a


valid LAN text, the format is incorrect.

Error 92: Invalid SASI text

The text between the $SASI..$ENDSASI directives is not


a valid SASI instruction text.

Error 93: Missing $ENDSASI or $ENDLAN

A $LAN directive was found while inside a $SASI section,


or vice-versa.

Error 94: Invalid format

The format of a symbol inside a text is invalid, see


section 3.5.

Error 95: Invalid LAN text number (0..3999 only)

The LAN2 co-processor can only access texts 0..3999, it


cannot access texts 4000..7999 in extension memory.

Error 100: Illegal use of reserved word

Indicates an attempt to use a reserved word (mnemonic,


declaration or mc/sc/cc) as a symbol.

Error 102: Invalid condition code

The condition code is invalid.


SASM - Page 59

Assembly-time errors continued


------------------------------

Error 103: Invalid data size

The MOV instructions data size is invalid.

Error 104: Incompatible data types

For the STXM and SRXM instructions, the source and dest-
ination medium types must be compatible. For example, a
Register source cannot have a Flag destination.
In a MOV instruction, the data sizes of the 2nd and 4th
operands must be the same.

Error 105: Missing type

Instruction requires a medium type, or the symbol


used in the operand is an untyped symbol. The operand
range has not been checked.

Error 107: Missing accu status

The instruction requires an accumulator status (H|L|P|Z|N|


E|C).

Error 108: Missing analogue channel number

The instruction requires a channel number.

Error 109: Invalid counter channel

Invalid CASI, CRD or CWR instruction's counter number.

Error 110: Invalid memory flag


Error 111: Invalid I|O number
Error 112: Invalid output number
Error 113: Invalid flag number
Error 114: Invalid T|C number
Error 115: Invalid register number
Error 116: Invalid constant
Error 117: Negative constant
Error 118: Invalid PB number
Error 119: Invalid FB number
Error 120: Invalid COB/XOB number
Error 121: Invalid SB number
Error 122: Invalid ST/TR number
Error 123: Invalid nibble number
Error 124: Invalid bit number
Error 125: Invalid byte number
Error 126: Invalid word number
Error 127: Invalid long word number
Error 128: Invalid digit number
Error 129: Invalid timebase
Error 130: Invalid base address

See next page.


SASM - Page 60

Assembly-time errors continued


------------------------------

Error 131: Invalid semaphore


Error 132: Invalid test number
Error 133: Invalid exponent
Error 134: Invalid FB parameter
Error 135: Invalid relative address
Error 136: Invalid accu status
Error 137: Invalid number of elements
Error 138: Invalid channel
Error 139: Invalid station number
Error 140: Invalid switch
Error 141: Invalid control signal
Error 142: Invalid analogue channel
Error 143: Invalid priority
Error 144: Invalid data block number
Error 145: Invalid data block length

The operand is out of range or the number is invalid.


Note that certain instructions do not allow the full
range of element addresses or values, and the range of
some operands is dependent on the values of preceding
operands (SRXM, STXM, TFR, BITI, BITO, DIGI, DIGO etc).

Error 146: Multi-defined data block

The Data Block has already been defined.

Error 147: Missing data block length

Data Blocks must have a length enclosed in angle brackets,


even if it's empty "[]".

Error 148: Missing value(s)

A value was expected. Usually caused by a trailing comma


in a list of values in a Data Block definition.

Error 149: SASI or LAN texts can't have length

Special texts defined between the $SASI..$ENDSASI and


$LAN..$ENDLAN directives cannot be given a "[length]".

Error 150: Parameter has bad context

The same function block parameter number has been used


for two different operand types, one of which is an error.
Only the second use of the parameter generates an error.

STH = 3 ; Parameter 3 is I|O|F|T|C element


.....
BITI = 3 ; Parameter 3 is untyped 16-bit value
^
*** Error 150: Parameter has bad context
SASM - Page 61

Assembly-time errors continued


------------------------------

Error 151: Text already in use as data block


Error 152: Data block already in use as text

Texts and data blocks share the same addressing, a text


cannot have the same number as a DB. For example, if Text
0 is defined then DB 0 cannot be defined, and vice versa.

Error 153: Text/DB data too long

An explicit size has been given to a text or data block,


and the number of initializers is longer than the size.
If this is a Fatal Error, then the initializer buffer is
full (holds up to about 12'900 DB element initializers,
so this error should be rare!).

Error 154: Register indirect, must have data type (MC)

For the TFRI, STXMI and SRXMI instructions, which use


register indirect addressing, the source and destination
data type must be explicitly defined. For example:

STXMI 0
R 10
I SourceReg ─┬─ These are Registers
F DestReg ─┘ e.g. SourceReg EQU R 10
└────────────── Data type *must* be present

Error 155: Register indirect, symbol must be a register

For the TFRI, STXMI and SRXMI instructions, which use


register indirect addressing, the source and destination
symbols must be Registers. See above.

Error 160: Already in $INIT segment

Nested $INIT directives are not allowed.

Error 161: $ENDINIT without $INIT

Missing opening $INIT directive.

Error 162: Missing $ENDINIT

Missing closing statement.

Error 163: Illegal in $INIT segment

Code in the $INIT segment is placed in XOB 16, and


therefore cannot contain any block start or end
instructions such as COB/ECOB, PB/EPB etc.

Error 164: LEQU or LDEF outside MACRO

These declarations are only for use inside macros for


defining symbols local to the macro.
SASM - Page 62

Assembly-time errors continued


------------------------------

Error 165: <user defined error message>

This error is generated by the $ERROR directive.

Error 166: Local symbol has same name as macro parameter

Formal macro parameters in a macro definition cannot


have the same name as a symbol local to the macro
defined with LDEF or LEQU or as a local label.

Error 167: Forward reference to macro: <name>

Macros must be defined in the source file before they


are called. Move the macro definition or $include
statement to the start of the source file.

Error 170: Multi-defined $AUTO type: <type>

The element type already has a $AUTO directive. Only


one $AUTO is allowed per type, see section 6.15.

Error 171: Auto allocation overflow on type: <type>

The automatically allocated element number has gone


outside the range defined by the $AUTO directive. The
range of elements which can be automatically assigned
must be increased, see section 6.15.

Error 172: No $AUTO directive for this type: <type>

A symbol has been declared without an absolute value.


Before automatic resource allocation can be used, an
$AUTO directive is required for the indicated type,
see section 6.15.

Error 173: Illegal use of auto-allocated symbol

Symbols whose values are automatically allocated cannot


be used in DEF or LDEF declarations.

Error 174: Auto-allocation collision: <symbol> | <type> <value>

The absolute value of the symbol or operand falls within


the area defined by the type's $AUTO directive. It is
illegal to reference items in the auto area directly.
See section 6.15.

Error 175: Auto-allocation not allowed for type: <type>

Only these types can be automatically allocated:


Media: R, T, C, F, TEXT (or X), DB, SEMA (or S).
Code blocks: COB, SB, FB, PB, ST, TR.
SASM - Page 63

Assembly-time errors continued


------------------------------

Error 176: $AUTO directive overlap for <type> and <type>

Texts and Data Blocks share the same address space, as


do Timers and Counters. Because of this, the $AUTO
directives for these types must not overlap, they
must define separate addresses.

Error 177: Auto-allocation array overflow: <symbol>

If an array is auto-allocated, this error is generated if


a symbol is defined which references this array but is
outside the array bounds.
E.g. Regs EQU R [10] ;Regs+0..Regs+9
QReg EQU Regs+10 ;Regs+10 is outside range 0..9

Error 178: Multi-defined $CPU number

More than one $CPU directive exists in the source file


and included files. This is only allowed if they all
define the same CPU number.

Error 179: Multi-defined $STATION number

More than one $STATION directive exists in the source


file and included files. This is only allowed if they
all define the same S-BUS station number.

Error 180: Invalid $PCDVER data

The $PCDVER directive data is invalid, see section 6.17.

Error 200: Pass 2 phase error

The value of a label or symbol on the second pass of the


assembler is not the same as the value assigned to it on
the first pass. This is often caused by incorrect forward
references, or if a macro reference precedes the macro
definition in the source file (macros must be defined
before thay can be called).
SASM - Page 64

9.3 Warnings
-------------

Warnings do not stop assembly and so do not affect the object file.

Warning 1: Can't sort symbol table

There is not enough available memory to sort the symbols


into alphabetical order for the symbol table and cross-
reference listing. The symbols are listed in random order.

Warning 2: Parameter <name> not used in macro <name>

The formal parameter given in the macro definition is not


referenced by the code in the macro body.

Warning 3: Too many parameters for macro <name>

More parameters have been supplied with the macro call


than are used by the macro.

Warning 4: STep or TRansition has no output

For a complete Graftec structure, each ST and TR should


have an output so that processing can continue.

Warning 5: SB has no Initial Step (IST)

The Initial Step is the entry point of the SB.

Warning 6: <user defined warning message>

This warning is generated by the $WARNING directive.

Warning 7: Invalid expression between @..@ in $directive

The expression between '@' characters in a $TITLE, $STITLE,


$REPORT, $ERROR, $ONERROR or $WARNING directives is not
valid. To place an @ character in the text, use @@. See
the example for $ERROR in section 6.11.

Warning 8: More than one Initial Step (IST) in SB

Each Sequential Block should contain only one Initial Step.


SASM - Page 65

10. PERFORMANCE AND LIMITATIONS


================================

10.1 Lexical and Syntax Analysis


---------------------------------

"Lexical analysis" refers to the checks made on individual words


(mnemonics etc.), "syntax analysis" refers to checks made on the
context of a word, and whether the words make correct "sentences"
(complete instructions) or "paragraphs" (code blocks).

Lexical analysis envolves determining whether a word is a mnemonic,


operand, directive, symbol, label, mc, sc, cc or other statement and
checking its validity:

* Complete range checks are done on all operand values, all illegal
operands are detected.

* Checks are made for valid medium control codes, special codes
(MOV), condition codes, Graftec mc's, priority and channel
numbers. This includes typed symbols.

Syntax analysis checks the following:

* Jumps out of current code block. This is checked ONLY IF A LABEL


IS USED. If absolute jumps are used (JR -1234) this is not checked.

* Code blocks within code blocks. COB, XOB, PB, FB and SB definitions
cannot occur within another code block.

* ISTep, STep and TRansitions can be defined only within a Sequential


Block (SB).

* Block closures. Each block must have a correct block closure


instruction in the same source module (COB..ECOB, XOB..EXOB etc).

* Jump labels cannot be EXTerNal or PUBLic (except as $ constants).

* If labels are used in arithmentic expressions, the labels must all


be defined within the SAME code block.

* Typed symbols occuring in an expression must all have the same type
(untyped symbols can be used anywhere).

* $IFxxxx statements must each have an $ENDIF, with optional $ELSE


only inside the $IF..$ENDIF block.

* Multiple definitions of the same code block (COB, XOB, PB, FB, SB,
IST, ST) or TEXT within the same source module are not allowed.
SASM - Page 66

Syntax checks continued:

* Instructions referencing FB parameters can appear only with an


FB definition.

* All FB parameters within an FB definition must be used in the


correct context. Each parameter number is given a parameter
type where it is first encountered. The instruction mnemonic
gives it its type, types are as follows:

Medium control code I|O|F|R|T|C|K|X|DB + number


Special code N|Q|B|W|L|D + number
Unsigned 16-bit value
Signed 16-bit value
3-bit value + 13-bit unsigned value

If a parameter gets one type, and is then used in a context which


has a different type, an error is generated. The linker uses the
list of parameter types for more detailed parameter list checks.

NOTE: The Function Block Parameter reference utility (SFBREF)


can be used to do 100% FB parameter checking. This program
detects all FB parameter errors in a PCD file (produced by
the linker). It also provides a parameter cross-reference
list.

All other checks (FB parameter lists, multiple use of the DEFTC
instruction, existence of at least one COB etc.) are all done by the
linker.
SASM - Page 67

10.2 Performance
-----------------

SASM is a two pass assembler. Pass 1 processes EQUates, EXTNs, labels,


macros and conditional directives so that forward references can be
used. Pass 2 does the main bulk of the assembly, creates the listing
and outputs any error messages.

A "hash table" method is used for symbol table management, this is one
of the fastest methods. With 2000 symbols in the table an average of
5 looks (usually at the first character only) is needed to find any
particular symbol. All reserved words (instruction mnemonics etc) are
also stored in this table.

The instruction set is defined in a single 'C' language source module,


containing mnemonic, PCD opcode, an Operand Control Code (OCC) for
each instruction, and an Operand Type Table containing Operand Type
Codes (OTC). The OCC indicates the required operands for the instruct-
ion, their types and their ranges. The OCC indicates a location in the
table containing the Operand Type Codes (OTT), with one OTT for each
expected operand of the instruction. The OTT indicates which function
is used to evaluate and check the operand. This file is easily updated
to add new instructions. If the format of the new instruction is the
same as that of an existing instruction or operand, an existing OCC or
OTT can be used (no new code needs to be written to handle the new
instruction).

A simple "Recursive Descent Parser" is used to evaluate expressions


and handle operator precedence. This is efficient since 'C' is a stack
oriented language.

On pass 2, the listing file is written directly to disk (or printer),


one line at a time as each line is processed, and the code and text
segments are prepared in memory. At the end of pass 2, the code, text
and symbol segments are written to the object file. In this way there
is only one file open at any one time (excluding include files). This
improves assembly time, since file I/O is the slowest part of the
process.

No intermediate work files are used unless SASM is invoked with the
/TEMP switch, then temporary file SASMACRO.$$$ is created to hold
macro definitions.

For an 8MHz IBM AT with a hard disk, the assembly time is about 2000
lines a minute if a listing is generated, and about 5000 lines a
minute without the listing (a 20MHz 80386 machine is over 4 times
faster). The assembly times are also dependent on the source file's
content, the number of macro calls and different symbols used etc.
SASM - Page 68

10.3 Limitations
-----------------

* The maximum source file line length is 300 characters.

* The maximum number of lines in one source module is 9999 (1-9999).

* The maximum size of source file, include files and the number of
symbols is limited by the size of memory in the IBM PC. 512K is
enough to assemble a file of up to about 8000 lines. It is rare
(and not recommended) for a single source module to contain more
than about 2000 lines in total.

* The maximum number of Function Block parameters is 255.

* The maximum size of a single text is 3072 characters, including


the terminating NUL character (0).

* Arithmetics do not work with floating point constants, arithmetics


handle 32-bit signed integers only.

* Overflow of the 32-bit result of an expression is not detected,


overflow is only detected on individual constants.

* $INCLUDE files can be nested up to 9 deep.

* Macros can have up to 128 parameters.

* $IF..$ENDIF statements can be nested up to 30 deep.

* Macros can be nested up to 9 deep. A macro can contain another


macro call, which in turn can contain another macro call etc.

* The nesting depth of FB and PB calls is not checked, but can be


checked by using SFBREF.

* Data Blocks 0..3999 can hold up to 383 Register values (0..382).


Data Blocks 4000..7999 (in extension memory only) can hold up
to 16384 values (0..16383).
SASM - Page 69

11. OBJECT FILE FORMAT


=======================

General
-------

The object file consists of these sections:

+----------------------------------+
A | FILE NAME, DATE & TIME, REV CODE |
+----------------------------------+
B | HEADER |
+----------------------------------+
C | FLAGS BYTE |
+----------------------------------+
D | AUTO RECORDS | (optional, if $AUTO used)
+----------------------------------+
E | PCD TYPE SEGMENT | (optional, from $CPU,
+----------------------------------+ $STATION and $PCDVER)
F | PUBLIC SYMBOL SEGMENT |
+----------------------------------+
G | EXTERNAL SYMBOL SEGMENT |
+----------------------------------+
H | GLOBAL ELEMENT SEGMENT |
+----------------------------------+
I | LOCAL SYMBOL SEGMENT | (optional, see /SYM switch)
+----------------------------------+
J | CODE SEGMENT |
+----------------------------------+
K | TEXT SEGMENT |
+----------------------------------+

Sections F, G, H, J and K each have an entry in the Header, which


indicates the offset into the file to the start of the segment, and
its length.

Sections D, E and I are optional. Their presence can be determined


from the FLAGS byte value, see below. They do not have entries in the
header, so that files containing these records can still be linked
using an old version of the linker which will ignore these records.

All 2-byte (word) and 4-byte (long) integers are stored in Intel
format, the least significant byte first. All values are unsigned
unless indicated as signed.

All symbol names are stored as variable length, NUL terminated,


upper case ASCII strings, with up to 10 significant characters and
one NUL byte terminator. (This will be increased to any length in
the near future.)
SASM - Page 70

Each section in the object file (except A) has a 2-byte (word)


integer checksum at the end, this is computed as follows:

Initialize 2-byte unsigned short integer checksum to 0000.


For each byte of the segment:
Exclusive-OR the data byte with least significant byte of
the evolving checksum.
Rotate checksum left through the most significant bit.

The result is the checksum.

File Name
---------

Name of file assembled, including extension (default .ASM). Variable


length NUL terminated ASCII string. Does not include drive or path
name, eg:

"SOURCE.SRC"

Date and time of assembly


-------------------------

NUL terminated ASCII string of variable length. It is formatted


according to the country:

" 5/04/87 15:34 " or " 12-31-87 3:34p"

Assembler revision code


-----------------------

One byte which can be used to indicate the version of the assembler
which created the file. The linker can use this for assembler/linker
compatibility checks.
SASM - Page 71

Header
------

The header is exactly 42 bytes long.

Contains offsets to, and the lengths of each segment in the file.
Each is stored as a 4-byte integer. The offset is the byte offset
into the file (can be used by function "fseek()"), the length is
the total length in bytes of the segment, including the 2-byte
checksum.

If any segment is empty, the offset points to the empty segment


(which is either the next used segment or the end of the file) and
the length is 0.

LSB MSB
+--------+--------+---------+--------+
Byte: 0 | OFFSET TO PUBLIC SYMBOL SEGMENT |
+--------+--------+---------+--------+
4 | LENGTH OF PUBLIC SYMBOL SEGMENT |
+--------+--------+---------+--------+
8 | OFFSET TO EXTERNAL SYMBOL SEGMENT |
+--------+--------+---------+--------+
12 | LENGTH OF EXTERNAL SYMBOL SEGMENT |
+--------+--------+---------+--------+
16 | OFFSET TO GLOBAL ELEMENT SEGMENT |
+--------+--------+---------+--------+
20 | LENGTH OF GLOBAL ELEMENT SEGMENT |
+--------+--------+---------+--------+
24 | OFFSET TO CODE SEGMENT |
+--------+--------+---------+--------+
28 | LENGTH OF CODE SEGMENT |
+--------+--------+---------+--------+
32 | OFFSET TO TEXT SEGMENT |
+--------+--------+---------+--------+
36 | LENGTH OF TEXT SEGMENT |
+--------+--------+---------+--------+
40 | CHECKSUM |
+--------+--------+

*** NOTES ***

If a segment is not present, the LENGTH will be 0, but the OFFSET


will be valid (pointing to the next used segment).

The AUTO RECORDS segment and LOCAL SYMBOL SEGMENT do not have entries
in the header. This is so that files containing these records can
still be linked with the old version of the linker, but the features
provided by the new segments will not be available.

The start of the AUTO RECORDS segment is immediately after the FLAGS
byte, and it is fixed length.

The start of the LOCAL SYMBOL SEGMENT is determined from the GLOBAL
ELEMENT SEGMENT entry (start+length), and the size in bytes is
found by subtracting the OFFSET TO CODE SEGMENT from this value.
SASM - Page 72

Flags byte
----------

This byte indicates the presence of optional segments in the


object file:

Bit 0: 1 = Module contains $INIT sections, see 6.9.


Bit 1: 1 = AUTO RECORDS segment present ($AUTO has been used)
Bit 2: 1 = LOCAL SYMBOL SEGMENT present (see /SYM switch)
Bit 3: 1 = LOCAL SYMBOL SEGMENT is not sorted
Bit 4: 1 = PCD TYPE SEGMENT is present
Bit 5: Not used
Bit 6: Not used
Bit 7: Not used

Auto Records Segment


--------------------

This segment is only present if an $AUTO directive has been used


in the source module, see section 6.15. Its presence is indicated
by Bit 1 of the FLAGS byte. It contains the start addresses and
counts for all media which were auto-allocated.

The segment is fixed length, there are 22 records of 8 bytes each


plus a 2-byte checksum (178 bytes in total). The "Type" byte holds
the data type value, which is also the record number (record offset).
The type number can be used a direct offset into the segment for
speed of access, hence the unused records in the segment (these are
for types which cannot be auto-allocated).

The "Usage" byte is unused at present, and is always 0.

The "Start" value is from the type's $AUTO directive. The "Count"
value is the number of elements that were auto-allocated by the
program. If there was no $AUTO directive for the media type then the
"Start" address is 0xFFFF and "Count" is 0. If there was an auto
directive but no addresses were auto-allocated, the "Start" value
will be filled in, but the "Count" value will be 0.
SASM - Page 73

Auto Records Segment Format:

Type Usage Start End Count


Rec Offset BYTE BYTE WORD WORD WORD
+-----+-----+-------+-------+-------+
0 0 | 00h | 00h | 0000h | 0000h | 0000h |
1 8 | 00h | 00h | 0000h | 0000h | 0000h |
2 16 | 00h | 00h | 0000h | 0000h | 0000h |
3 24 | 03h | 00h | xxxx | xxxx | xxxx | Flags
4 32 | 00h | 00h | 0000h | 0000h | 0000h |
5 40 | 05h | 00h | xxxx | xxxx | xxxx | Registers
6 48 | 00h | 00h | 0000h | 0000h | 0000h |
7 56 | 07h | 00h | xxxx | xxxx | xxxx | Function Blocks
8 64 | 08h | 00h | xxxx | xxxx | xxxx | Program Blocks
9 72 | 09h | 00h | xxxx | xxxx | xxxx | COBs
10 80 | 00h | 00h | 0000h | 0000h | 0000h |
11 88 | 0Bh | 00h | xxxx | xxxx | xxxx | Sequential Blocks
12 96 | 0Ch | 00h | xxxx | xxxx | xxxx | Steps
13 104 | 0Dh | 00h | xxxx | xxxx | xxxx | Transitions
14 112 | 0Eh | 00h | xxxx | xxxx | xxxx | Texts
15 120 | 0Fh | 00h | xxxx | xxxx | xxxx | Semaphores
16 128 | 00h | 00h | 0000h | 0000h | 0000h |
17 136 | 11h | 00h | xxxx | xxxx | xxxx | Data Blocks
18 144 | 12h | 00h | xxxx | xxxx | xxxx | Timers
19 152 | 13h | 00h | xxxx | xxxx | xxxx | Counters
20 160 | 00h | 00h | 0000h | 0000h | 0000h |
21 168 | 00h | 00h | 0000h | 0000h | 0000h |
+-----+-----+-------+-------+-------+
176 | Checksum | 2 bytes
+-----------+
SASM - Page 74

PCD TYPE segment


----------------

This contains the destination CPU and S-BUS station number defined
by the $CPU and $STATION directives, and a list of PCD types and
firmware versions from the $PCDVER directives.

+----------------+
00 | CPU NUMBER |
+----------------+
01 | STATION NUMBER |
+----------------+
02 | NO OF RECORDS |
+----------------+------------------+------------------+
03 | PCD TYPE | OFFICIAL VERSION | INTERNAL VERSION |
+----------------+------------------+------------------+
= =
+----------------+------------------+------------------+
| PCD TYPE | OFFICIAL VERSION | INTERNAL VERSION |
+----------------+------------------+------------------+
| CHECKSUM |
+----------------+

CPU NUMBER 1 byte. Destination CPU number from the


$CPU directive, -1 if not defined.

STATION NUMBER 1 byte. Destination S-BUS station number


from the $STATION directive, -1 if not
defined.

NO OF RECORDS 1 byte. The number of PCD firmware version


records which follow.

PCD firmware version records, created by $PCDVER directives:

PCD TYPE 8 bytes, e.g. "D1M1xx" or "D6M54x".


OFFICIAL VERSION 4 bytes, e.g. "004", "001".
INTERNAL VERSION 4 bytes, e.g. "3A", "4B".

The last 2 bytes are the checksum.


SASM - Page 75

Public symbol segment


---------------------

Contains an entry for each symbol declared PUBLic in the source module,
the last two bytes of the segment are the checksum. Each entry has the
the form:

+-----//------+----+------+-------+---+---+---+---+
| SYMBOL NAME | 00 | TYPE | FLAGS | VALUE |
+-----//------+----+------+-------+---+---+---+---+

Where:

SYMBOL NAME The ASCII symbol name, a NUL terminated variable


length string.

TYPE One byte. The medium type of the symbol, obtained


from type prefix in EQUate statement:

00h = Untyped constant (no prefix)


01h = Reserved (used by assembler for
labels which cannot be Public)
02h = Input or Output (I|O)
03h = Flag (F)
04h = Timer or Counter (T|C)
05h = Register (R)
06h = Constant (K)
07h = Function Block (FB)
08h = Program Block (PB)
09h = Cyclic Organization Block (COB)
0Ah = Exception Organization Block (XOB)
0Bh = Sequential Block (SB)
0Ch = Step or Initial Step (ST)
0Dh = Transition (TR)
0Eh = Text (TEXT)
0Fh = Semaphore (SEMA)
10h = FB parameter number (=)
11h = Data Block (DB)

FLAGS One byte. Bits 3..0 indicate the units of the


symbol:
0 = Decimal
1 = Binary
2 = ASCII
4 = Floating point (Motorola FFP)
8 = Hex

Bit 7=1 if the symbol is an offset from the


start of code (0), and requires the module's
start of code address to be added. e.g.
PUBL SYMBOL, SYMBOL EQU $$.

Bit 6=1 if the symbol is auto-allocated, and


the auto-allocation offset must be added by
the linker.

VALUE 4 bytes. Absolute 32-bit value of the symbol.


SASM - Page 76

External symbol segment


-----------------------

Contains an entry for each symbol declared to be EXTerNal. Only the


external symbol names are stored as variable length NUL terminated
ASCII strings. The last two bytes of the segment are the checksum.

+-----//------+----+
| SYMBOL NAME | 00 |
+-----//------+----+

Global element segment


----------------------

Each COB, XOB, PB, FB, SB, IST, ST, TR, TEXT and DB definition and
reference has an entry in this segment. These elements are all
implicitly global, only one definition is allowed, and when linked
each reference must match a definition. The last two bytes of the
segment are the checksum.

|<---------- OPTIONAL ---------->|


+----------+--+--+--+--+-----+-----+---+--//--+---+
| TYPE AND | ELEMENT | EXTERNAL | FB PARAMETER |
| FLAGS | NUMBER | REFERENCE | LIST |
+----------+--+--+--+--+-----+-----+---+--//--+---+

Where:

TYPE AND FLAGS One byte indicating the element's type


and scope as follows:

Bit 7 1 = Definition (e.g. FB 0)


0 = Reference (e.g. CFB 0)
Bit 6 1 = Element number contains an
external component
0 = Element number is absolute
Bits 5-0 Element type:
07h = FB
08h = PB
09h = COB
0Ah = XOB
0Bh = SB
0Ch = ST or IST
0Dh = TR
0Eh = TEXT
11h = DB (Data Block)

ELEMENT NUMBER A 2 or 4-byte signed integer, the element's


number. If FLAG bit 6 is 0 this is the
absolute value (2 bytes), if 1, this is a
partial value (4 bytes).
SASM - Page 77

Global element segment continued


--------------------------------

EXTERNAL REFERENCE Appears only if FLAG bit 6 is 1, this 2-byte


integer is the number of the external symbol
in the EXTERNAL SYMBOL SEGMENT (1-32767).

FB PARAMETER LIST This list of bytes appears only if the


element type is an FB definition (when FLAG
bit 7 is 1, and TYPE bits 5-0 are 7).
The first byte in the list is the number of
function block parameters, this indicates
the number of following bytes (may be 0 if
there are no parameters). Each following
byte is a Parameter Type Code (PTC), which
indicates the parameters type, the linker
uses these for FB parameter list checking.
The first byte after the length describes
parameter 1, the second describes parameter
2 etc. PTC's are as follows:

00h = Parameter not referenced in the FB


definition
01h = mc I|O|F|T|C|R|K|X|DB + number
02h = sc Q|D|N|B|W|L + number
03h = Unsigned 16-bit integer
04h = Signed 16-bit integer
05h = 3-bit integer + 13-bit integer
SASM - Page 78

Local symbol segment


--------------------

This segment is only present if FLAGs byte bit 2 = 1. It contains


an entry for each EQUated symbol which is not declared as PUBLic.
The list is usually sorted, the symbols are in alphabetical order
unless there was not enough memory to sort the table, if FLAGS byte
bit 3 is 1 then it's not sorted. This segment is used only for
symbolic debugging, and is created by using the "/SYM" switch. The
last 2 bytes of the segment are the checksum. Each entry has the
form:
+-----//------+----+------+-------+---+---+---+---+
| SYMBOL NAME | 00 | TYPE | FLAGS | VALUE |
+-----//------+----+------+-------+---+---+---+---+

Where:

SYMBOL NAME The ASCII symbol name, a NUL terminated variable


length string.

TYPE One byte. The medium type of the symbol, obtained


from type prefix in EQUate statement:
00h = Untyped constant (no prefix)
01h = Reserved (used by assembler for
labels which cannot be Public)
02h = Input or Output (I|O)
03h = Flag (F)
04h = Timer or Counter (T|C)
05h = Register (R)
06h = Constant (K)
07h = Function Block (FB)
08h = Program Block (PB)
09h = Cyclic Organization Block (COB)
0Ah = Exception Organization Block (XOB)
0Bh = Sequential Block (SB)
0Ch = Step or Initial Step (ST)
0Dh = Transition (TR)
0Eh = Text (TEXT)
0Fh = Semaphore (SEMA)
10h = FB parameter number (=)
11h = Data Block (DB)

FLAGS One byte.


Bit 7: 1 = Auto allocated
Bit 6: 1 = __CSTART__ offset must be added
Bit 5: unused
Bit 4: unused
Bits 3..0 indicate the units of the symbol:
0 = Decimal
1 = Binary
2 = ASCII
4 = Floating point (Motorola FFP)
8 = Hex

VALUE 4 bytes. Absolute 32-bit value of the symbol.


SASM - Page 79

Code segment
------------

Contains a variable length entry for each code line, the last 2 bytes
of the segment are the checksum.

|<-------- OPTIONAL --------->|


+--------+--------+--+--+--+--+-----------+-----+-----+
| FLAGS+OPCODE+MC | OPERAND | OPERAND | EXTERNAL |
| | | TYPE CODE | REFERENCE |
+--------+--------+--+--+--+--+-----------+-----+-----+

Where:

FLAGS+OPCODE+MC 2-byte integer:

Bit 15 1 = Operand is 32-bit


0 = Operand is 16-bit
Bit 14 1 = No mc or mc not resolved
0 = mc resolved
Bit 13 1 = Operand has external component
0 = Operand is absolute
Bits 12-4 9-bit opcode
Bits 3-0 mc/sc/cc/mgc etc. used only
if Bit 14 is 1.

OPERAND Either a 2-byte unsigned or a 4-byte


signed integer.
If FLAG bit 15 or bit 13 is 1, this is a
4-byte (32-bit) signed integer, otherwise
it is a 2-byte (16-bit) operand.
If FLAG bit 13 is 1 (has an external part),
this is a partial value.
If FLAG bit 13 is 0, this is the absolute
operand value.

OPERAND TYPE CODE This 1-byte value indicates precisely the


(OTC) and range allowed for the operand. It is
present only if FLAG bit 13 is 1, and is
used by the linker to check operands when
their external references are resolved.
See module "aiset.c" for details.

EXTERNAL REFERENCE Appears only if FLAG bit 13 is 1, this


2-byte integer is the number of the external
symbol in the EXTERNAL SYMBOL SEGMENT
(1-32767).
SASM - Page 80

Text and extension memory segment


---------------------------------

Each text or data block is a record with this format:

OPTIONAL
|<------->|
+------+------+---+---+---+---+---+---+----+----+---+---+-//-+
| TYPE |FLAGS | NUMBER |LENGTH |EXTERNAL | DATA... |
| | | | |REFERENCE| |
+------+------+---+---+---+---+---+---+----+----+---+---+-//-+

Where:

TYPE 8=Text, 32=Data Block. This is actually the size of


each element in bits: 8=byte=text character, 32=long
word=data block element.

FLAGS Bit 7 1=NUMBER is external, 0=absolute


Bit 6 1=SASI text (in $SASI section)
Bit 5 1=LAN text (in $LAN section)
Bit 4 1=Don't put data in extension memory
initialization segment (in $NOXINIT
section)
Bit 3..0 Reserved

NUMBER The 2-byte text or data block number, partial if


EXTERNAL REFERENCE is non-zero, else absolute.

LENGTH No. of elements, in terms of TYPE (bytes/long words),


always absolute. LENGTH may be greater than the number
of initializers.

EXTERNAL Optional 2-byte integer, present only if FLAGS Bit 7=1.


REFERENCE This is the number of the external symbol in the
External Symbol Segment (1-32767).

DATA... Initializer data list. Different formats according


to the TYPE. The number of initializers may be less
than the LENGTH, in which case the remaining elements
are assumed to be initialized to their default value
(spaces for texts, zeros for data blocks).

See next page for DATA formats.


SASM - Page 81

DATA format, TYPE=8=Text


------------------------

Contains text characters. A NUL (00) character intoduces a second


character with special significance:

00 xx special character pair

00 00 end of text
00 01 insert a 00, e.g. 00 00 is stored as 00 01 00 01
00 02 introduces formatted external

Formatted external:

00 02 2-byte intro
dword value partial value (never floating point)
word extref external reference
string format "C" format string:
"%c" Single character: 0..255 or
1..255 for texts 0..3999
"t%[-0n.n]lu" Needs prefix from external
(t=lower case, T=upper)
"%[-0n.n]lu" No prefix
"R%[-0n.n]lu" External had a type (e.g. R or
r) which is already resolved,
SLINK checks that the external
has a compatible type

([-0n.n] is the optional width/left justify and leading zeros)

These special character pairs are in the OBJ file only, not in
the PCD's memory.

DATA format, TYPE=32, Data Blocks


---------------------------------

byte info Bit 7 1=external, 0=absolute


FFH = end of initializers
dword value Absolute or partial value
[word extref] Optional external reference (if info bit 7=1)

*** END SASM.DOC ***


***********************************************************************
* *
* SLINK - SAIA PCD LINKER *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME SLINK.DOC *
* AUTHOR Matt Harvey, SAIA AG *
* *
***********************************************************************

REVISION HISTORY
06-Jan-98 V2.1

06-Aug-96 Added feature flag 0xx1xxxx for comments in symbol table


and public symbol segment.

21-Jun-96 V2.0

20-Jun-96 B2.0e
- $INIT LENGTH now in .MAP file.

15-Mar-96 $19G
- SWMR 817: MAP file now has $INIT segment start line for each
module.
- SWMR 591: I and O can now be separate types (was just single
I|O type). New symbol types in .OBJ file 14h and 15h, see
section 7.5 Public symbol segment.
- SWMR 680 and 815: New "PCD TYPE SEGMENT" in .PCD file, see
section 7.6.

30-Oct-95 $199
- AUTO statement for code blocks is now optional. If there's
no AUTO block for the statement, a default one covering the
entire range is used. If any blocks are defined with direct
addressing, these addresses are reserved and are not used
for auto-allocation.

30-Aug-95 $197
- Added collision detection for auto-allocation. Data defined
with an absolute value which falls within an AUTO segment
generates this error:
Error 69: Auto-allocation collision: <type> <adds>
- Auto-allocation now works for STs and TRs.

04-Aug-95 $194
- Added /SYM switch to append the symbol table to the end of
the .PCD file, see sections 2 and 7.5
- Added "Warning 4: Module <filename> has no local symbol table".
28-Jul-95 $193
- Added automatic resource allocation, via SASM's new AUTO
statement.
- Added error messages:
Error 67: Different AUTO declarations in file: <filename>
Error 68: Auto allocation overflow for type: <type>

04-Jul-95 $192
- Added DEFTR and SYSCMP instructions.
- Added "Error 66: DEFTR and DEFTB in same program".

24-Apr-95 V1.9

08-Jun-94 $185d
1) Handles new TFRI/STXMI/SRXMI instructions.
2) Add "Error 65: Register indirect, not a register".
3) STXM/SRXM now transfer the DB data (accept DB type).
4) STXM supports XOB execution format.

29-Apr-94 $184
1) Add "Fatal Error 10: Program too big for n/n Starter Package.
(old Error 10: Out of symbol space is now Error 0: Out of
memory).
2) Increased the max. number of object files which can be linked
to 75 (was 50).

$174
1) Add "Error 64: Operand must be zero".

28-Jul-93 $173
1) Add CASI, CRD and CWR instructions. Add "Error 63: Invalid
counter channel".
2) Handles new $NOXINIT and $ENDNOXINIT directives, setting
$NOXINIT flag (bit 5) in extension memory FLAGS byte.

09-Jun-93 V1.7
1) Handles code inside the $INIT..$ENDINIT directives and
places it in XOB 16 (4.1). $INIT segments are delimited in
the OBJect files by dummy instructions with an opcode of 0.
2) Supports "extension memory" (was called data memory), and
the new TFR instruction.
3) Supports new CPBI instruction.
4) $SASI text processing updated for new S-BUS definitions.
5) Evaluates symbol values containing the "$$" constant (offset
from start of code) (4.2).
6) On completion, SLINK now outputs the number of warnings as
well as the number of errors.

20-May-92
1) Add new indirect LAN text format.
2) Small change to format of data segment record.
06-Dec-91 $154
1) Handles new object file text/data segment format, and
resolves externals in texts and data blocks (SWMR 117).
(Still reads old OBJ file text segment).
2) Creates PCD file with new "data segment", for new
extension data memory. Data size now shown in MAP file.
3) Spare byte in PCD file header now used as "feature indicator
byte".
4) Better checks for SRXM and STXM instructions (SWMR 226).
5) Added errors 23 to 26.

22-Aug-91 $152
1) New /F /NF switches: Now invokes SFBREF.EXE to check FB
parameter references.
2) Added "Fatal Error 19: Can't execute SFBREF.EXE".
3) Add section 8 on SFBREF.EXE.

04-Oct-90 $139
1) Now handles TEXT, X and DB types.
2) Added "Error 62: Invalid data block number".

09-May-90 $133
1) If wildcard characters are used to describe object files to be
linked, the matching object file names are sorted. This ensures
that the files are always linked in the same order, regardless
of their position in the disk directory.

02-Mar-90 $131/$132
1) Now supports new data types COB, XOB, TEXT etc. Changed
Error messages 37 and 38 to read "data type" instead of
"medium type".
2) Add fatal error 18. Change fatal error message 1.

22-Nov-89 V1.3
1) Allow K constants as externals for LD, LDH, LDL (SWMR 17).
2) Give warning instead of error if FB parameters are not used
(SWMR 19).
3) Allows international character set in labels and symbols
(SWMR 32).
4) Now allows 10 character symbol names (SWMR 71).
5) Gives help if invoked with an incorrect command line from DOS.
6) Displays code and text sizes, and number of global symbols
after the link.
7) New switches /SV and /SN, global symbols in the MAP file can
now be sorted by value and type (/SV) or by name (/SN).
8) Now displays symbol values in the correct units (was always
decimal even for floating point values).
9) Allows "wildcard" filenames in object file list
eg. SLINK PCDFILE = *.OBJ (space after = needed)
SLINK PCDFILE = FRED.OBJ TOT?.OBJ

25-Nov-88 V1.1 & V1.2


1) Shows amount of free memory remaining after linkage.
2) Modification Indicator Byte added to header in PCD
memory (7.0).

30-May-88 V1.0

19-mar-87 Preliminary.
SLINK - Page 1

CONTENTS
========
PAGE
1. OVERVIEW . . . . . . . . . . . . . . 2

2. INVOCATION FROM DOS . . . . . . . . . . 3


2.1 Method 1 - Command Line . . . . . . . 3
2.2 Method 2 - Indirect Command File . . . . 5
2.3 Return Values . . . . . . . . . . . 5

3. ERROR HANDLING . . . . . . . . . . . . 6
3.1 Fatal Errors . . . . . . . . . . . 6
3.2 Warnings . . . . . . . . . . . . 10
3.3 Operand Errors . . . . . . . . . . 10
3.4 Multi-defined Publics . . . . . . . . 14
3.5 Unresolved Externals . . . . . . . . 14
3.6 Multi-defined Instructions . . . . . . 14
3.7 Multi-defined Elements . . . . . . . . 15
3.8 Undefined Elements . . . . . . . . . 15
3.9 Error Examples . . . . . . . . . . 16

4. PERFORMANCE . . . . . . . . . . . . . 17
4.1 $INIT segment and XOB 16 . . . . . . . 18
4.2 Processing $$ constants . . . . . . . 18

5. LIMITATIONS . . . . . . . . . . . . . 19

6. MAP FILE . . . . . . . . . . . . . . 20

7. ABSOLUTE OBJECT FILE FORMAT . . . . . . . 22


7.1 CPU header . . . . . . . . . . . 23
7.2 Code segment . . . . . . . . . . . 27
7.3 Text segment . . . . . . . . . . . 27
7.3.1 Binary LAN texts . . . . . . . . 28
7.3.2 Data blocks 0..3999 . . . . . . . 31
7.4 Extension memory segment . . . . . . . 32
7.5 Symbol table . . . . . . . . . . . 34
7.6 PCD type segment . . . . . . . . . . 40

8. FUNCTION BLOCK PARAMETER CHECKS WITH SFBREF . . 41


8.1 SFBREF Warnings . . . . . . . . . . 41
8.2 SFBREF Error Messages . . . . . . . . 41
8.3 SFBREF Limitations . . . . . . . . . 43
SLINK - Page 2

1. OVERVIEW
============

The linker processes object files (.OBJ) produced by the assembler


SASM and merges them into a single absolute object file (.PCD). An
optional map file (.MAP) can also be created.

The absolute object file produced is an executable file which can be


downloaded into the PCD.

The linker resolves all references to externally defined symbols,


and optionally checks that all Function Block parameters for each
FB call are valid.

+-------+ ********** ********** ++++++++++


+-------+| * SLINK * +-------+ * SDNLD * + PCD6 +
| .OBJ ||----->* linker *--+-->| .PCD |--->* loader *--->+ CPU +
| files |+ * * | | file | * * + +
+-------+ ********** | +-------+ ********** ++++++++++
| |
********** |
* SFBREF * |
* checks * | +-------+
*FB param* +-->| .MAP |
********** | | file |
| +-------+
|
|
| +++++++++++
+-->+ .MAP to +
+ printer +
+++++++++++
SLINK - Page 3

2. INVOCATION FROM DOS


=======================

The linker has two methods of invocation directly from DOS. The
linker can also be invoked from the PCD menus.

The link can be aborted by pressing Ctrl+C or Ctrl+Break. When aborted,


"Aborted" is displayed, all files are closed and the printer (if used)
is de-initialised.

2.1 Method 1 - Command Line


----------------------------

SLINK [pcd_file = ] obj_file [ + obj_file ...] [switches]

Where:
pcd_file = Is the optional absolute object file name for the
linked modules. The default is the name of the
first object file, the default file type is ".PCD".
If a pcd_file name is specified, the "=" symbol
MUST be present as a delimiter between the pcd_file
and the obj_file(s), otherwise this file name is
assumed to be an object file. One or more spaces
on one or either side of the "=" are allowed but
not necessary.

obj_file [ + obj_file...]
Is a list of one or more object files to be linked,
separated by "+", spaces, tabs or commas ",". The
default file type of these files is ".OBJ". All
file names can pe preceded by an optional drive
letter or path name, eg. A:\FRED\SOURCE. The DOS
wildcard characters "*" and "?" can be used to
specify a set of modules to be linked, eg. M1*,
MODULE? (these are linked in alphabetical order).

[switches] /M /NM Map or NoMap. Generate a map file


or no map file.
/P /NP Print or NoPrint. Send map to printer
or create a .MAP file. Ignored if /NM.
/F /NF FB parameter checks, or no FB parameter
checks, invokes SFBREF.EXE.
/SN Sort global symbols in the .MAP file
by symbol name (the default).
/SV Sort global symbols in the .MAP file
by type and value.
/SYM Append symbol table to .PCD file.

The default switches are /M/NP/NF/SN. Switches can


be upper or lower case, not necessarily separated
by spaces. The either the '/' or '-' characters
can be used as switch delimiters.

The maximum length of the first command line is 128 characters. The
command line can be extended onto another line by the use of a "+"
sign at the end of the line. In this case, a double prompt ">>" is
displayed on the next line, and further command lines can be entered.
While entering further command lines, the "Del" and "<-" (backspace)
keys can be used to edit the current line.
SLINK - Page 4

Method 1 - Command line continued


---------------------------------

If an invalid command line is entered, SLINK displays a help text.

The following examples show the command lines, and the texts displayed
by the linker. The linker displays a list of the files being linked
"Linking: ....", and the files being created "To: ....".

Once the linkage is complete, the ammount of memory remaining is


displayed "Free memory: xxxx". The ammount of available memory in
the IBM PC determines the maximum size of the PCD program which can
be linked. If this figure is low, increasing the size of the program
may result in an "Out of memory" error (see section 3.1).

Method 1 invocation examples:

C:\>SLINK MOTOR=MODULE1+MODULE2+MODULE3+MODULE4+MODULE5+MODULE6 +
>>MODULE7+MODULE8,MODULE9,MODULE10,MODULE11,MODULE12 +
>>/nf

SAIA PCD LINKER V1.7


Linking: MODULE1+MODULE2+MODULE3+MODULE4+MODULE5+MODULE6+MODULE7+
MODULE8+MODULE9+MODULE10+MODULE11+MODULE12
To: MOTOR.PCD MOTOR.MAP

Free memory: 164074


Code size: 18236 lines (72944 bytes)
Text/DB size: 4997 bytes
Exten mem size: 0 bytes
Global symbols: 195

Linkage complete, 0 warnings, 0 errors.

C:\>_

C:\>SLINK MOTOR=+
>>MODULE1 MODULE2 MODULE3 MODULE4 MODULE5 MODULE6 MODULE7 +
>>MODULE8 MODULE9 MODULE10 MODULE11/NF

SAIA PCD LINKER V1.7


Linking: MODULE1+MODULE2+MODULE3+MODULE4+MODULE5+MODULE6+MODULE7+
MODULE8+MODULE9+MODULE10+MODULE11
To: MOTOR.PCD MOTOR.MAP

Free memory: 164074


Code size: 18236 lines (72944 bytes)
Text/DB size: 4997 bytes
Exten mem size: 0 bytes
Global symbols: 195

Linkage complete, 0 warnings, 0 errors.

C:\>_

Putting a "+" immediately after the SLINK is illegal: C:\>SLINK+


In this case a space is needed: C:\>SLINK +
SLINK - Page 5

2.2 Method 2 - Indirect Command File


-------------------------------------

SLINK @input_file [switches]

@ This symbol must be placed before the input_file


name so that the linker knows to read it's command
line(s) from the file.

input_file Name of file containing command lines and switches


in exactly the same format as the command line
format described above. There is NO default file
type.

Method 2 invocation example:

Linker input file PROJECT1 is:

MOTOR = MODULE1 MODULE2 MODULE3 MODULE4 MODULE5 MODULE6 MODULE7 +


MODULE8 MODULE9 MODULE10 MODULE11 MODULE12 /m

C:\>SLINK @PROJECT1 /NF

SAIA PCD LINKER V1.7


Linking: MODULE1+MODULE2+MODULE3+MODULE4+MODULE5+MODULE6+MODULE7+
MODULE8+MODULE9+MODULE10+MODULE11+MODULE12
To: MOTOR.PCD MOTOR.MAP

Free memory: 164074


Code size: 18236 lines (72944 bytes)
Text/DB size: 4997 bytes
Exten mem size: 0 bytes
Global symbols: 195

Linkage complete, 0 warnings, 0 errors.

C:\>_

2.3 Return Values


------------------

SLINK returns a value on exit. This value can be used by a parent


process or by a batch file which invoked SLINK (using the ERRORLEVEL
condition parameter).

0 Linkage completed, no errors.

1 Linkage completed but there were link-time errors (see


sections 3.3-3.9), no output files have been produced.

2 A fatal error occurred (see section 3.1), linkage not


completed.

3 Linkage aborted with Ctrl+C or Ctrl+Break, the state of


the PCD file is undefined.
SLINK - Page 6

3. ERROR HANDLING
==================

Errors are separated into the categories below, and, except for fatal
errors and warnings, are displayed in groups under the separate titles,
see sections 3.3 to 3.8.

Fatal errors, warnings and operand errors are each displayed when they
are discovered. Undefined, unresolved and multi-defined errors are
stored until all the object and library files have been processed, and
are displayed before the "Linkage complete" sign-off message.

Warings and errors from the detailed FB parameter checking done by


SFBREF are described in section 8.

3.1 Fatal Errors


-----------------

If SLINK is invoked from DOS, disk read and write errors will be
preceded by the standard DOS disk error prompt, for example:

Not ready error reading drive A


Abort, Retry, Ignore ? _

Pressing 'A' causes a return to DOS, closing any output files,


perhaps leaving a partly written output file on the disk. Pressing
'R' will retry the disk operation, allowing recovery. Pressing 'I'
causes a return to the linker program, which will display its error
message, close and delete the output file and exit to DOS.

If SLINK is invoked from the menu, DOS disk error handling is


disabled (by the menu program). In this case, the fatal error message
is displayed directly, and control is return to the menu.

If a fatal error occurs during the link (after the command line has
been processed), the absolute object file is deleted from the disk.
If the fatal error is due to an invalid command line or command file,
the absolute object file is not deleted. The map file is unaffected.
SLINK - Page 7

Fatal errors continued


----------------------

There are three types of fatal error. Type (1) is the usual fatal
error, type (2) indicates a software malfunction, type (3) indicates
an invalid object file (which may be caused by an internal assembler
problem).

(1) Fatal Error <n>: <description>

(2) Fatal Internal Error: <file> Psn: <offset> (<rel>) Ref: <reference>

(3) Object File Error: <file>: Psn <offset> (<rel>): <reference>

Where:

<n> Is the fatal error number, see fatal error


messages below.
<description> Describes the fatal error, see fatal error
messages below.
<file> Is the name of the object or library file being
processed when the fatal error was detected.
<offset> Is the offset into the file where the fatal
error was detected. This will usually point
to the next position AFTER the error.
<rel> Relative address into code segment where the
error was detected. This matches the relative
line numbers in the listing file. It is not
relevant (0) unless the code segment is being
processed.
<reference> For object file errors, this is a brief
description of the problem. For internal errors
this indicates the source module and position.
These texts are not listed in this document,
for further information see the linker source
code.

**** NOTE ****

If ANY type (2) or (3) fatal error occurs, notify Matt Harvey, SAIA,
MURTEN immediately, supplying the source and object files and the
revision numbers of the assembler and linker.

Fatal Error Messages:


---------------------

Fatal Error 0: Missing file names

An object file name is missing in the command line.

Fatal Error 1: Too many file names

Up to a maximum of 75 object files can be linked.


SLINK - Page 8

Fatal error messages continued


------------------------------

Fatal Error 2: Invalid switch "<switch>"

The indicated switch is invalid.

Fatal Error 3: Invalid file name: <filename>

The indicated file name is not a valid DOS file


name.

Fatal Error 4: File specified more than once: <filename>

The input file name is the same as the output file


name, or the same object or library file has been
specified more than once.

Fatal Error 5: Unexpected "="

Only one "=" can appear on the command line or in the


command file.

Fatal Error 6: Can't open file: <filename>

The specified file cannot be found, or cannot be


created.

Fatal Error 7: Read error on file: <filename>

The specified file cannot be read.

Fatal Error 8: Write error on file: <filename>

The specified file cannot be written. The disk may be


full, not ready, or an existing file with the same
name may be read-only.

Fatal Error 9: Out of memory

The personal computer does not contain enough memory


to complete the linkage. Remove any memory-resident
programs (such as Norton commander or a RAM Disk),
and re-try the link. Under normal conditions, 512K of
memory should be enough to link a 64K line program,
containing up to 20,000 symbols.

Fatal Error 10: Program too big for n/n Starter Package

The "Starter Package" has a restricted PCD memory


size and does not allow use of extension memory
(TEXTs/DBs 4000..7999). This error occurs if the code
or text in the module is too large, or extension
memory has been used. "n/n" shows the max. code size
in lines/text size in bytes, e.g. 128/64 = max. 128
code lines + max. 64 text characters.

Fatal Error 11: Invalid command file: <filename>

The specified file is not a command file, or the file


contains invalid characters (not ASCII).
SLINK - Page 9

Fatal error messages continued


------------------------------

Fatal Error 12: Invalid object file: <filename>


Fatal Error 13: Unexpected end of file: <filename>

The object file is not an object file produced by


the assembler SASM.

Fatal Error 14: More than 100 errors

Linkage is aborted if there are more than 100 errors.

Fatal Error 15: Printer not ready

The printer is powered off, not connected or off-line.

Fatal Error 16: PCDSETUP.DAT not found or invalid

The configuration data file PCDSETUP.DAT can't be found


or is invalid for this version of SLINK. It should be
present in the PCD utilities or current directory.

Fatal Error 17: Bad object file version

The object file was created using an old version of the


assembler and is not compatible with this version of
SLINK. Re-assemble the source file.

Fatal Error 18: No files matching: <wildcard filename>

An object file name containing the "*" or "?" characters


does not match any files in the currect directory.

Fatal Error 19: Can't execute SFBREF.EXE

Program SFBREF.EXE is invoked to check all the FB


parameters are valid. This error occurs if SFBREF.EXE
can't be found (is not in the PCD directory).
SLINK - Page 10

3.2 Warnings
-------------

Warning 1: <file> (<line>): Parameter not referenced: CFB <n>: Param


<n>

This occurs when a Function Block parameter, supplied


in a "Call Function Block" parameter list, is not used
by the Function Block. The object file, offset into
the file, FB number and parameter number are indicated.

Warning 2: Can't sort symbol table

There is not enough memory available to sort the global


symbols into alphabetical order. The symbols are listed
in the map unsorted.

Warning 3: <file> (<offset>): Unexpected FB parameter: CFB <n>

The Function Block call provides more parameters than the


FB actually needs.

Warning 4: Module <filename> has no local symbol table

The /SYM switch was used to create a symbol table at the


end of the .PCD file, and this module was not assembled
using the /SYM switch, so it has no local symbols in the
OBJect file. Local symbols for this module will not be
in the .PCD file.

3.3 Operand Errors


-------------------

When an external reference is resolved using the associated public


symbol, the range of the value produced and its type are checked.
If the value is out of range or the data types are not compatible,
an operand error occurs.

All operand error messages have the form:

Error <n>: <file> (<offset)>: External <symbol>: <description>

Where:

<n> Is the error number, see messages below.


<file> Is the name of the object file containing the error.
<offset> Is the relative offset into the code segment of the
error. This matches the relative line numbers in
the listing file. NOTE: The number may be one or
two lines after the actual error if the operand is
dependent on the value of a preceding operand.
<symbol> Is the name of the external symbol which caused
the error.
<description> Indicates the nature of the error, see messages
below.
SLINK - Page 11

Operand errors continued


------------------------

The following operand errors can occur, for simplicity the file,
address offset and external symbol name are not shown:

Error 20: Invalid FB parameter: CFB <n>: Parameter <n>

The Function Block parameter number <n> does not match the
parameter expected by the Function Block definition.

Error 22: Missing FB parameters: CFB <n>

The Function Block call contains too few parameters.


NOTE: More detailed error messages are given when FB paraneters
are checked by SFBREF.EXE, see section 8.

Error 23: Invalid character in text <extn>

The value of an externally defined character in a text is


0 (reserved for NUL) or is greater than 255.

Error 24: Invalid SASI text


Error 25: Invalid LAN text

Texts defined inside $SASI..$ENDSASI or $LAN..$ENDLAN


directives are invalid after resolving externals and
creating the actual text.

Error 26: Text too long

Texts can contain up to 3072 characters. When a formatted


external was resolved, the text contained > 3072 characters.

Error 30: Illegal use of typed external

The external has been given a type (I, O, F etc) and can't
be used in this context.

Error 31: Invalid memory flag


Error 32: Invalid input/output number
Error 33: Invalid flag number
Error 34: Invalid timer/counter number
Error 35: Invalid register number
Error 36: Constant out of range

The operand produced when the external is resolved is out


of range.

Error 37: Invalid type

The external's type (I, O, F, COB etc) is invalid. The


external symbol cannot be used in this context.
SLINK - Page 12

Operand errors continued


------------------------

Error 38: Incompatible data types

The operand already has a type and the external's type


is not the same, or the operand types of the instruction
are not compatible (e.g. SRXM flag -> register).

Error 39: Invalid priority


Error 40: Invalid PB number
Error 41: Invalid SB number
Error 42: Invalid FB number
Error 43: Invalid COB number
Error 44: Invalid XOB number
Error 45: Invalid ST/TR number
Error 46: Invalid test number
Error 47: Invalid nibble number
Error 48: Invalid bit number
Error 49: Invalid byte number
Error 50: Invalid word number
Error 51: Invalid long word number
Error 52: Invalid digit number
Error 53: Invalid number of elements
Error 54: Invalid timebase
Error 55: Invalid semaphore
Error 56: Invalid exponent
Error 57: Invalid text number
Error 58: Invalid serial channel
Error 59: Invalid switch
Error 60: Invalid station number
Error 61: Invalid control signal
Error 62: Invalid data block number
Error 63: Invalid counter channel
Error 64: Operand must be zero

The operand produced when the external is resolved is out


of range.

Error 65: Register indirect, not a register

For indirect register addressing (TFRI/STXMI/SRXMI


instructions), the symbol must be a Register.

Error 66: DEFTR and DEFTB in same program

Only one timebase mechanism can be used in the same


program.

Error 67: Different AUTO declarations in file: <filename>

Each module linked must have *exactly* the same set of


AUTO declarations. This is normally done by $including
the same file containing the AUTO declarations in each
module.
SLINK - Page 13

Operand errors continued


------------------------

Error 68: Auto allocation overflow for type: <type>

Too many <type> items have been auto-allocated. Increase


the number of items in the type's AUTO declaration.

Error 69: Auto-allocation collision: <type> <adds>

A item has been assigned an absolute address which falls


inside the auto-allocation segment which was defined with
with an AUTO declaration.
SLINK - Page 14

3.4 Multi-defined Publics


--------------------------

These errors occur if the same public symbol (declared PUBL) occurs in
more than one object file.

Each multi-defined public error message has the form:

<symbol> in modules <module list>

Where:

<symbol> The public symbol's name.


<module list> A list of the object files which contain the
public symbol.

3.5 Unresolved Externals


-------------------------

These errors occur if an external reference (defined as EXTN) does not


have an associated public symbol definition.

Each unresolved external error message has the form:

<symbol> in modules <module list>

Where:

<symbol> The external symbol's name.


<module list> A list of object files which contain the
external reference.

3.6 Multi-defined Instructions


-------------------------------

The following instructions can appear once only in a program, multi-


defined instruction errors occur if more than one is found:

DEFTB Define timebase.


DEFTC Define timer/counter partition.
DEFVM Define volatile flag memory.
DEFTR Define timer resolution.

Each multi-defined instruction error message has the form:

<instruction> in modules <module list>

Where:

<instruction> The instruction mnemonic.


<module list> A list of object files which contain the
multi-defined instruction.
SLINK - Page 15

3.7 Multi-defined Elements


---------------------------

Each COB, XOB, PB, FB, SB, IST, ST, TR, TEXT or DB (Data Block) is
a "global element" and can be defined only once in a program. For
example, there can be only one COB 0 in a program. Multi-defined
element errors occur if there is more than one definition of the
same global element.

Each multi-defined element error message has the form:

<element> <n> in modules <module list>

Where:

<element> The mnemonic of the multi-defined element:


COB, XOB, PB, FB, SB, IST, ST, TR, TEXT or DB.
<n> The multi-defined element number.
<module list> A list of the object files which contain the
multi-defined element.

*** NOTE ***

At present, Data Blocks and Texts share the same numbering. For
example, if Data Block 10 exists, then Text 10 cannot be defined,
and vice versa. This will cause a Multi-defined Text or a multi-
defined Data Block error according to which type was processed first.

3.8 Undefined Elements


-----------------------

A single unique undefined element error exists:

No COB present

At least one Cyclic Organisation Block, usually COB 0, must be present


in the program. This error occurs if there are no COBs.

Each COB, XOB, PB, FB, SB, IST, ST, TR, TEXT or DB reference must have
an associated definition, undefined element errors occur if it doesn't.
For example, if "CFB 1" (call Function Block 1) appears in the program,
then "FB 1 ... EFB" (Function Block 1 definition) must also be
present.

Each of these undefined element error messages has the form:

<element> <n> in modules <module list>

Where:

<element> The mnemonic of the undefined element: COB, XOB,


PB, FB, SB, IST, ST, TR, TEXT or DB.
<n> The undefined element number.
<module list> A list of the object files which contain
references to the undefined element.
SLINK - Page 16

3.9 Error Examples


-------------------

This is an example of a linkage with examples of each type of non-


fatal error:

>SLINK OPA = OPA1 + OPA2 + OPA3

SAIA PCD LINKER V1.7


Linking: OPA1.OBJ+OPA2.OBJ+OPA3.OBJ
To: OPA.PCD

Operand Errors:
Error 35: OPA2.OBJ (749): External R4094: Invalid register number
Error 20: OPA2.OBJ (800): Invalid FB parameter: CFB 2: Parameter 4
Warning 2: OPA2.OBJ (811): Parameter not referenced: CFB 3: Parameter 5
Error 57: OPA3.OBJ (45): External TEXT1000: Invalid text number

Multi-defined Publics:
Q45 in modules OPA1.OBJ
Q46 in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ

Unresolved Externals:
X99 in modules OPA1.OBJ OPA2.OBJ
X8160 in modules OPA2.OBJ
U8191 in modules OPA2.OBJ
FIVE in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ

Multi-defined Instructions:
DEFVM in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ
DEFTC in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ
DEFTB in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ

Multi-defined Elements:
COB 0 in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ
COB 1 in modules OPA1.OBJ OPA2.OBJ OPA3.OBJ
TEXT 0 in modules OPA1.OBJ OPA3.OBJ
TEXT 999 in modules OPA1.OBJ OPA3.OBJ
PB 0 in modules OPA1.OBJ OPA3.OBJ
PB 299 in modules OPA1.OBJ OPA3.OBJ
COB 5 in modules OPA1.OBJ OPA3.OBJ
SB 0 in modules OPA1.OBJ OPA3.OBJ
FB 0 in modules OPA1.OBJ OPA3.OBJ

Undefined Elements:
FB 4 in modules OPA2.OBJ
PB 3 in modules OPA1.OBJ OPA2.OBJ

Free memory: 237416

Linkage complete, 0 warnings, 23 errors


SLINK - Page 17

4. PERFORMANCE
===============

Refer to SASM Assembler Functional Specification for details of the


object file format.

Each object file is accessed several times, reading a different


section of the file each time (except the external symbol segment
which is re-read each time it is required), code and text segments
are buffered in memory and written to the output file when the
buffers are filled. The $INIT (initialization) segment and the
extension memory segment are first created in temporary files
($INIT.$$$ and SLINK.$$$ respectively), which are appended to the
.PCD file at the correct position during the linkage.

Memory requirements are efficient, only the list of public symbols,


the global element list, the object file headers and the small code
and text buffers are resident in memory during the link. Since the
memory-resident object file headers contain offsets into the file
for each segment, file access is fast.

Each segment in an object file has a checksum. Checksums are verified


when each segment is read. Any error causes a fatal "invalid object
file" error.

The linkage procedure is as follows:

1) Sign on.
2) Process command line or command file, display which files are
being linked and which are being created.
3) For each object file:
Read object file header and store it.
Read public symbols and add them to master public symbol
table in memory. Detect multi-defined publics.
4) For each object file:
Read external segment and find associated public symbol
in master public symbol table, detect undefined externals.
Read global element segment and create master global
element table, resolving external references. Detect
multi-defined global elements.
5) For each object file:
Read the code segment and serach for $INIT segments.
If found, process the code and resolve any external
references and write the output to file $INIT.$$$.
6) Open absolute object file, write blank header to it.
7) For each object file:
Read external segment and find associated public symbol
in master public symbol table.
Read code segment and write it to output file, resolving
external references. Detect operand errors.
If the end of XOB 16 is found (EXOB), append the init
segment file $INIT.$$$ to XOB 16 before wrting EXOB, and
delete $INIT.$$$.
8) For each object file:
Read external segment and find associated public symbol
in master public symbol table.
Read text segment and write it to output file, resolving
external references. Detect text number operand errors.
9) If an extension memory segment was present, append the
extension memory segment file to the end of the .PCD file
and delete the temporary file.
SLINK - Page 18

Linkage procedure continued:

10) Update absolute object file header and close file.


11) Report any undefined or multi-defined symbol and element
errors.
12) If /M specified, create map file.
13) Sign off.
14) If there are no errors, and /NF (no FB parameter checks) not
given, invoke SFBREF.EXE to do more detailed FB parameter
checks.

4.1 $INIT segment and XOB 16


-----------------------------

In the OBJect files, initialization segments are delimited by dummy


instructions with an opcode of 0. Each object file is processed
to find any initialization segments, which are written to a temporary
file called $INIT.$$$, in the "TEMP" directory (or current directory
if the TEMP variable is not defined).

When XOB 16 is processed, and the EXOB instruction is reached, all


the code in file $INIT.$$$ is copied to the ".PCD" file before the
EXOB instruction is written. The $INIT.$$$ file is then deleted.
In this way XOB 16 remains in the same position as was defined by
the user program. XOB 16 should normally be the very first block,
at address 0 (it should be the first block in the first module to
be linked).

If XOB 16 does not exist, it is created and the contents of $INIT.$$$


are copied into it. If XOB 16 is created by the linker, it is always
placed at address 0, at the start of the program.

The start of each module's $INIT segment is listed in the .MAP file.

4.2 Processing $$ constants


----------------------------

$$ is the offset from the start of the code segment (always 0), and
can only be resolved at link time, when the start address of each
module is known.

The $$ constant is converted to a reference to a dummy external


symbol called "__CSTART__". This constant is set to the start of
the code segment of each object module in turn defore the module is
linked. In this way, the correct values are calculated.

The value of $$ is effectively an external, but symbols containing


$$ can also be made public. This produces some complications. A
linked list of these symbols is created, and their actual values
are resolved when the start address of the code module is determined.
This method does NOT cater for forward references to public symbols
containing the $$ constant in other modules which have not yet been
linked.
SLINK - Page 19

5. LIMITATIONS
===============

- The maximum length of the first command line is 128 characters


(this is an IBM/DOS limitation).

- The maximum total command line length is 2K characters.

- The maximum size of an indirect command file is 32K bytes.

- The maximum number of object and library files which can be linked
is 75.

- The maximum number of public symbols and global elements is limited


by available memory only. A machine with 512K memory can handle
over 20'000 different public symbols and global elements.

- Function block parameter list checks are limited to the following:

* The length must be correct.

* Each parameter has a parameter type, which must be correct.

* The value of the parameter is checked to see that it is


valid for the parameter type:

Parameter types Range check


---------------------------------------------------------------
mc I|O|F|T|C|R|K|X|DB + number 0 - max according to mc
sc Q|D|N|B|W|L + number 0 - max according to sc
unsigned 16-bit number 0 - 65535
signed 16-bit number -20 - 32768
3-bit value + 13-bit value 0 - 7 and 0 - 8191

It can be seen that the following FB parameter list errors are


NOT detected by the linker alone:

* Illegal medium control code (mc), not all instructions which


require an mc support all mc's.

* Operand out of range, not all instructions support the full


range of the operand.

Detailed FB parameter checking is done by an additional program


called SFBREF, see section 8.

- Block nesting is not checked. A maximum depth of 8 PB/FB calls


is allowed in the CPU. This check is done within the CPU, which
executes an XOB if nesting is too deep. Program SVIEW can be used
to detect block nesting errors, see SVIEW's "View structure"
command.
SLINK - Page 20

6. MAP FILE
============

The map file is produced if switch "/M" is specified. The map file
name is always the name of the absolute object file with type ".MAP".

The map file contains the following:

- Revision number of linker.


- Name of absolute object file created.
- Date and time of linkage.
- The Registered User's name.
- The source file names of each module linked (not the object
file names).
- Assembly date and time of each module linked.
- Code start line number for each module linked. This can be added
to the address appearing in the listing file to give the actual
address of a program line in the PCD memory.
- Code size in program lines for each module.
- Text size in bytes for each module.
- Extension memory size in bytes for each module.
- The start line of the module's $INIT segment.
- Total code size in program lines.
- Total text size in bytes.
- Total extension memory size in bytes, and the extension memory
initialization segment size.
- The total number of global symbols.
- The total size of the $INIT segment in lines.
- A list of all global symbols, their values, defining modules and
a list of referencing modules for each symbol.
SLINK - Page 21

Map file example:

*** SAIA PCD LINKER V1.9 *** FILE: INIT.PCD LINKED: 23.11.89 13.23 PAGE
1
WIZZKIDS INTERNATIONAL CORPORATION INCORPORATED (UK) PLC

CODE CODE TEXT EXTN $INIT


START SIZE SIZE SIZE START
SOURCE FILE ASSEMBLY DATE LINE LINES BYTES BYTES LINE
-------------------------------------------------------------------------------
INIT1.SRC 12/03/96 10:47 14 14 0 0 1
INIT2.SRC 12/03/96 10:49 28 14 0 0 7
-------------------------------------------------------------------------------

TOTAL CODE SIZE: 42 LINES (168 BYTES) $INIT SIZE: 15 LINES

TOTAL TEXT SIZE: 0 BYTES

TOTAL EXTN SIZE: 0 BYTES

GLOBAL SYMBOLS: 0

*** SAIA PCD LINKER V1.9 *** FILE: INIT.PCD LINKED: 23.11.89 13.23 PAGE 2
WIZZKIDS INTERNATIONAL CORPORATION INCORPORATED (UK) PLC

SYMBOL TYPE VALUE DEFINED REFERENCED

BIGINT 2147483647 OPA3 OPA2


C0 C 0 OPA3 OPA2
C1599 C 1599 OPA3 OPA2
ELEVEN 11 OPA3 OPA2
F0 F 0 OPA3 OPA2
F8182 F 8182 OPA3 OPA2
ZERO 00H OPA3 OPA2

Linkage complete, 0 warnings, 0 errors


SLINK - Page 22

7. ABSOLUTE OBJECT FILE FORMAT


===============================

This describes the format of the PCD file created by the linker, and
the .UPL file created by the loader when existing code and text is
uploaded. The file is a byte-by-byte image of the header, code and
text of one CPU within the PCD, in the same order as it is uploaded
or downloaded across the serial interface to the PCD.

The same file format is used by all PCD types, since it will be
possible to download a PCD6 program to a PCD4 etc. There is a similar
header in all PCD types.

The file consists of up to 5 sections. The TEXT SEGMENT or EXTENSION


MEMORY SEGMENT may not be present of the program does not contain
any Texts or Data Blocks. The SYMBOL TABLE is also optional.

+----------------------------------+
| HEADER (40 bytes) |
+----------------------------------+
| CODE SEGMENT |
+----------------------------------+
| TEXT SEGMENT |
+----------------------------------+
| EXTENSION MEMORY SEGMENT |
+----------------------------------+
| SYMBOL TABLE |
+----------------------------------+
| PCD TYPE SEGMENT |
+----------------------------------+

Each section is described in detail on the following pages.

Differences Between .PCD and .UPL Files


---------------------------------------
In the .PCD file, created by the linker, only the program name, code
length, text length, code, text, feature indicator byte and checksum
locations are filled in the header. All other locations are set to 0.

The .UPL file, uploaded by the Loader, contains *all* the information
read from the CPU's header.

UPL files never contain a Symbol Table, because this data is not
stored in the PCD.
SLINK - Page 23
7.1 CPU Header
---------------
0 1 2 3 4 5 6 7
+-----+-----+-----+-----+-----+-----+-----+-----+
Program Name | |
8 characters, padded +-----+-----+-----+-----+-----+-----+-----+-----+
with NULs or spaces
8 9 10 11
+-----+-----+-----+-----+
Code Start (line) | MSB LSB | 0 = created by linker
+-----+-----+-----+-----+ >0 = CPU's code start
if uploaded
12 13 14 15
+-----+-----+-----+-----+
Code Length (lines) | MSB LSB | Size of file's code
+-----+-----+-----+-----+ in 32-bit lines

16 17 18 19
+-----+-----+-----+-----+
Code Freespace (lines) | MSB LSB | 0 = created by linker
+-----+-----+-----+-----+ >0 = CPU's code segment
size if uploaded
20 21 22 23
+-----+-----+-----+-----+
Text Start (line) | MSB LSB | 0 = created by linker
+-----+-----+-----+-----+ >0 = CPU's text start
if uploaded
24 25 26 27
+-----+-----+-----+-----+
Text Length (bytes) | MSB LSB | Size of file's text
+-----+-----+-----+-----+ in bytes

28 29 30 31
+-----+-----+-----+-----+
Text Freespace (bytes) | MSB LSB | 0 = created by linker
+-----+-----+-----+-----+ >0 = CPU's text segment
size if uploaded
32 33
+-----+-----+ 0000 = created by linker
Header Initialised * | | 5AA5H = uploaded from RAM
Word +-----+-----+ A55AH = uploaded from EPROM

34
Modification +-----+ 0 = created by linker
Indicator Byte * | | >0 = modified then uploaded,
+-----+ number of times modified
FFH = unprogrammed EPROM

35 00H = no features
+-----+ FFH = no features (from EPROM)
Feature Indicator * | | Bit 7=0: Bits 6..0=feature
Byte +-----+ indicator flags

36 37 38 39
* +-----+-----+-----+-----+
Code, text and header | MSB LSB |
checksum +-----+-----+-----+-----+

* = Not included in the checksum


SLINK - Page 24

Program Name
------------
8-character ASCII filename, left justified. Eg. If the filename is not
8 characters long, the remaining characters are always spaces (20H).
This name is filled in by the linker, or by the uploader in a .UPL
file if an un-named program is uploaded.

Code Start
----------
The user program line number for the start of the code. Set to 000
by the linker, so is always 0 in a .PCD file. In a .UPL file it
contains the uploaded header value.

Code Length
-----------
The length of the code in user program lines, filled in by the linker.

Code Freespace
--------------
The code memory space remaining for use by this CPU, in user program
lines. Set to 00000000 by the linker, so is always 0 in a .PCD file.
In a UPL file it contains the uploaded header value.

NOTE:

Code space in K lines available for CPUs 1-6 (Memory Map entry) is:

(code_length + code_freespace) / 1024

Code_length + code_freespace will always produce a multiple of 1024


(2^10), since the Memory Map entry is in K lines.

The actual code space available for CPU 0 is 100 lines less than that
indicated, since the first line available for code is 100. Therefore,
for CPU 0 the code space in K lines is as follows, and code_length +
code freespace will not be an exact multiple of 1024.

(code length + code freespace + 100) / 1024

Text Start
----------
The start user program line number for the Texts. Set to 00000000 by
the linker, so is always 0 in a .PCD file. In a .UPL file it contains
the uploaded header value.

Text Length
-----------
The total length of the text numbers, text characters and text NUL
terminators, in bytes, EXCLUDING the text padding characters. Filled
in by the linker.
SLINK - Page 25

Text Freespace
--------------
The memory space remaining for texts for this CPU, in BYTES. Set to
00000000 by the linker, so is always 0 in a .PCD file. In a .UPL file
it contains the uploaded header value.

NOTE:

Text space in K bytes available for each CPU is:

(text_length + text_freespace) / 1024

Text_length + text_freespace will always be a multiple of 1024.

Header Initialised Word


-----------------------
Value 5AA5 hex indicates initialised RAM. Value A55A hex indicates
EPROM. This location in the CPUs header is checked by the CPU on
initialisation after power up or restart, and if it does not contain
5AA5 hex (eg. it's unitialised), AND the memory is RAM (does not
contains A55A hex), the CPU loads its header with default values,
setting the Header Initialised Word to 5AA5 hex. This happens when a
new RAM card or a new CPU is installed.

The linker sets this value to 0000.

Modification Indicator Byte


---------------------------
This byte indicates if the code or text in the .PCD (or .UPL) file
has been modified while in PCD memory, using the programming unit.
It is always set to 0 by the linker. It is incremented once during
each program or text edit session, if any changes are made.

0 Program not changed.


1-254 Program has been edited, the file is a .UPL file.
255 Occurs only in .UPL file uploaded from EPROM memory,
if the CPU has not been programmed.
SLINK - Page 26

Feature Indicator Byte


----------------------
Bit 7 is not used and must ALWAYS be 0, so that the maximum value
is 7F (FF is reserved for "no features").

In other words, if bit 7 = 0, then feature bits 6..0 are valid.

Bit 76543210 (x = don't care)


------------
11111111 No additional features (bit 7 = 1)
1xxxxxxx No additional features (bit 7 = 1)
00000000 No additional features
0xxxxxx1 Extension memory segment present
0xxxxx1x Extension memory initialization data present
(programmed EPROMs only)
0xxxx1xx 1=automatic memory allocation, 0=manual
File only (NOT used in memory's header):
0xxx1xxx Resource list is present (PG4 only)
0xx1xxxx Symbol table and public symbols have comments
0x1xxxxx PCD type segment present, see section 7.6
01xxxxxx Symbol table present, see section 7.5

Checksum
--------
Calculated in the same way as it is done in the PCD, it's used in
the PCD during power up tests or by the TEST instruction. It is
created by the linker in a .PCD file, and by the loader in the
header in the PCD. The checksum is generated as follows:

1) Initialize unsigned long (4-byte) checksum to 0


2) For the first 8 unsigned long's in the header, and all
unsigned long's in the file's code and text segments do the
following:
- XOR unsigned long data (4 bytes) with checksum
- Rotate checksum 1 bit to the left (through MS bit)
- Repeat with next 4-byte unsigned long

The data MUST be in Motorola format - exactly as in the PCD's memory.


These relationships are true for the PCD file checksums:

codecs = (headcs ROL codelen) ^ filecs


headcs = (codecs ^ filecs) ROR codelen
filecs = (headcs ROL codelen) ^ codecs

Where: codecs = checksum of code and text data


headcs = checksum of header
filecs = checksum of entire file (header, code and text)
codelen = length of code and text data in DWORDs
ROL = rotate left
ROR = rotate right

This means that given the file checksum, the code/text checksum can
be determined if the header checksum is calculated, without having
to read the code/text segment. The header can be updated, the new
header checksum calculated, and the new file checksum can be calc-
ulated from these values BEFORE the code/text segment is read.

To rotate a checksum right or left "n" number of times, use this


algorithm (which limits the number of rotates to 31):

cs ROR n = cs ROR (n & 0x1F)


or cs ROL n = cs ROL (n & 0x1F)
SLINK - Page 27

7.2 Code segment


-----------------
This is as exact byte-by-byte image of the code in the PCD's memory,
in the same form as it is uploaded or downloaded. The length in bytes
is always a power or 4, since there are 4 bytes to every user program
line.

Each instruction or operand line is a 32-bit value, stored in


Motorola 68000 format (MS byte first).

40 41 42 43
+-----+-----+-----+-----+
Code Line 0 | MSB LSB | MSB LSB |
+-----+-----+-----+-----+
. OPCODE OPERAND .
. .
. .
. .
+-----+-----+-----+-----+
Line n | MSB LSB | MSB LSB |
+-----+-----+-----+-----+
OPCODE OPERAND

7.3 Text segment


-----------------
This is an exact byte-by-byte image of the text in the PCD's memory,
in the same format as it is uploaded or downloaded.

Padding characters:

Extra NUL bytes are added to the end of the last text (if text is
present) to pad the text length to a modulo 4 number. These padding
bytes are also stored in the PCD memory, and are present to allow the
correct generation of the double word checksum.

Starts at (40 + (code_length * 4))


+-----+-----+-----+--//--+-----+-----+
Text Text 0 | MSB LSB |CHAR0| |CHARn| 00 |
+-----+-----+-----+--//--+-----+-----+
. TEXT NO. TEXT NUL .
. .
. .
+-----+-----+-----+--//--+-----+-----+
Text n | MSB LSB |CHAR0| |CHARn| 00 |
+-----+-----+-----+--//--+-----+-----+
TEXT NO. TEXT NUL

Padding characters, +-----+--//-+-----+


either 0, 1, 2 or 3 | 00 | | 00 |
NUL bytes. +-----+--//-+-----+
(Rounds file length
up to mod. 4 bytes.)
SLINK - Page 28

7.3.1 Binary LAN texts


-----------------------
Texts between the $LAN..$ENDLAN directives are converted into a
special binary format, which can be processed by the LAN card much
faster than an ASCII text. There are two formats, one for absolute
LAN texts (type FDH), and one for indirect LAN texts containing
'@' (type FEH). These are described on the following pages.

Format:

+----+---//----+----+
| Fx | Message | 00 |
+----+---//----+----+
| | |
| | +------- NUL terminator
| +--------------- Encoded message and checksum
+---------------------- FDH = Encoded indirect LAN text
FEH = Encoded absolute LAN text
(FFH = Data block, see 7.3.2)

Since the binary text can contain 00 bytes (NUL, assumed end of text
by CPU), each byte is encoded from one into two bytes which can be
ANDed together to produce the original byte:

xxxxyyyy -> xxxx1111 1111yyyy

So the byte 00 becomes two bytes -> 0F F0 in hex. This encoding


format is also used by DATA BLOCKs 0..3999.
SLINK - Page 29

Absolute LAN text format


------------------------

+---+
| 0 | Partner number 00..FFh
+---+
| 1 | 80h = Range (eg. F32-63), 00h = single or list (eg. F0,1)
+---+
| 2 | Number of addresses - 1 (0 = one address)
+---+
| 3 | Source data type I O F T C R P X
+---+ 0 1 2 3 4 5 6 7
| 4 | -+
+ + |
| 5 | +- First physical source address, MS byte first
+ + | (68000 memory address)
| 6 | -+
+---+
= =
+---+
| | -+
+ + |
| | +- Last physical source address, MS byte first
+ + | (68000 memory address)
| | -+
+---+
| | Destination data type O F T C R P X
+---+ 1 2 3 4 5 6 7
| | -+
+ + |
| | +- First physical destination address, MS byte first
+ + | (68000 memory address)
| | -+
+---+
= =
+---+
| | -+
+ + |
| | +- Last physical destination address, MS byte first
+ + | (68000 memory address)
| | -+
+---+
| | Checksum 0..255 (sum of all bytes before encoding,
+---+ mod. 256)
SLINK - Page 30

Indirect LAN text format


------------------------

+---+
| 0 | Partner number: 0..255 = absolute station number
+ + 8000H-BFFCH = indirect register address
| 1 |
+---+
| 2 | Number of addresses - 1 (0 = one address)
+---+
| 3 | Source data type: I O F T C R + 80H if 1st adds indirect
+---+ 0 1 2 3 4 5 + 40H if 2nd adds indirect
| 4 | 1st source address + C0H if both indirect
+ + MS byte first (68000 memory address)
| 5 |
+---+
| 6 | 2nd source address
+ + MS byte first (68000 memory address)
| 7 |
+---+
| 8 | Destination data type: O F T C R + 80H if address indirect
+---+ 0 1 2 3 4
| 9 | Destination address
+ + MS byte first (68000 address)
| 10|
+---+
SLINK - Page 31

7.3.2 Data blocks 0..3999


--------------------------
Data Blocks 0..3999 are stored in the text segment. If the first
character of the text is FF hex, then it is assumed to be a Data
Block, which is encoded in a special way to prevent NUL characters
(00) appearing in the text.

Format:

+----+-----//-----+----+
| FF | Data items | 00 |
+----+-----//-----+----+
| | |
| | +---- NUL terminator
| +------------- Encoded Register values
+---------------------- FF = Data Block

Up to 383 4-byte data items (Register values) can be stored in a


Data Block. Since a data item could contain 00 bytes (NUL, assumed
end of text by CPU), each byte is encoded from one into two bytes
which can be ANDed together to produce the original byte:

xxxxyyyy -> xxxx1111 1111yyyy

Values are stored MS byte first. The 4-byte Register value 00000000
Hex is stored as an 8-byte value:

0F F0 0F F0 0F F0 0F F0

The Hex value 1234ABCD would be stored as:

1F F2 3F F4 AF FB CF FD
SLINK - Page 32

7.4 Extension memory segment


-----------------------------
Present only if the "feature indicator byte" = 0xxxxxx1 binary.
This segment holds Texts and Data Blocks 4000..7999, which are
stored in extension memory (RAM), available only if the PCD is
equipped with extension memory.

NOTE: All values in this segment of the file are in INTEL format
(LS byte first). They are converted to MOTOROLA format (MS
byte first) before loading into the PCD.

+---+---+---+---+---+---+---+---+-----//------+---+---+---+---+
| LENGTH | EXTN SIZE | DATA... | CHECKSUM |
+---+---+---+---+---+---+---+---+-----//------+---+---+---+---+
| | | |
| | | 32-bit checksum on
| | | DATA section only.
| | |
| | +----- Data records, see
| | below.
| +------------------- No. of bytes of
| extension memory used.
+----------------------------------- Length of file's EXTN
segment in BYTES
(should be mod. 4),
excludes "EXTN SIZE"
and "CHECKSUM".
Extension memory segment record
-------------------------------

0 1 2 3 4 5 6 7 8 ...
+----+----+----+----+----+----+----+----+----+-//-+----+
| NUMBER |TYPE|FLGS| LENGTH | INITLEN | DATA ... |
+----+----+----+----+----+----+----+----+----+-//-+----+
| | | | | |
| | | | | Initialization data,
| | | | | Always mod. 4 bytes long,
| | | | | texts may be padded with
| | | | | NULs. Init data may not
| | | | | be present, in which case
| | | | | the TEXT is all spaces,
| | | | | or a DB is all 0's.
| | | | +---- Length of initialization
| | | | data in long words for
| | | | DB, or bytes for text
| | | +-------------- LENGTH in long words for
| | | DB, or bytes for TEXT.
| | +---------------------- SASM flags:
| | 1xxxxxxxx = $SASI text
| | x1xxxxxxx = $LAN text
| | xx1xxxxxx = $NOXINIT
| +--------------------------- TYPE: 08 = text (8-bit)
| 32 = DB (32-bit).
+---------------------------------- TEXT/DB NUMBER: 4000..7999
SLINK - Page 33

Extension memory segment record continued


-----------------------------------------

The "LENGTH" is always in terms of the "TYPE", so that:

LENGTH * TYPE = data length in BITS

E.g. 10 character text = 10 * 08 = 80 bits = 10 bytes


5 element DB = 5 * 32 = 160 bits = 20 bytes

With this method it would be easy to store binary values in the


future (Flags or I/Os) by setting the type to 01, or BCD digits
by using type 04 etc.

All values are in Motorola format (most significant byte first).

Each record starts on a long word boundary (mod. 4). Texts are
padded with NULs if necessary. This makes access by the 68000
faster, and allows the "read/write user memory" telegrams to
be used, which read/write 4-byte values on modulo 4 addresses.

Handling for texts and DBs 0..3999 is unchanged, these are still
stored in the existing text segment. At present, the new format
affects only texts and DBs 4000..7999.

Texts are limited to 3072 (3K) characters in length, excluding


the terminating NUL for texts 0..3999. Texts 4000..7999 are stored
in the new format, and need no terminating NUL character because
the length is given. These texts can now contain NUL as a character.
Data Blocks 0..3999 can contain up to 383 elements (0..382), and
are stored in the existing TEXT segment, in encoded binary format.
Data Blocks 4000..7999 can contain up to 16384 elements (0..16383)
which is 64K bytes.
SLINK - Page 34

7.5 Symbol Table


-----------------
This segment is present if Bit 6 of the "Feature Indicator Byte"
is 1. It is produced from the public and local symbol tables in the
linked OBJect files, and is primarily for symbolic debugging. This
table can be very large, since it contains the definitions of all
local and global symbols in the program. The symbol table is only
present if SLINK's /SYM switch is used.

The offset to the start of the symbol table is found by:

40 + (CodeLength * 4) + TextLength + mod. 4 padding

If there's an extension memory segment, then add:

ExtnLength + 12

The symbol table contains these sections:

+--------------------------------+
| SYMBOL TABLE HEADER |
+--------------------------------+
| MODULE LIST |
+--------------------------------+
| AUTO ALLOCATION SEGMENT |
+--------------------------------+
| PUBLIC SYMBOL SEGMENT |
+--------------------------------+
| LOCAL SYMBOL SEGMENT, MODULE 1 |
+--------------------------------+
= =
+--------------------------------+
| LOCAL SYMBOL SEGMENT, MODULE n |
+--------------------------------+

The SYMBOL TABLE HEADER defines the sizes and offsets to each
segment.

The MODULE LIST contains data about each module that was linked
to create the .PCD file, its filename, assembly date/time etc.

The AUTO ALLOCATION segment is only present if AUTO statements


were used in the source modules, and holds the range of auto-
allocated elements for the user program.

The PUBLIC SYMBOL TABLE lists all the global symbols, and their
types and values. This may not be present if globals have not
been used.

The LOCAL SYMBOL SEGMENTs contain the local symbols which were
EQUuated in the source modules. The number of segments depends
upon the number of modules linked, and whether they had any
local symbols defined.

Each section is described in detail below.


SLINK - Page 35

Symbol Table Header


-------------------
22 bytes fixed length.

+--------------------------------------------------------+
0 | Offset to Module List 4 bytes |
+--------------------------------------------------------+
4 | No. of modules linked (records in Module List) '' |
+--------------------------------------------------------+
8 | Offset to Auto Allocation Segment (0 if none) '' |
+--------------------------------------------------------+
12 | Offset to Public Symbol Segment (0 if none) '' |
+--------------------------------------------------------+
16 | No. of Public Symbols (recs in Public Symbol Seg.) '' |
+---------------------------+----------------------------+
18 | FLAGS, see below 2 bytes |
+---------------------------+
20 | Checksum 2 bytes |
+---------------------------+

FLAGS byte:

Bit 0: 1 = Public Symbol Segment is unsorted. SLINK did not have


enough memory to sort the public symbols.
Bit 1: unused
..
Bit 15: unused
SLINK - Page 36

Module List
-----------
Each module linked contains a fixed length record of 64 bytes. The
number of module list records depends upon the number of modules
linked.

For each module linked:

+--------------------------------------------------------+
0 | Module name 14 bytes, NUL terminated string |
+--------------------------------------------------------+
14 | Assembly date/time 18 bytes, NUL terminated string |
+--------------------------------------------------------+
32 | Code start line 4 bytes |
+--------------------------------------------------------+
36 | Code size in lines '' |
+--------------------------------------------------------+
40 | Text size in bytes '' |
+--------------------------------------------------------+
44 | Extension memory segment size in bytes '' |
+--------------------------------------------------------+
48 | Extension memory init segment size in bytes '' |
+--------------------------------------------------------+
52 | Offset to Local Symbol Segment (0 if none) '' |
+--------------------------------------------------------+
56 | No. of local symbols (recs in Local Symbol Seg.) '' |
+---------------------------+----------------------------+
60 | FLAGS, see below 2 bytes |
+---------------------------+
62 | Checksum 2 bytes |
+---------------------------+

FLAGS byte:

Bit 0: 1 = Local Symbol Segment is unsorted. SASM did not have


enough memory to sort the local symbols.
Bit 1: unused
..
Bit 15: unused
SLINK - Page 37

Auto Allocation Segment


-----------------------
This segment is only present if AUTO declarations have been used
in the source modules. It contains the start addresses and counts
for all media which were auto-allocated.

The segment is fixed length, there are 22 records of 8 bytes each


plus a 2-byte checksum (178 bytes in total).

The "Type" byte holds the data type value, which is also the record
number (record offset). The type number can be used a direct offset
into the segment for speed of access, hence the unused records in
the segment (these are for types which cannot be auto-allocated).

The "Spare" byte is unused at present.

The "Start" value is from the type's AUTO declaration. The "End"
value is the last element in the AUTO declaration. "Used" is the
number of elements that were actually auto-allocated by the program.
If there was no AUTO statement for the media type then the "Start"
and "End" addresses are 0xFFFF and "Used" is 0. If there was an
auto statement but no addresses were auto-allocated, the "Start"
and "End" values will be filled in, but "Used" will be 0.

Format:

Type Spare Start End Used


Rec Offset BYTE BYTE WORD WORD WORD
+-----+-----+-------+-------+-------+
0 0 | 00h | 00h | 0000h | 0000h | 0000h |
1 8 | 00h | 00h | 0000h | 0000h | 0000h |
2 16 | 00h | 00h | 0000h | 0000h | 0000h |
3 24 | 03h | 00h | xxxx | xxxx | xxxx | Flags
4 32 | 00h | 00h | 0000h | 0000h | 0000h |
5 40 | 05h | 00h | xxxx | xxxx | xxxx | Registers
6 48 | 00h | 00h | 0000h | 0000h | 0000h |
7 56 | 07h | 00h | xxxx | xxxx | xxxx | Function Blocks
8 64 | 08h | 00h | xxxx | xxxx | xxxx | Program Blocks
9 72 | 09h | 00h | xxxx | xxxx | xxxx | COBs
10 80 | 00h | 00h | 0000h | 0000h | 0000h |
11 88 | 0Bh | 00h | xxxx | xxxx | xxxx | Sequential Blocks
12 96 | 0Ch | 00h | xxxx | xxxx | xxxx | Steps
13 104 | 0Dh | 00h | xxxx | xxxx | xxxx | Transitions
14 112 | 0Eh | 00h | xxxx | xxxx | xxxx | Texts
15 120 | 0Fh | 00h | xxxx | xxxx | xxxx | Semaphores
16 128 | 00h | 00h | 0000h | 0000h | 0000h |
17 136 | 11h | 00h | xxxx | xxxx | xxxx | Data Blocks
18 144 | 12h | 00h | xxxx | xxxx | xxxx | Timers
19 152 | 13h | 00h | xxxx | xxxx | xxxx | Counters
20 160 | 00h | 00h | 0000h | 0000h | 0000h |
21 168 | 00h | 00h | 0000h | 0000h | 0000h |
+-----+-----+-------+-------+-------+
176 | Checksum | 2 bytes
+-----------+
SLINK - Page 38

Public Symbol Segment


---------------------
The offset to the Public Symbol Segment and the number of public
symbols are found in the Symbol Table Header. The two bytes after
the last record are the segment's checksum. The symbols are in
alphabetical order (sorted) unless the Symbol Table Header FLAGS
byte bit 0 = 1.

Each public symbol record has the format:

+------//-----+----+--------+------+-------+---+---+---+---+
| SYMBOL NAME | 00 | MODULE | TYPE | FLAGS | VALUE |
+------//-----+----+--------+------+-------+---+---+---+---+

Where:

SYMBOL NAME The ASCII symbol name, a NUL terminated variable


length string.

MODULE One byte. The number of the module where the


symbol was defined. This is the number of the
module's record in the Module List (0=first
module).

TYPE One byte. The medium type of the symbol, obtained


from type prefix in EQUate statement:
00h = Untyped constant (no prefix)
01h = Reserved (used by assembler for
labels which cannot be Public)
02h = Input or Output (I|O)
03h = Flag (F)
04h = Timer or Counter (T|C)
05h = Register (R)
06h = Constant (K)
07h = Function Block (FB)
08h = Program Block (PB)
09h = Cyclic Organization Block (COB)
0Ah = Exception Organization Block (XOB)
0Bh = Sequential Block (SB)
0Ch = Step or Initial Step (ST)
0Dh = Transition (TR)
0Eh = Text (TEXT)
0Fh = Semaphore (SEMA)
10h = FB parameter number (=)
11h = Data Block (DB)
12h = Timer (T)
13h = Counter (C)
14h = Input (I)
15h = Output (O)

FLAGS One byte. Bits 3..0 indicate the original units


of the symbol:
0 = Decimal
1 = Binary
2 = ASCII
4 = Floating point (Motorola FFP)
8 = Hex

VALUE 4 bytes. Absolute 32-bit value of the symbol.


SLINK - Page 39

Local Symbol Segments


---------------------
Each module linked has its own Local Symbol Segment. The offset to
the segment and the number of records in the segment are found in
the module's entry in the Module List. The two bytes after the
last record are the segment's checksum. The symbols are in alpha-
betical order (sorted) unless the Module LIst record's FLAGS byte
bit 0 = 1.

Each local symbol record has the format:

+------//-----+----+------+-------+---+---+---+---+
| SYMBOL NAME | 00 | TYPE | FLAGS | VALUE |
+------//-----+----+------+-------+---+---+---+---+

The record is the same as public symbol record described above,


except that the MODULE number is not present for local symbols.
SLINK - Page 40

7.6 PCD type segment


---------------------
This contains the destination CPU and S-BUS station number defined
by the $CPU and $STATION directives, and a list of PCD types and
firmware versions from the $PCDVER directives. These are used by
the downloader to determine if the PCD file can be loaded into the
connected PCD.

+----------------+
00 | CPU NUMBER | 0..6
+----------------+
01 | STATION NUMBER | 0..254
+----------------+
02 | NO OF RECORDS |
+----------------+------------------+------------------+
03 | PCD TYPE | OFFICIAL VERSION | INTERNAL VERSION |
+----------------+------------------+------------------+
= =
+----------------+------------------+------------------+
| PCD TYPE | OFFICIAL VERSION | INTERNAL VERSION |
+----------------+------------------+------------------+
| CHECKSUM |
+----------------+

CPU NUMBER 1 byte. Destination CPU number from the


$CPU directive, -1 if not defined.

STATION NUMBER 1 byte. Destination S-BUS station number


from the $STATION directive, -1 if not
defined.

NO OF RECORDS 1 byte. The number of PCD firmware version


records which follow.

PCD firmware version records, created from $PCDVER directives:

PCD TYPE 8 bytes, e.g. "D1M1??" or "D6M540".


OFFICIAL VERSION 4 bytes, e.g. "004", "001".
INTERNAL VERSION 4 bytes, e.g. "3A", "4B".

The last 2 bytes are the checksum.


SLINK - Page 41

8. FUNCTION BLOCK PARAMETER CHECKS WITH SFBREF


===============================================

SLINK itself does only rudimentary checking of FB parameters. For


detailed checks, SLINK can invoke the program SFBREF.EXE after a
successful linkage. SFBREF can alos be used separately to create
an FB parameter cross-reference listing (a list of all FBs and the
parameters supplied with each FB call), see SFBREF.DOC.

SFBREF is invoked after linkage by supplying the /F switch on the


command line, or by setting the "Check FB parameters" switch on
the PCD Programming Utilities menu to "Yes" (default setting).

8.1 SFBREF Warnings


--------------------

Warnings indicate non-fatal programming errors, executing the program


in a PCD will not cause any problems.

Warning 1: Adds <n>: Parameter not referenced: CFB <n> Param <n>

The indicated parameter is not referenced by the Function


Block.

Warning 2: Adds <n>: Function Block not called: FB <n>

The Function Block exists, but is never called.

8.2 SFBREF Error Messages


--------------------------

These are listed to the display and also at the start of the FB
Parameter Reference List. They do not cause SFBREF to abort, but
are all fatal programming errors. Executing a program containing
errors in the PCD will produce unexpected results.

All these errors, except Error 30, are also detected by the Assembler
(SASM) and the Linker (SLINK). They can, however, be introduced by
editing the program in PCD memory, then uploading it.

Error 30 is not detected by the Assembler or Linker, this is the


error which this program is primarily designed to detect.

"Adds <n>" is the absolute address (program line number) where the
error occurred.

Error 20: Adds <n>: Invalid opcode

The instruction cannot be recognized, it is ignored. The


input file is an invalid or out-of-date PCD file.

Error 21: Adds <n>: Invalid operand

The instruction has an invalid operand, it is ignored.


SLINK - Page 42

SFBREF error messages continued


-------------------------------

Error 22: Adds <n>: Missing operand

The instruction is a multi-line instruction, and one or more


if its operands are missing.

Error 23: Adds <n>: Unexpected operand

An operand has been encountered which does not relate to the


preceding instruction.

Error 24: Adds <n>: Multi-defined FB

The Function Block has already been defined, it occurs more


than once in the program. It is ignored.

Error 25: Adds <n>: Invalid FB parameter number

Function Blocks can reference up to 255 parameters. This error


should never occur.

Error 26: Adds <n>: Wrong end of block

The end of block statement does not match the opening


statement, for example PB...EFB, COB...EXOB.

Error 27: Adds <n>: Missing end of block

An new block opening instruction has been encountered before


an end of block statement.

Error 28: Adds <n>: Missing parameters: CFB <n> from Param <n>

The Call Function Block (CFB) instruction does not provide


enough parameters for the Function Block.

Error 29: Adds <n>: FB <n> doesn't exist

A CFB instruction calls a Function Block which does not


exist.

Error 30: Adds <n>: Bad parameter: CFB <n> Param <p> (val): <adr>
<mnemo>

The indicated parameter is invalid. The instruction referencing


the parameter is shown. This is the most common error. The
indicated parameter <p> has a value of "(val)". It's referenced
at program line <adr> by the instruction <mnemo>.

Error 31: Adds <n>: Illegal parameter reference

A reference to a parameter has been encountered outside a


Function Block. It is ignored.
SLINK - Page 43

8.3 SFBREF Limitations


-----------------------

Due to the nature of certain PCD instructions there are some rare
programming errors which cannot be detected. These occur only with
instructions where the maximum value (or type) of the third or fourth
operand is dependent on the value (or type) of the first or second
operands. SFBREF doesn't check these dependency errors.

The FB parameter cross-reference listing produced by SFBREF can be


used to check for these errors.

This affects the following instructions:

BITI The maximum I/O/F address is dependent on the


BITIX number of bits being input or output.
BITO
BITOX
BITIR
BITIRX
BITOR
BITORX

DIGI The maximum I/O/F address is dependent on the


DIGIX number of digits being input or output.
DIGO
DIGOX
DIGIR
DIGIRX
DIGOR
DIGORX

MOV The data type of the source and destination


MOVX must be the same.

SRXM The source and destination data types must


STXM be compatible (e.g. R -> T or I -> F etc.),
TFR and the maximum no. of elements that can be
transferred is dependent on the element types.

NOTE: SFBREF does not know what value will be in the Index Register
at run time, and so CANNOT detect indexing errors on FB parameters.

*** END SLINK.DOC ***


***********************************************************************
* *
* SAIA MONITOR/DEBUG UTILITY FOR PCD *
* SBUG - FUNCTIONAL SPECIFICATION *
* *
* FILENAME SBUG.DOC *
* AUTHOR MATT HARVEY, SAIA MURTEN *
* DOCUMENT DD-EPG3-001 Rev.28 *
* *
***********************************************************************

REVISION HISTORY
5-Jan-98 Rev.28, V2.1
1) "Display cpu-Status" now shows production information, if
present in the PCD.

11-Jun-97 Rev.27, $20A


1) Now supports Flash EPROM.
2) Added ERROR 95: CAN'T CHANGE TEXT SIZE IF EPROM OR FLASH EPROM
MEMORY.
3) Added "Display data-Block ... Refresh".

21-Mar-97 Rev.26, $208


1) Now supports Flash EPROM memory.
2) Added these errors:
ERROR 87: MEMORY MAP CORRUPTED OR INVALID
ERROR 88: FLASH EPROM MEMORY, CPU MUST BE STOPPED
ERROR 94: CAN'T WRITE TO FLASH EPROM MEMORY
3) These error messages are no longer used:
ERROR 87: OUTPUTS ARE ALWAYS CLEARED WHEN USING P800 PROTOCOL
ERROR 88: OUTPUTS ARE ALWAYS CLEARED, FIRMWARE UPGRADE REQUIRED
4) "Display Memory-map" now shows more details about memory, e.g.
CODE/TEXT MEMORY: RAM, 256K Bytes EXTENSION MEMORY: 512K Bytes
5) PCD1 has texts/DBs 0..4999.

28-Feb-97 Rev.25, $207


1) PCD6.M3 has nonvolatile registers 0..100.

18-Nov-96 $202
1) Correct modem name (Display s-bUs) if it contains foreign chars.
2) Add ERROR 93: GREATER THAN/LESS THAN, NOT ALLOWED FOR FLOATING
POINT
VALUE (SWER 867).
3) "File Compare" now works correctly if PCD is password protected.
It always failed the compare test when password protection, even if
the password had been entered and the programs were the same.
21-Jun-96 V2.0

18-Mar-96 $19G
1) SWMR 680 and 815: Added $CPU, $STATION, $PCDVER assembler
directive handling. The CPU number, S-BUS station number and PCD
firmware versions are now checked by the "File Load" command.
Added section 4.3 Warnings.

07-Mar-96 $19F
1) SWMR 818: Added "Write nonVolatile-register" and "Display
nonVolatile-register" commands. These only work on the PCD1.
See section ?. Also added errors 90 and 91.
2) SWMR 809: The DEFTR is not allowed in the "Instruction" command.

05-Mar-96 $19E
1) Add ERROR 89: FAILED TO CONNECT TO CPU n.

20-Feb-96 $19D
1) SWMR 803: Added "File set-load-Options" command, for setting the
"Clear all outputs" and "Run all CPUs on completion" options for
the "File Load" command. See section 3.8.
2) Added ERROR 87 and 88.
3) New prompt at start of "File Load" operation:
WARNING: This will reset all cpus!! Continue (Y or N) ?

16-Oct-95 $198
1) Automatic connection to PGU port using "PGU MODE".
2) Modifications for PCD1.

24-Apr-95 V1.9
----------------
1) For "Write passWord" there is no way to disable the inactivity
timeout, a timeout of 0 is invalid.
2) Updated the "Halt and history messages" decsription, section 4.3.

17-Mar-95 $18B
----------------
1) SWMR 596: When downloading a single block, and a "block not
defined" error occurs:
If in run, it's a fatal error, else prompt "ABORT, CONTINUE,
IGNORE (A, C or I) ?". Ignore (I) disables all further warnings.
2) SWMR ?: A "Restart warm" instead of a "Restart cold" is now done
when downloading a new program with the "File Load" command, if
the latest firmware is used, see 3.8. This prevents the outputs
being cleared at the start of a download.
3) SWMR 611B: "Display cpu-Status" now shows CPU, LAN and P800
firmware versions.
4) SWMR 658: Added "File Get-pcdsetup" command, see 3.8.
REVISION HISTORY Continued

06-Feb-95 $18A
----------------
1) Added password mechanism and "Write passWord" command, 3.6.11.
2) Added error messages 84, 85, 86.
3) SWER 709: STs and TRs cannot be downloaded while the CPU is
running, and a restart cold must now be done after downloading
an ST or TR. This is because the PCD's internal tables cannot be
updated for the new ST or TR address if the ST or TR is active.
Changed error 72 text.
4) "Write s-bUs station" command now documented, 3.6.10.
5) "Display s-bUs" also shows the gateway configuration.

18-Aug-94 $188
----------------
1) "Display s-Bus" now displays PCD modem control strings (3.5.14).

05-Jul-94 $186
----------------
1) Add S-BUS "broAdcast" command, section 3.16.
2) Add S-BUS "Run Xob" command, section 3.2.
3) Add ERROR 83: CPU NOT IN RUN.
4) "Refresh" option added to "Display data-Block".
5) Arithemtic flags, index register and block number now shown
beside the instruction when in stop or conditional stop.
NOTE: These are the values BEFORE the instruction is executed.
The instruction is marked with a "*" to indicate that is has
not been executed yet. In "Trace", these are the values AFTER
the instruction has been executed.

09-Jun-93 V1.7
----------------
1) Command stack increased to 20 (was 10).
2) Extension memory support:
- "File Load <filename> Extension-memory" command (3.8).
- "Display Memory-map" now shows extension memory segment
(3.5.9).
- Texts and Data Blocks 4000..7999 are now supported if
extension memory is present (4000..5999 in the PCD2).
3) "Trace" now shows which block is executing (3.3), so does
"Display Accu" (3.5.1).
4) New "Display Exec-path" command, which shows the block call
nesting (3.5.13).
REVISION HISTORY Continued

5) S-BUS support:
- Built-in S-BUS and modem communications.
- New "Display s-bUs" command displays the current S-BUS
PGU port configuration (3.5.14).
- New "cOnnect" command (replaces the "cpU" command).
"cOnnect Cpu", "cOnnect Station" and "cOnnect Analyse-
sbus-network" commands (3.15).
- The connected S-BUS station is shown on the title line
(2.1).
6) New "Clear Memory" (clears all user memory), "Clear Extension-
memory", "Clear Data-block" (sets all values in a DB to 0),
and "Clear Program-memory" commands (3.12).
7) "Write clocK" now accepts the week-of-year and day-of-week,
if required (3.6.6). SBUG calculates these as before if not
supplied.
8) "File Load <filename> Cob/Xob/Pb/Fb/sB/St/Tr <number>" now
examines the block before loading it, and issues an error
message if the block contains references to undefined blocks,
and the block load can be aborted (3.8).
9) New error messages 66 to 82 (4.1).
10) New "Run To" destinations: Cob/Xob/Pb/Fb/St/Tr/End-of-block
(3.2).
11) "Display Program" now accepts block numbers, e.g. "Display
Pb 32" (3.5.4).
12) "Display clocK" format improved (3.5.6).
13) Support for the new PCD2 and PCD6.M5 systems.
14) Refresh window "deLete" command (Ctrl+L) deletes the last line
in the refresh window.
Comments can now be entered in the refresh window by preceding
them with two semi-colons on the command line, e.g. "; ;comment".
15) The "File View" command can now display any sized file, and
allows scrolling left and right.
16) Command syntax diagrams updated (5.).

06-Dec-91 $154
----------------
1) "Display bYte" and "Write bYte" removed from command menu, but
still function (SWMR 230).
2) Added "File Load <filename> sB <number>", individual SBs can now
be downloaded.
3) New "ERROR 72: CPU MUST BE IN STOP OR HALT TO DOWNLOAD NEW SB".
4) "Display Memory-map" now shows the S-BUS station number, if
configured.

09-Oct-91 $153
----------------
1) Last program line number now 262143 (was 65535).
2) "Display Memory-map" now accepts code and text segments up to
999K lines or characters.
3) New "Trace forEver" command.
4) Changed "Status" to "Status-flag" for clarity,
e.g. "Write Status-flag ...", "Run Until Status-flag ...".
REVISION HISTORY Continued

07-Sep-91 $152
----------------
1) New "Write data-Block" command section 3.6.8 (SWMR 197).
2) Values displayed in hex now have "H" postfix.
3) New errors 69, 10 and 71.
4) Add "Batch Run ... forEver" command.

03-Dec-90 V1.4
----------------
1) Now uses the pop-up directory window for the "File Directory"
command, and for "File View" and "File Load" commands with no
filename or a filename with wildcard characters (SWMR 132).

27-Oct-90 $139
----------------
1) Added "Display data-Block" command, section 3.5.11.
2) The "Locate" command can now find Data Block references.
3) Data Blocks can be loaded from a PCD/UPL file. Added "File Load
<filename> data-Block <number>" command.
4) Changed "Accumulator" to "Accu", more space on the prompt line.
5) Changed "Byte" to "bYte", now uses 'Y' key. 'B' key is used
by "data-Block".
6) "Write bYte" command described and improved, section 3.6.8.
Now accepts data on the command line, and can be run from a
batch. "Display bYte" now allows "Refresh" option.
7) "Display History" format changed, now shows user addresses if
possible, and locations 12..15 count the occurrences of certain
errors, see section 3.5.10.
8) Now displays binary LAN texts (from assembler's $LAN..$ENDLAN)
in Ascii. Binary LAN texts cannot be edited.
9) "Display Register ... Ascii" now displays control codes and
non-ASCII characters with codes greater than 127 as IBM graphics
characters (e.g. │ ┐ ░ ä).
10) Added error messages 62, 63, 64, 65 and 149.
11) The DIGI and DIGO instructions now support Bcd values up to
2147483647 (was max. 1999999999).
12) Some Halt & History messages changed, see section 4.3.
13) For "Write O|F ... Manual", the display is not scrolled when
the next/previous address is selected, see 3.6.2.
14) Added description of "Display bYte" command, section 3.5.12.
15) For "File View <filename>", default extension is now ".SRC".

21-Jun-90 $134
----------------
1) "cpU" command added (see 3.15).
2) Added error messages 60 and 61.
3) "Display Program ... Refresh" now works when CPU is in Run.

04-May-90 $133 (and $131/2)


-----------------------------
1) Added new command "Display Program ... Refresh" (SWMR 110).
2) "Trace" now shows actual FB parameters (SWMR 36).
3) "Trace" now shows contents of Registers to floating point
instructions (FADD, IFP etc) in floating point units.
5) "Trace" now displays the contents of Function Block parameters
BEFORE the Function Block is called.
6) Added error messages 58 and 59.
REVISION HISTORY Continued

27-Sep-89 V1.3 Report No.


----------------
1) Updated for PCD4, detects CPU type. 37
- Ignore CTS line if restart command sent to PCD4, this
prevents off-line errors when PCD4 drops CTS during
start-up. 41
- Memory map shows only 2 CPUs (0 & 1) if PCD4. 16
- Max I/O address now 512 if PCD4. 53
- Run, STop, Restart only 2 CPus if PCD4. 38
- P8 firmware version not displayed if connected to PCD4 -
2) New and updated "Batch" commands (see 3.7):
- New "Batch Copy". 14
- New "Batch reName". 14
- "Batch Load <filename> <batch name>" can load an
individual batch from a file. 14
- "Batch Edit" now displays the existing line to be edited
with backspace. 2
3) "File Load" command now verifies that memory exists and
is not write-protected. 3
4) Error generated if Run, Stop or rEstart non-existent CPU. 4
5) Now handles ASCII units for Registers (see 3.5.3 & 3.6.3): 10
- New "Display Register ... Ascii" command.
- New "Write Register ... Ascii" command.
- New "Run Until Register ... Ascii" command.
- "Write Program" and "Instruction" commands now support
ASCII constants. e.g. LD R 0, 'abcd'; LDL R 0, 'A'.
6) Display and write of Inputs, Outputs or Flags in Bcd, Hex
or Decimal units now has lowest address as least significant
bit/digit by default. Now allows display/write in reverse
order, lowest address is most significant bit/digit only if
descending address range given (see 3.5.2 & 3.6.2). 11
7) Refresh Window command prompt now displayed when CTRL key
is pressed (see 2.3). -
8) New Refresh Window command "Kill" CTRL+K (see 2.3). 13
9) "Instruction" command now issues error message for ACCU
dependent instructions is ACCU=L (see 3.9). 15
10) Allow K constants for LD, LDH and LDL. 17
11) Improved "Locate" command. Can now locate ALL operand
types (32-bit etc). Same as SEDIT's "Locate" command
(see 3.10). 22
12) Recalls 10 previous commands with F9 & F10 (see 2.6). 54
13) If "Quit" done with "rEstart" required, a warning
message is displayed: "QUIT (Y or N)?" (see 3.16). 55
14) Function keys F13..F20 can be assigned to batches named
"F13".."F20". Function key F1 is now fixed as the help
key, function keys F9 & F10 are for command recall, they
do not support batches anymore (see 3.7).
Now supports up to 40 batches (was 20). -
15) Default batch file SBUG.DBA changed (see 2.6). -
16) New "Print Open-file" and "Print Close-file" commands
to allow output to a log file (see 3.13). 59
"Print Open-file COM1" redirects output to
a serial printer (COM1/COM2/LPT1/LPT2 etc).
"Print On" changed to "Print Enable".
"Print oFf" changed to "Print Disable".
REVISION HISTORY Continued

17) New command "Run [From <address>] To <address>" 61


18) Removed PG1 numeric codes from "Display Program" etc. -
19) "Trace" now shows the value of the I|O|F|R|T|C referenced
by the operands, in square brackets (see 3.3). -
20) New error when in Trace, "INDEX OVERFLOW". -
21) $ (and #) allowed for specifying absolute addresses for
JR instructions, e.g. "JR $100" calculates the relative
address to jump to address 100. -
22) Space not needed in FB parameter references, enter either
"STH =1" or "STH = 1". -
23) SBUG now works in colour. Colours are defined in file
PCDCOLOR.DAT, which defines the colour set for the
entire PG3 package (see the file PCDCOLOR.DAT). -
24) Positive flag (P) now displayed in "Trace" and "Display
Accumulator". Index Register now displayed in "Display
Accumulator" (see 3.3 & 3.5.1). -
25) Added "Write Status-flag Positive" command (see 3.6.1). -
26) "File Directory" now allows a drive, path and/or filename
mask, e.g. "File Directory C:\PCD\*.SRC (see 3.8). -
27) New HyperHelp, as in SEDIT. Over 280 help screens with
instruction set description (see 3.14). -
28) New "File View" command, displays an ASCII file. Replaces
the old "Help <filename> " command which could display any
file. Can now display any sized file (see 3.14). -
29) "Display History" command also shows the Halt Register
(see 3.5.10). -
30) "Display/Write teXt" commands do not display leading
zeros in "<10>", was "<010>". -
31) ESCape key now exits "Batch Write" command, after -
inserting "eNdbatch".
32) "Display cpu-Status" now shows state of PCD6.T1 LAN
(see 3.5.8). 16
33) "Display Memory-map" now shows FREE SPACE, and LAN2
station number and F/W version (see 3.5.9). 16
34) Refresh window state is now saved in file SBUG.DAT and
the refresh window is restored next time SBUG is run. -

25-Nov-88 V1.1 & V1.2


-----------------------
1) Add "Locate" command (3.10, 5.).
2) Add "Trace Mode" and "Trace No-calls" options (3.1,
3.3, 5.).
3) Add Halt and History Messages (4.3).
4) "Display History" command description corrected
(3.5.10).
6) Program modified indication added in "Display Memory-map"
(3.5.9)
7) Now supports up to 4000 texts (0-3999).
REVISION HISTORY Continued

30-May-88 First version V1.0


------------------------------
1) Definition instructions DEFWPR, DEFWPH, DEFTB, DEFTC
not allowed in "Instruction" command (3.9).
2) For 'manual' Output and Flag writes, the refreshed
value is displayed in bold video, not reversed video
(3.6.2).
3) "Restart cpu-number 0" cannot be done. A "Restart
All-cpus" must be done to restart CPU 0 (3.11)
4) Default extension for Help files is ".HLP" (3.14).
5) Improved Error 51 message (4.1).

27-feb-86 Initial edit


-----------------------
SBUG - Page 1

CONTENTS
========
Page
1. OVERVIEW . . . . . . . . . . . . . . . . . 3
1.1 Connection to CPU . . . . . . . . . . . . 3
1.2 Invocation from DOS . . . . . . . . . . . 4
1.3 Data Types, Ranges and Scope . . . . . . 5

2. THE SCREEN . . . . . . . . . . . . . . . . 7
2.1 Title/Status Line . . . . . . . . . . . . 7
2.2 Main Display Window . . . . . . . . . . . 8
2.3 Refresh Window . . . . . . . . . . . . . 9
2.4 Prompt Line . . . . . . . . . . . . . . . 10
2.5 Command Line . . . . . . . . . . . . . . 10
2.6 Keyboard and Function Keys . . . . . . . 11

3. COMMANDS . . . . . . . . . . . . . . . . . 12
3.1 Entering Commands . . . . . . . . . . . . 12
3.1.1 Command Summary . . . . . . . . . . . . 14
3.2 Run . . . . . . . . . . . . . . . . . . . 15
3.3 Trace . . . . . . . . . . . . . . . . . . 17
3.3.1 Accumulator and Arithmetic Status . . . 19
3.4 Stop . . . . . . . . . . . . . . . . . . 19
3.5 Display Commands . . . . . . . . . . . . 20
3.5.1 Display Accu . . . . . . . . . . . . . . 21
3.5.2 Display Inputs, Outputs and Flags . . . 21
3.5.3 Display Registers, Timers and Counters . 23
3.5.4 Display Program . . . . . . . . . . . . 24
3.5.5 Display Text . . . . . . . . . . . . . . 26
3.5.6 Display Clock . . . . . . . . . . . . . 26
3.5.7 Display Index and Display-register . . . 27
3.5.8 Display CPU Status . . . . . . . . . . . 27
3.5.9 Display Memory-map . . . . . . . . . . . 28
3.5.10 Display History . . . . . . . . . . . . 29
3.5.11 Display Data-block . . . . . . . . . . . 30
3.5.12 Display Byte . . . . . . . . . . . . . . 31
3.5.13 Display Exec-path . . . . . . . . . . . 31
3.5.14 Display s-bUs . . . . . . . . . . . . . 32
3.6 Write Commands . . . . . . . . . . . . . 33
3.6.1 Write Accu and Write Status . . . . . . 33
3.6.2 Write Output and Write Flag . . . . . . 33
3.6.3 Write Register, Timer and Counter . . . 36
3.6.4 Write Program . . . . . . . . . . . . . 37
3.6.5 Write Text . . . . . . . . . . . . . . . 39
3.6.6 Write Clock . . . . . . . . . . . . . . 41
3.6.7 Write Index-register . . . . . . . . . . 41
3.6.8 Write Data-block . . . . . . . . . . . . 42
3.6.9 Write Byte . . . . . . . . . . . . . . . 44
3.6.10 Write s-bUs station . . . . . . . . . . 45
3.6.11 Write passWord . . . . . . . . . . . . . 46
SBUG - Page 2

3.7 Batch . . . . . . . . . . . . . . . . . . 47
3.8 File . . . . . . . . . . . . . . . . . . 50
3.9 Instruction . . . . . . . . . . . . . . . 55
3.10 Locate . . . . . . . . . . . . . . . . . 56
3.11 Restart . . . . . . . . . . . . . . . . . 57
3.12 Clear . . . . . . . . . . . . . . . . . . 58
3.13 Print . . . . . . . . . . . . . . . . . . 59
3.14 Help . . . . . . . . . . . . . . . . . . 60
3.15 Connect . . . . . . . . . . . . . . . . . 61
3.16 Broadcast . . . . . . . . . . . . . . . . 61
3.17 Quit . . . . . . . . . . . . . . . . . . 62

4. ERROR REPORTING . . . . . . . . . . . . . 63
4.1 Miscellaneous Errors . . . . . . . . . . 63
4.2 Assembler and Disassembler Errors . . . . 73
4.3 Warnings . . . . . . . . . . . . . . . . 77
4.4 Halt and History Messages . . . . . . . . 79

5. COMMAND SYNTAX DIAGRAMS . . . . . . . . . 82


SBUG - Page 3

1. OVERVIEW
============

This functional specification describes the operation of the PCD's


debug program, SBUG.EXE.

SBUG is a low level monitor and debug utility for commissioning


SAIA PCD programs. It forms part of a software package which runs on
any IBM compatible Personal Computer, which has an RS-232 serial port.

1.1 Connection to CPU


----------------------

There are two communications modes which can be used for connecting
the Personal Computer to the PCD. PGU mode is for direct RS-232
connection to the PCD's PGU port, or via a PCD8.P800 on a PCD6.
S-BUS mode is for connection to an S-BUS network using RS-485 or
via a modem using RS-232. The mode is selected from the main menu's
"coNnect" screen, or by the "SCONNECT" program run from the DOS
prompt.

To use S-BUS mode, configure the PCD's S-BUS PGU port from the
"Configure/s-Bus communications" menu, and download this configur-
ation into the PCD via a PGU link by using the "Up/download" menu's
"CONFIGURE S-BUS" command. To use an RS-485 multi-station connection
for S-BUS, a "SAIA RS-485 to RS-232 convertor" or an opto-isolated
RS-232 card is required.

An RS-232 port can be used with a public or private line modem if


using S-BUS mode. The "coNnect" menu provides dial and hang-up
facilities for public line modems. When using a modem, delays and
timeouts for the Personal Computer side may need to be defined on the
"Configure/Serial ports" menu. This menu also defines the baud rates
for the Personal Computer's serial ports.

PCD1, PCD2, PCD4 and PCD6.M5


----------------------------
For direct local connection, the front panel PGU connector is
normally used. On the PCD1, PCD4 and PCD6.M5 this is an RS-232 port,
and can be used with PGU or S-BUS modes. On the PCD2, the PGU port
can be software configured as an RS-232 or RS-485 port from the
"Configure/s-Bus communications" menu.

The new PCD8.K111 cable should be used for PGU and S-BUS modes.

For these PCD's, the PGU port CANNOT be used with public line modems
(it lacks control lines). The PCD1 can use port 1. The PCD2 and PCD4
can use any add-on RS-232 port, the PCD6.M5 can use only port 2.

The PGU port can also be used as a general-purpose communications


channel if it is re-configured by the user program executing a SASI
instruction. After this the port cannot be used as a PGU port, and
the Programming Utilities will go "off line". To regain use of the
PGU port, re-connect the PC or PG1 and reset the PCD by powering it
off and on or by activating the Halt switch.
SBUG - Page 4

PCD6.M2 - with serial ports 0..3


--------------------------------
To use PGU mode, the PCD8.P800 communications interface is required.
This plugs into the "P8" socket on the front panel, and provides an
RS-232 PGU port. To use S-BUS mode, any port 0..3 can be configured as
an S-BUS PGU port. Ports 0..3 can be RS-232 or RS-422 for point-to-
point connection, or RS-485 for a multi-station network, depending on
the model. Any RS-232 port configured as an S-BUS PGU port can be used
with a public or private line modem.

PCD6.M1 - without serial ports


------------------------------
PGU mode must be used via the PCD8.P800 communications interface.
S-BUS mode cannot be used.

*** WARNING ***

The PCD8.P800 must NEVER be connected or disconnected to/from a PCD6


while on-line to the PCD Programming Utilities (running "Debug" etc).
If it is, a "Bus Quit Failure" may occur and the CPU will halt. To
connect or disconnect the PCD8.P800, first return to the main
Programming Utilities menu or power off the PCD6.

1.2 Invocation from DOS


------------------------

SBUG can be invoked directly from DOS with the following command line:

[d:path]SBUG [[d:path]filename[.ext]] [/PG4] <CR>

Where:

d:path Optional drive and/or path name, A:, B:\DEBUG etc.

filename Optional debug BATCH FILE name. This batch file is


automatically loaded, and the first batch in the file
is automatically executed. If this file name is not
entered, the default debug batch file "SBUG.DBA" is
automatically loaded, the first batch is NOT executed.

.ext Optional file extension for debug batch file, the


default is ".DBA".

/PG4 Optional switch indicating that SBUG is being called


from the PG4's SBUGWIN.EXE wrapper program. This
makes SBUG use the PG4SETUP.DAT and PG4MENU.DAT
files rather than the PG3's PCDSETUP.DAT and
PCDMENU.DAT files.

*** NOTE ***


The configuration data file PCDSETUP.DAT, the colour definition file
PCDCOLOR.DAT and the help file SBUG.HLP should be present in the
same directory as SBUG.EXE, usually the PCD program directory, see
the PG3 package installation instructions for details.
SBUG - Page 5

1.3 Data Types, Ranges and Scope


---------------------------------

The PCD contains the following elements. The addressing range (the
number of elements) is given. The "SCOPE" of an element indicates if
it is LOCAL to one CPU or GLOBAL (common) to all CPUs.

ELEMENT ADDRESS VALUE SIZE IN SCOPE SEE NOTE


RANGE RANGE BITS
---------------------------------------------------------------------
INPUTS AND 0..8191 0..1 1 GLOBAL (1)
OUTPUTS

FLAGS 0..8191 0..1 1 GLOBAL

TIMERS AND 0..1599 0..2147483647 31 GLOBAL (2)


COUNTERS

REGISTERS 0..4095 -2147483648.. 32 GLOBAL


+2147483647
or
+/-2.17101E-20..
+/-9.22337E+18

ACCUMULATOR - 0..1 1 LOCAL (3)

ARITHMETIC - 0..1 1 LOCAL (3)


FLAGS ZPNE

DISPLAY - -2147483648.. 32 LOCAL


REGISTER +2147483647

INDEX - 0..8191 13 LOCAL to


REGISTER each COB

PROGRAM 0..999999 - - LOCAL (4)


LINES

TEXTS 0..7999 0..3072 LOCAL (5)


characters

DATA BLOCKS 0..3999 0..382 32 LOCAL (6)


4000..7999 0..16383

REAL-TIME - - - GLOBAL
CLOCK

NOTE: See notes on next page.


SBUG - Page 6

NOTES:

(1) Inputs and Outputs share the same address space, whether an
address accesses and Input or an Output depends upon which
card occupies the space. On the PCD4.B900 I/O card, Inputs
and Outputs share the same address - reading from an address
returns the Input state, writing to the same address sets
the Output state.

(2) The division between which are Timers and which are Counters
is set by the "DEFTC" instruction, executed by CPU 0. Timers
may be addressed from 0 to this division, all others are
Counters. Timers are constantly decremented at a rate set by
the "DEFTB" instruction.

(3) See section 3.3.1.

(4) Program lines contain user instructions. Each CPU has its
own local code segment, the size of which is programmable in
1K blocks from the "Configure/hardware and memory" menu.
Each CPU addresses its program lines from 0 up to ((code size
in K * 1024) - 1).

(5) The amount of memory space available for texts for each CPU
is programmable in 1K character blocks from the "Configure/
Hardware and memory" menu.

(6) Data Blocks (DBs) and Texts share the same addressing. For
example if Data Block 10 defined, the Text 10 is unavailable,
and vice-versa. Texts and DBs 0..3999 are stored in the "Text
Memory" segment, and Texts and DBs 4000..7999 are stored in
the "Extension Memory" segment.

NOTE: The PCD1 has Texts/DBs 0..4999, the PCD2 has Texts/DBs 0..5999.
SBUG - Page 7

2. THE SCREEN
==============

The screen is divided into 4 sections. The top line is a title and
CPU status line, the bottom 2 lines are prompt lines, the line above
these is the command line, and the remainder of the screen is the
data display window.

2.1 Title/Status Line


----------------------

Line 1 of the screen is displayed in reverse video. It contains the


debug program's title and revision number, the connected S-BUS station
number (if S-BUS is used), the connected CPU's number, CPU type,
firmware revision number, status and an instruction pointer address if
the CPU is in Stop, Halt or Trace mode.

If no CPU is on line, the status will be "OFF LINE" and the CPU number
and type fields will contain "#" characters, since nothing can be read
from the CPU to fill these fields.

Title line example:


┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD DEBUG V2.0 Stn: 10 CPU: 0 Type: D6M1V003 Status: STOP 000000 │
└────────────────────────────────────────────────────────────────────────────────┘

Where:
V2.0 SBUG's version number ($xxx=internal release)
Stn: 10 The connected S-BUS station number, if S-BUS is
being used.
CPU: 0 The connected CPU number 0..6.
Type: The connected CPU type and firmware version.
Status: The connected CPU's operational status, see below.

"Status:" can be one of the following:

CPU State Meaning


------------------------------------------------------------------

RUN CPU is executing instructions.

CONDITIONAL RUN CPU is running but has a breakpoint set,


it is running conditionally.

TRACE nnnnnnn CPU is single stepping, executing address


nnnnnnn.

HALT nnnnnnn CPU has halted, instruction pointer (IP)


points to address nnnnnnn.

STOP nnnnnnn CPU has stopped, IP points to nnnnnnn.

COND STOP nnnnnnn CPU has conditionally stopped, IP points


to nnnnnnn, a breakpoint has been reached.

OFF LINE CPU powered off or not connected.


SBUG - Page 8

2.2 Main Display Window


------------------------

Commands, the results of commands, data, and CPU status change


messages are displayed in a scrollable main window, lines 2 to 22.
Ten screens are buffered, the main display window can be moved over
this buffer using the <PGUP>, <PGDN>, <UP ARROW>, <DOWN ARROW>,
<HOME> and <END> keys. The window can be moved at any time except
when a command is executing.

When the main display window is scrolling up, while data is being
displayed, the scrolling (and the command execution) can be paused
and restarted using the <SPACE> bar, so that the display can be
examined before it scrolls off the screen.

Whenever the status of the connected CPU changes, a message is output


to the main display window (as well as being indicated on the title
line). If a command line is being entered when the CPU status changes,
the command is overwritten by the status change message and lost. Note
that the CPU status can change by itself (Conditional Stop or Halt),
or if another CPU issues a "Restart", "Run" or "Stop" command.
SBUG - Page 9

2.3 Refresh Window


-------------------

When an element is displayed with the "Refresh" option (see section


3.5), it is placed in this window, and its value is continually
updated. The refresh window contains up to 100 lines of refreshed
data. When SBUG is exited, the contents of the refresh window are
saved in file SBUG.DAT. The refresh window contents are restored
from this file the next time SBUG is run.

This window grows down from the second line of the screen, hiding
part of the main display window. It grows until half of the main
window is covered, then begins to scroll up.

Comments can be entered in the refresh window by entering them on


the command line preceded by two semi-colons. When CR is pressed,
the comment is displayed in the refresh window.

>; ;Refresh window comment

Ctrl+key combinations are used to scroll the refresh window, to


make it bigger or smaller, to open or close it, or to delete the
last line or the entire window. Holding down the Ctrl key displays
the Refresh Window prompt (during this time any batch or command
which is executing is paused):
┌────────────────────────────────────────────────────────────────────────────────┐
│ REFRESH WINDOW: Up Down Bigger Smaller deLete Open Close Kill │
│ <PGUP> <PGDN> <HOME> <END> │
└────────────────────────────────────────────────────────────────────────────────┘

Ctrl+PGUP Moves refresh window up one page. } Page size is


Ctrl+PGDN Down one page. } window size.
Ctrl+HOME Top of refresh buffer.
Ctrl+END End of refresh buffer.
Ctrl+U Up one line.
Ctrl+D Down one line.
Ctrl+B Bigger, increases size of refresh window.
Ctrl+S Smaller, decreases size of refresh window.
Ctrl+L deLete the last line.
Ctrl+O Open refresh window.
Ctrl+C Close refresh window.
Ctrl+K Kill refresh window, deletes all entries and closes
the window.
SBUG - Page 10

2.4 Prompt Line


----------------

The prompt line can be one or two lines, it is displayed in reverse


video on lines 24 and 25, and always contains prompts. These can be
command words such as "Write", descriptions of the required input
such as "<value CR>", or a message indicating an operation is in
progress such as "WAIT".

Command words contain one upper case command character. To enter the
command word, only this single command character needs to be typed,
see section 3.1.

Descriptions of information to be entered, or descriptions of single


keys or key sequences, are shown on the prompt line enclosed in angle
brackets "<...>". An optional entry is enclosed in square brackets
"[...]".

Examples:

<CR> Carriage return (Enter) key.


<ESC> ESCape key.
<value SP> Numeric value followed by a space.
<number CR> Numeric value followed by carriage return
key.
< [filename] CR> Optional file name, followed by carriage
return (CR).

<mnemonic [mc] [operand]] CR>


This means one of the following entries is valid:
mnemonic mc operand <CR> e.g. STH I 0
mnemonic mc <CR> e.g. ACC H
mnemonic operand <CR> e.g. COB 0
mnemonic <CR> e.g. ECOB

2.5 Command line


-----------------

The command line is indicated by a ">" prompt. The cursor is always


on this line if awaiting a new command, or during entry of a command.
As a command is entered, the command words are displayed on this
line. See section 3.1 for details of command entry.
SBUG - Page 11

2.6 Keyboard and Function Keys


-------------------------------

When the cursor is on the command line, these keys can be used:

PGUP Moves the display window up one page, a buffer


holds up to 10 pages.
PGDN Down one page.
UP ARROW Up one line.
DOWN ARROW Down one line.
HOME Top of display buffer.
END End of display buffer.
SHIFT+PRTSC Prints the screen.
DEL, BACKSPACE Deletes previous character on command line.
ESC Deletes the command line or aborts any command
or batch which is executing.
ENTER Executes the command. If no command has been
entered, the previous command is recalled and
executed.
SPACE Pauses any command or batch being executed.
+ Recalls the last command entered so it can be
edited.
F1 Displays the help index or context-sensitive
help on a partially entered command.
F9, F10 Recall commands from command the buffer (the
last 10 commands are stored).
F2..F8, Function keys execute the batches named "F2",
F11..F40 "F3" etc. see below.
CTRL+keys Control keys control the refresh window, see
section 2.3.

The function keys F2..F8 and F11..F40 execute the batch files named
"F2", "F3", "F11" etc. if they exist. This provides an easy way to
assign common commands to function keys, see section 3.7 for details.
SBUG is supplied with a default batch file (named SBUG.DBA) which
defines the keys F2..F8. This batch file is automatically loaded when
SBUG is started and defines the keys as follows. (The definitions for
keys F1, F9, F10 are fixed, batches cannot be assigned to them).

╔═════╤═════╗
HELP ║ F1 │ F2 ║ QUIT
╟─────┼─────╢
PRINT ENABLE ║ F3 │ F4 ║ PRINT DISABLE
╟─────┼─────╢
RUN ║ F5 │ F6 ║ STOP
╟─────┼─────╢
FILE DIRECTORY ║ F7 │ F8 ║ RESTART COLD ALL-CPUS
╟─────┼─────╢
RECALL PREVIOUS COMMAND ║ F9 │ F10 ║ RECALL NEXT COMMAND
╚═════╧═════╝
SBUG - Page 12

3. COMMANDS
============

3.1 Entering Commands


----------------------

The first (top level) prompt line displayed depends upon the CPU
state, since certain commands may not be permitted (e.g. Trace when
the CPU is in Run).

The top level prompts show all the valid commands. There are six
possible top level prompt lines.

The first prompt is used when the CPU is in Stop:


┌────────────────────────────────────────────────────────────────────────────────┐
│ Run Stop Trace Display Write Instruction Batch Clear rEstart Locate │
│ Print File Help cOnnect broAdcast Quit │
└────────────────────────────────────────────────────────────────────────────────┘

The second prompt is used when the CPU is in Run:


┌────────────────────────────────────────────────────────────────────────────────┐
│ Run Stop Display Write Batch Clear rEstart Locate Print File Help │
│ cOnnect broAdcast Quit │
└────────────────────────────────────────────────────────────────────────────────┘

The third prompt is used when creating a command batch with the "Batch
Write" command (see section 3.7). It contains only those commands that
are valid within a command batch, and an additional command to end the
batch write:
┌────────────────────────────────────────────────────────────────────────────────┐
│ eNdbatch Run Stop Trace Display Write Instruction Clear rEstart │
│ Locate Print File Help cOnnect broAdcast Quit │
└────────────────────────────────────────────────────────────────────────────────┘

The fourth prompt is also used when writing a command batch, when 99
lines have already been entered, the last one must be an "eNdbatch"
command (command batches can contain a maximum of 100 lines):
┌────────────────────────────────────────────────────────────────────────────────┐
│ eNdbatch │
└────────────────────────────────────────────────────────────────────────────────┘

The fifth prompt is used when editing a command batch, <ESC> ends the
edit without storing an "eNdbatch" command, see section 3.7.
┌────────────────────────────────────────────────────────────────────────────────┐
│ <ESC> eNdbatch Run Stop Trace Display Write Instruction Clear rEstart │
│ Locate Print File Help cOnnect broAdcast Quit │
└────────────────────────────────────────────────────────────────────────────────┘
SBUG - Page 13

Finally, the sixth prompt is used when the connected CPU is halted, or
after a program line has been inserted or deleted. The "Run", "Stop",
"Trace" and "Instruction" commands are not permitted. To allow these
commands, a "rEstart" must first be done.
┌────────────────────────────────────────────────────────────────────────────────┐
│ Display Write Batch Clear rEstart Locate Print File Help cOnnect │
│ broAdcast Quit │
└────────────────────────────────────────────────────────────────────────────────┘

A command is entered by typing the upper case command letter. If the


desired command is "Run", typing "R" displays the entire word "Run"
on the command line. At this point, the prompt line changes to another
set of prompts, indicating the next set of valid entries. For example,
after pressing "R", the new prompt line will be:
┌────────────────────────────────────────────────────────────────────────────────┐
│ From To Until Count <cpu number 0-6> All-cpus <CR> │
└────────────────────────────────────────────────────────────────────────────────┘

These are the options for the "Run" command. If one of the upper case
"F", "T", "U", "C" or "A" keys is pressed, the word is displayed on
the command line, and the next prompt is displayed. If a CPU number
key 0-6 is pressed, the number is displayed on the command line and
the next prompt appears.

For example, the user may type the following 11 keys:

RF0<SP>UR1<SP>E7<CR>

Where: <SP> is a space and <CR> is carriage return.


(The space is needed as a delimiter to end numeric entry).

This is what is displayed on the command line:

>Run From 0 Until Register 1 Equals 7

The path of this command may be seen from the "Run: command diagram
in section 5. The final prompt is:
┌────────────────────────────────────────────────────────────────────────────────┐
│ <value CR> │
└────────────────────────────────────────────────────────────────────────────────┘

This prompts the user for the value for which Register 1 is to be
checked, followed by a carriage return <CR> to enter the command.

During the typing of a command the user can go back a step by pressing
either the backspace <- or the <DEL> key. This deletes the last word
displayed, and restores the previous prompt. If entering a number,
the last digit typed is deleted.
SBUG - Page 14

Entering Commands Continued


---------------------------

When the command line is empty, pressing <CR> repeats the previous
command, or pressing <+> recalls the previous command to allow editing.
To delete the entire command line press <ESC>.

Depression of any invalid keys is indicated by the beeper sounding.

Values entered on the command line are checked when <CR> is pressed.
If a value is incorrect, an error message is displayed. See section 4.

Function keys F2..F40 execute the batches named "F2" to "F40", see
section 3.7.
*** NOTE ***
If no PCD is on line, the response to key depressions may be slow
because SBUS spends time waiting for responses to communications
messages.

3.1.1 Command Summary


----------------------

Run Puts any CPU into Run, with optional breakpoints.

Stop Puts any CPU into Stop.

Trace Single steps through a program.

Display Displays data or puts data in the "refresh window".

Write Writes data.

Instruction Executes a single instruction in the PCD.

Clear Clears elements, or deletes program, text or


extension memory.

rEstart Gives any CPU a reset.

Locate Searches PCD memory for instructions or operands.

Print Controls output to a printer or log file.

File Loads or saves programs or individual blocks.

Help Displays the help index.

cOnnect Selects a Cpu or S-BUS station for debugging, and


can also analyse an S-BUS network.

broAdcast Sends a command to every station on an S-BUS network.

Quit Exits SBUG.

Batch Sequences of debug commands can be entered and run


as a single batch or assigned to a function key.

eNdbatch Marks the end of a batch of commands.


SBUG - Page 15

3.2 Run
--------

The "Run" command can set any CPU into Run mode, so that it begins
executing instructions. The "Run" command is not available if a
"rEstart" command is needed.

One or two breakpoints, with an "Or" condition between them can be


given. The breakpoints can be on the value of an element, an address,
after a certain number of instructions (Count), or on a specific
instruction or block. See below.

When the CPU is running with a breakpoint set, the CPU is said to be
in "Conditional Run" mode and the RUN lamp blinks. When a breakpoint
condition is satisfied, the CPU goes into "Conditional Stop", and the
next instruction (NOT executed yet) is displayed, marked with a "*".
The breakpoint will not occur again unless the run command is re-
entered. Breakpoints are removed if the connected CPU status changes,
if it stops or halts etc.

If a start address is specified using "Run From", the start address


MUST be within the current block (COB, XOB, PB etc), and it must be
within the code segment of the connected CPU. If not, the command is
not accepted. The Instruction Pointer cannot be moved into another
code block because at the end of the new block it would execute a
return from the original block (the internal stack is incorrect).

Since some instructions occupy more than one location in memory, a


breakpoint on an address (using "Run To" or "Run Until instruction-
Pointer" MUST be on the address of the instruction's mnemonic (the
first line of the instruction).

"Run Count" allows a given number of instructions to be executed,


where the count is the number of complete instructions, NOT
instruction lines (some instructions occupy more than one line).
"Run To" allows a destination to be given, as an address, a block
number (e.g. "Run To Pb 32"), or "Run To End-of-block".

BREAKPOINT ELEMENT VALUE AND CONDITION


---------------------------------------------------------------------
Accumulator 1, 0.
Status-flag Zero, nOn-zero, Positive, Negative or Error.
Input 1, 0.
Output 1, 0.
Flag 1, 0.
Timer Equal to, Not-equal-to, Greater-than, Less-than
the Decimal, Bcd, Hex or binarY value.
Display-register ''
iNdex-register ''
Register Equal to, Not-equal-to, Greater-than, Less-than
the Decimal, Bcd, Hex, binarY, Floating-point
or Ascii value.
instruction-Pointer Instruction address, must point to a mnemonic
line. "Run To <address>" can also be used.
instruction-Line A complete instruction line, e.g. "STH I 1",
"FB 0".
Mnemonic An instruction mnemonic only, e.g. "STH", "FB".
Count Executes the given number of instructions.
Cob/Xob/Pb/Fb/St/Tr "Run To" any block.
End-of-block "Run To End-of-block".
SBUG - Page 16

Run Continued
-------------

While waiting for the breakpoint, the program will be executing at


about 75% of its usual speed. Therefore care must be taken if running
speed-sensitive code (communications etc), this may prevent the
program from executing properly.

The "Run Xob" command is available only if S-BUS communications is


being used. XOB 16, 17 or 18 in the connected CPU can be executed,
providing the CPU is in Run or Conditional Run. (The feature requires
the latest PCD firmware).

Here are some examples of the "Run" command:

Run (Connected CPU runs from present)


(address. )

Run 1 (CPU 1 is put into Run.)

Run From 1024 To 1037 (Connected CPU runs from address 1024 )
(up to but not including address 1037.)
(It stops with its Instruction Pointer)
(equal to 1037, address 1037 has not )
(yet been executed. )

Run Until Input 1 0 (Connected CPU runs from present addr-)


(ess until input number 1 is 0 (low). )

Run Until Mnemonic FB (Stops when next FB is reached. )

Run Until instruction-Line FB 0


(Stops when FB 0 is reached. )

Run Count 100 (Connected CPU executes 100 instruct-)


(ions from the present address. )

Run Until instruction-Pointer Equals 123


Run To 123 (These are functionally the same)

Run To Pb 32 (Runs until PB 32 is called)

Run To End-of-block (Runs to the end of the current block)

Run Xob 17 (Executes XOB 17 in the connected CPU)

Refer to the syntax diagrams in section 5 for further details.


SBUG - Page 17

3.3 Trace
----------

The connected CPU can be single stepped one or more times with this
command. An optional start address "From", end address "To" or a
number of steps "Count" can be supplied. "Trace forEver" traces
until aborted by pressing ESCape. This command is available only if
the CPU is in Stop or Conditional Stop.

As each instruction is executed, its address, the instruction, the


effective operand address (if indexing, a relative jump or an FB
parameter reference), the contents or state of the element ref-
erenced by the operand, the Arithmetic Status flags and the Index
Register value are displayed. These are their values AFTER the
instruction is executed (for the CFB instruction, the FB parameters
are their values BEFORE the FB is called).

The speed of the CPU is governed by the speed that the data can be
read and displayed, it will be running thousands of times slower
than normal. Thus "Trace" should be used carefully for time-sensitive
applications (communications etc.)

The "Trace Mode" option controls the context switching between COBs
and XOBs. When the mode is ONE BLOCK, the "Trace" command single-
steps through the current COB or XOB only. When the end of the block
is reached, the trace continues from the beginning of the same block.
Other COBs will not be executed, even if NCOB instructions are found.
When the trace mode is ALL BLOCKS, when the end of an XOB or COB is
reached, or an NCOB instruction is executed, the trace continues from
the start of the next block.

The "Trace No-calls" option is used to skip the tracing of sub-block


calls (CFB, CPB and CSB). The block calls are actually executed, but
the instructions are not listed on the screen. This is done by
executing a "Run To <address>", where the address is that of the
next instruction after the call. It is possible that the return from
the call will never occur (if the called block waits or loops) and
the next address will never be executed. If this happens, ESCape can
be pressed to abort the trace.

"Trace To" stops at the given address or start of the given block
WITHOUT executing it.

Some instructions are executed only if the Accumulator is High (1).


For these instructions, a "*" is displayed immediately in front of
the mnemonic if the instruction was NOT executed because the Accu-
mulator was Low (0). This affects these instructions:

COM, SET, RES, SETD, RESD.


LD, LDL, INC, DEC - ACCU dependent only if accessing a Timer

For indexing instructions, the actual element value referenced


(the operand value + Index Register value) is shown in brackets
after the operand.

For Jump Relative (JR) instructions, the absolute (actual) address


is shown in brackets after the relative address.
SBUG - Page 18

Trace Continued
---------------

When the instruction is disassembled for display, an error message


is displayed on the same line if the line is invalid.

By using the "Trace" command in conjunction with the 10 page screen


memory it is possible to see a trace of around 200 instructions.
The "Print" command can be used to obtain a printout of any length
of trace.

The <SPACE> bar pauses the trace, <ESC> aborts.

For instructions which reference an element (I|O|F|R|T|C), the value


of the element is displayed in square brackets on the operand line.
For instructions which reference Registers containing floating point
values (FADD, FSIN, IFP etc), the values are automatically displayed
in floating point units.

NOTE: The value displayed is read momentarily AFTER the instruction


is executed (except for CFB parameters). Sometimes the value can
change between when it was read and when the instruction is executed.
This sometimes happens for Timers which are decremented independently
of instruction execution, or if the element is changed by another CPU
which is in Run.

Sometimes it is desirable to see the next instruction before it is


executed, to do this, the command "Trace Count 1" can be used. This
single steps one instruction, and displays the next unexecuted
instruction.

While tracing, the prompt line is:


┌────────────────────────────────────────────────────────────────────────────────┐
│ TRACE: <SPACE> pauses, <ESC> aborts. │
└────────────────────────────────────────────────────────────────────────────────┘

In the Trace example below, four instructions (Count 4) have been


executed, the instruction at 1027 marked with "*" in the first column
has not yet been executed. The Arithmetic Status flags, contents of
the operand and the Index Register values are their values AFTER the
instruction has been executed, except for the last instruction (marked
with "*"), which has not been executed yet.

Accu and Status flags


Adds Mnemonic MC Operand | Index Register value
| | | | | Current block
>Trace From 185 Count 4 | |
000185 JR 839 (1024) A0 Z1 N0 P1 E0 IX2 PB0
001024 STH T|C 100 [9876] A1 Z1 N0 P1 E0 IX2 PB0
001025 ANHX = 1 (F 12) [0] A0 Z1 N0 P1 E0 IX2 PB0
001026 *SET I|O 0 [0] A0 Z1 N0 P1 E0 IX2 PB0
*001027 SETX F 10 (12) [1] A0 Z1 N0 P1 E0 IX2 PB0
>_ | | |
| | | +- Operand value (decimal/floating pnt).
| | +-- Absolute values for relative and indexed
| | operands or FB parameters (e.g. F10+2 = F 12)
| +------ "*" is instruction NOT executed indicator (ACCU=L).
+------ "*" in this column indicates this is the next instruction.
SBUG - Page 19

3.3.1 Accumulator and Arithmetic Status


----------------------------------------

Each CPU has an Accumulator and four Arithmetic Status flags:

A Accumulator.

Z Zero flag, 1=zero, 0=non-zero.

N Negative sign flag, 1=negative, 0=positive.

P Positive sign flag, the opposite of the N flag.

E Error flag, 1=error, 0=no error. "Error" means there


has been an overflow, underflow or divide by zero.

Each COB has its own independent Zero, Negative, Positive and Error
flags. Each code block, COB, PB, FB, SB, ST and TR has its own Accu-
mulator. Whenever a code block is called, the existing Accumulator
is saved, and the new Accumulator is set to 1. On return from the
block, the original Accumulator is restored.

The values of these flags can be seen using the "Display Accu"
command, and during "Trace" command execution.

3.4 Stop
---------

Any CPU may be stopped by entering the command:

Stop <CR> Stops the connected CPU.

Stop n <CR> Stops CPU 'n'. An error message is displayed


if CPU 'n' doesn't exist.

This command stops the CPU at the start of the NEXT instruction,
jut as if a breakpoint had been reached.

A "Stop" command may be issued if the CPU is already in stop mode,


but is illegal if the CPU is in Halt (a "rEstart" must be done).

When the connected CPU goes into Stop mode, the next (unexecuted)
program line is displayed. A "*" indicates that this instruction has
not been executed yet. The arithmetic status flags, index register
and block number shown are the values BEFORE the instruction is
executed.

>Stop
STOPPED
*001029 STL I|O 40 A0 Z1 N0 P1 E0 IX2 PB0
>_
SBUG - Page 20

3.5 Display Commands


---------------------

The "Display" command displays one or more of any of the elements,


listed in section 1.3, in selectable units.

Certain data types can also be refreshed by giving the "Refresh"


option in the command, see the table below. This means that the data
is placed in the refresh window, and is continually updated on the
screen, see section 2.3. If not refreshed, data values are displayed
in the main window, and are only snapshots of the elements' values.

The "Display Program ... Refresh" is a special case, the data is not
displayed in the refresh window, but on the main display, see section
3.5.4.

While data is being read and displayed, the prompt "<SPACE> pauses,
<ESC> aborts" is displayed. If a long display command is in progress,
this can be paused or aborted.

All elements can be read while the CPU is in Run.

Selectable display units are:

Element Refresh Default Units Alternative Units


-----------------------------------------------------------------
Accumulator and
Arithmetic Status No Binary None.
Input Yes Binary Bcd (4 bits/digit),
Hex (4 bits/digit).
Decimal (up to 32 bits).
Output Yes '' ''
Flag Yes '' ''
Register Yes Decimal Bcd, Hex, Binary,
Floating-point, Ascii.
Counter Yes Decimal Bcd, Hex, Binary.
Timer Yes '' ''
Display-register Yes '' ''
iNdex register No '' None.
teXt No ASCII Decimal, Hex.
Program Yes See 3.5.4
data-Block No Decimal Bcd, Hex, Binary,
Floating-point, Ascii.
clocK Yes See 3.5.6
Exec-path No See 3.5.13
s-bUs No See 3.5.14

Several elements can be displayed with one command, by using the


"To" or "Count" options, for example:

Display Input 0 To 99
Display Input 0 Count 100

Both these commands have the same effect, and display Inputs 0..99.
SBUG - Page 21

3.5.1 Display Accumulator


--------------------------

Displays the present Accumulator, Arithmetic Status flags, Index


Register and current block:

>Display Accu
A0 Z0 N1 P0 E1 INDEX 12 COB 2
>_

3.5.2 Display Inputs, Outputs and Flags


----------------------------------------

Inputs, Outputs and Flags are all binary elements and are displayed
in the same way. Inputs and Outputs share the same addressing space,
0..8191 (PCD6) or 0..511 (PCD4), therefore the "Display Input" and
the "Display Output" commands display the same elements.

A range of addresses can be given, using "To" or "Count". The display


units can be specified as binary (the default), Bcd, Hex or Decimal.
The order in which they are displayed (ascending or descending) can
also be specified.

The "Refresh" option is available, so that elements are displayed


in the Refresh Window where their values are continually updated.

For Hex, Bcd and Decimal displays, the order in which elements are
displayed defines the most significant and least significant bits or
digits.

Hex, Bcd and Decimal Display - Most/Least Significant Bits or Digits:


----------------------------

Elements can be displayed in either descending order with the lowest


addressed bit as the least significant bit or digit (the default,
which matches the DIGI and BITI instructions), or in ascending order
with the lowest addressed bit as the most significant bit (as in the
PCA, which matches the DIGIR and BITIR instructions). How they are
displayed depends on the order of the addresses given in the command.
The rule is:

THE FIRST ADDRESS IS ALWAYS THE LEAST SIGNIFICANT BIT OR DIGIT

If the lowest address is first, e.g."From 32 To 63", then the lowest


address is the least significant bit. If the highest address is first,
e.g."From 63 to 32" then the highest address is the least significant
bit.

If "Count" is used, the given address is ALWAYS the least significant


bit.

When displayed in Bcd or Hex, each Bcd or Hex digit is made up of


FOUR consecutive binary bits. The "To" and "Count" options must give
the correct number of bits. For example, "Display Input 0 To 7 Bcd"
indicates 8 bits, which is two Bcd digits. If the display units are
Bcd or Hex, the number of bits must be a multiple of 4.

"COUNT" ALWAYS REPRESENTS THE NUMBER OF BITS (NOT DIGITS)


SBUG - Page 22
Display Inputs, Outputs and Flags Continued
-------------------------------------------

For example, to display 4 Bcd digits (16 bits), with the most signifi-
cant digit on Inputs 47..44 and the least significant digit on Inputs
35..32:

>Display Input 32 Count 16 Bcd


7654 3210 9876 5432 (bit addresses, I 32 is the LS bit)
0047: 0001 0010 0011 0100 (start address and binary data)
1 2 3 4 (Hex data)

If 4-bit a Bcd value is greater than 9 (1001 binary), then it is


displayed in Hex, therefore the Bcd and the Hex displays are the same.

Display in Decimal units:


------------------------

The decimal display is useful for A/D and D/A convertors which might
reside in the I/O area. The address range is the convertor's data
width (8-bit, 12-bit etc). Up to 32 bits can be displayed in decimal.
The binary value of the bits is converted to an unsigned decimal
value. The first address given in the command is always the least
significant bit.

If "Count" is used, the the lowest addressed bit is the least


significant bit:

>Display Output 64 Count 16 Decimal


0079-0064: 255 (16-bit value is 00FF hex)

If "To" is used, the lowest addressed bit is the most significant bit
only if the highest address is given first:

>Display Output 79 To 64 Decimal


0064-0079: 65280 (16-bit value is FF00 hex)

More examples: These show how to control most/least significant bits.


-------------
>Display Input 0 To 31
0123456789 0123456789 0123456789 01 (binary, ascending
0000: 1000010011 0000100001 0010001101 00 order)
>Display Input 0 Count 32
0123456789 0123456789 0123456789 01
0000: 1000010011 0000100001 0010001101 00 (same as above)
>Display Input 31 To 0
10 9876543210 9876543210 9876543210 (binary, descending
0031: 00 1011000100 1000010000 1100100001 order)
>Display Input 0 To 31 Bcd
1098 7654 3210 9876 5432 1098 7654 3210 (Input 0 is LS bit
0031: 0010 1100 0100 1000 0100 0011 0010 0001 of LS digit)
2 C 4 8 4 3 2 1
>Display Input 31 To 0 Bcd
0123 4567 8901 2345 6789 0123 4567 8901 (Input 0 is MS bit
0000: 1000 0100 1100 0010 0001 0010 0011 0100 of MS digit, as
8 4 C 2 1 2 3 4 in the PCA)
>Display Input 0 Count 8 Decimal
0007-0000: 33 (Input 0 is LS bit)
>Display Input 7 To 0 Decimal
0000-0007: 132 (Input 0 is MS bit)
SBUG - Page 23

3.5.3 Display Registers, Timers and Counters


---------------------------------------------

Registers, Timers and Counters are all 32-bits in length and are
displayed in the same way. Timers and Counters share the same
addressing space (see DEFTC instruction), the "Display Timer" and
the "Display Counter" commands display the same elements.

A range of addresses can be given, using "To" or "Count". The display


units can be specified as Decimal (the default), Bcd, Hex or binarY.
Floating Point and Ascii units are also available for Registers only.
The order in which they are displayed (ascending or descending) can
also be specified. The "Refresh" option is available so that elements
are displayed in the Refresh Window and their values are continually
updated.

Bcd values show both the binary and the Bcd representation of the
value, with the most significant bit/digit first.

Ascii values are displayed as 4 Ascii characters, since a 32-bit


Register contains 4 bytes. The first character is the most
significant byte (bits 31..24) the 4th character is the least
significant byte (bits 8..0). Control codes and non-ASCII characters
with codes greater than 127 are displayed as IBM graphics characters
(e.g. │ ┐ ░ ä).

Binary values are displayed most significant bit first (bit 31..0).

Examples:

>Display Register 0 Ascii


0000: ' ? K'
>Display Register 0 Bcd
0000: 0000 0000 0001 0010 0011 0100 0101 0110 0111 1000
0 0 1 2 3 4 5 6 7 8
>Display Register 0 binarY
0000: 0000 0000 1011 1100 0110 0001 0100 1110

The binary value shown in the "Bcd" display and the binary of the
"binarY" display are not the same. This is because the binary
display shows the actual binary contents of the Register, Counter
or Timer. The Bcd value is the binary value after conversion to a
positive 10-digit decimal number, each digit is then converted to
4-bit binary to provide the Bcd data.
SBUG - Page 24

3.5.4 Display Program


----------------------

This command disassembles and displays program lines from the


connected CPU's memory. A start address or block number and an
optional end address or number of lines to display can be specified
using "To" or "Count". If no address range is given, the program is
displayed to the end, or until <ESC> is pressed to abort it or
<SPACE> is used to pause.

All types of invalid instruction are detected, an error message is


shown next to the invalid instruction line in error if an error is
found. See section 4.2 for error messages. If invalid instructions
are executed by the CPU, the program will not run correctly.

For Jump Relative (JR) instructions, the absolute (actual) address


is shown in brackets after the relative address.

>Display Program Pb 23 Count 5


000123 PB 23
000124 STH I|O 0
000125 SET I|O 32
000126 STL I|O 2
000127 XOR F 0
000128 JR L -2 (126)
>_ |
+------- Absolute address for
JR instructions

See section 3.3 for a description of the displayed fields.

Display Program ... Refresh


---------------------------

This command can also be given with the "Refresh" option, for
example:

Display Program 0 Refresh


Display Program 124 To 129 Refresh

When this option is used, the program is displayed as above, but it


is single stepped on the screen, updating the Accumulator, Arithmetic
Status Flags, Index Register and operand values as for the "Trace"
command (see section 3.3). An "instruction executed" indicator (▌)
is displayed on the left of the screen as each instruction executes.

To use the "Refresh" option, the CPU must be in Stop or Run. If in


Halt, a "rEstart" must be done first. If the CPU halts during the
refresh then the command is aborted.

It is only possible to display one refreshed block (COB, PB, FB, ST


etc) at a time. The display is automatically ended at the end of the
block.
SBUG - Page 25

Display Program Refresh - Continued


-----------------------------------

In order for the program to be refreshed, a breakpoint is set at the


first line to be refreshed (at the address given by the "Display
Program <address>" command). Once this breakpoint is reached, the
program is single-stepped as in Trace mode, and the screen is updated.
Because of this, the first address MUST be executed. If a jump causes
execution to begin after the first address, the breakpoint will never
be reached, and the display will never be refreshed even though the
code is being executed.

A maximum of 200 program lines can be refreshed. During the refresh,


the <UP ARROW>, <DOWN ARROW>, <PAGE UP> and <PAGE DOWN> keys can be
used to scroll the display up and down. Since the refresh is rather
slow, it is better to display small sections of the program, say up
to 20 lines.

*** NOTE ***

While the program is being refreshed (single-stepping), about 12


instructions are executed per second. While waiting for the breakpoint
at the first address, the program is executing at about 70% of its
usual speed. Therefore care must be taken if displaying speed-sensitive
code (communications etc), this may prevent the program from executing
properly.
SBUG - Page 26

3.5.5 Display Text


-------------------

Texts belonging to the connected CPU can be displayed in Ascii (the


default), Hex or Decimal units. In Hex or Decimal, the Ascii is also
shown. If the text doesn't exist (is empty) in the connected CPU, or
is in use as a Data Block (BD), then a message is displayed. A "To"
or "Count" range can be given.

If Ascii text display is requested, any unprintable characters are


displayed as decimal values (1..255) surrounded by angle brackets,
e.g. <10>. Each line of text is enclosed in double quotes ".." so
that leading and trailing spaces can be seen.

If text is displayed in Hex or Decimal, the ASCII character is shown


above its Hex or Decimal value. If the character is not printable,
only the Hex or Decimal value is shown.

If a carriage return character is found in the text <13>, a new line


is started on the text display, this improves readability. Therefore,
when ending a line with a line feed/carriage return <10><13>, the
carriage return should be last to produce a better text display.

>Display teXt 0
0: "Text Zero. <10><13>"
>Display teXt 0 Decimal
0: T e x t Z e r o . . .
084 101 120 116 032 090 101 114 111 046 032 010 013
>Display teXt 0 Hex
0: T e x t Z e r o . . .
54 65 78 74 20 5A 65 72 6F 2E 20 0A 0D
>Display teXt 1 Count 3
1: TEXT NOT DEFINED
2: TEXT IN USE AS DATA BLOCK
3: "Hello world!"
>_

3.5.6 Display Clock


--------------------

Displays the contents of the PCD's real-time clock. All CPUs in


the same rack share the same clock.

>Display clocK
11/04/93 11:31:59 WEEK 23 DAY 5

The format is:

dd/mm/yy hh/mm/ss

WEEK is the week of year number 1-53


DAY is the day of the week 1-7 (1=Monday, 2=Tuesday ... 7=Sunday)
SBUG - Page 27

3.5.7 Display Index Register and Display Display-register


----------------------------------------------------------

"Display iNdex-register" displays the Index Register of the current


COB or XOB in decimal units only. The Index Register cannot be
displayed if the connected CPU is in Run or Conditional Run. Each
COB or XOB has its own Index Register. There is no "Refresh" option
for this command. The Index Register value can also be displayed
using the "Display Accu" command.

>Display iNdex-register
12
>_

"Display Display-register" displays the contents of the connected


CPU's Display Register in Decimal, Hex, Bcd or binarY units. The
Display Register is often used to indicate the state of a process
to contain an error code. It is loaded with the DSP instruction.

>Display Display-register
10
>Display Display-register Hex
0000000A
>Display Display-register Bcd
0000 0000 0000 0000 0000 0000 0000 0000 0001 0000
0 0 0 0 0 0 0 0 1 0
>_
SBUG - Page 27a

3.5.8 Display cpu-Status


-------------------------

Displays the status and firmware version of all CPUs in the


system, including the LAN2 and PCD8.P800, if fitted. It also
shows the factory-set "production information" for the connected
CPU, if available.

The status can be:

RUN CPU is running


STOP CPU is stopped (may be conditional stop)
HALT CPU is halted
CONDITIONAL RUN CPU is in conditional run
NOT CONNECTED CPU is not present (or is faulty)

Example for a PCD6:

>Display cpu-Status
CPU 0 RUN PCD6.M1 006
CPU 1 STOP PCD6.M2 006
CPU 2 HALT PCD6.M2 006
CPU 3 NOT CONNECTED
CPU 4 NOT CONNECTED
CPU 5 NOT CONNECTED
CPU 6 NOT CONNECTED
LAN2 RUNNING V001, STATION 12
P800 V002
PRODUCTION INFORMATION FOR CPU 0
System ID: M220 (02h)
Hardware version: H (48h)
Modifications: 1,2,3 (07h)
Fab. date (year/week): 1998/01
>_

NOTE: For the PCD1, PCD2 and PCD6.M5, only one CPU is shown. For the
PCD4, two CPUs are shown.
SBUG - Page 28

3.5.9 Display Memory-map


-------------------------

Shows the memory allocation and the amount of used and available
memory for all possible CPUs in the system, including the LAN2.
The PCD6 shows 6 CPUs, the PCD4 shows 2, and the PCD1, PCD2 and
PCD6.M5 show one.

The memory configuration is defined on the "Configure/Hardware and


memory" menu, set up by the downloader. Example:
>Display Memory-map
│PROGRAM │ CODE SIZE (Lines) │ TEXT SIZE (Bytes) │ EXTN SIZE (Bytes) │
C│NAME │ SEG USED FREE│ SEG USED FREE│ SEG USED FREE│M
─┼────────┼─────────────────────┼─────────────────────┼─────────────────────┼──
0│TEST │ 56K 14 57230│ 32K 0 32768│ 768K 0 786432│
1│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│
2│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│
3│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│
4│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│
5│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│
6│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│
CODE/TEXT MEMORY: RAM, 256K Bytes EXTENSION MEMORY: 768K Bytes
LAN2 STATION: 10 F/W VERSION: V001

CODE SEG The code segment size in K lines (1K=1024 lines).


CODE USED The number of program lines actually used. The next
free program line is at this address.
CODE FREE The number of remaining program lines.
NOTE: For CPU 0, this value also reflects the 100
lines used for the PCD's header and any lines used
for the PCD's extended header. CPU 0's CODE USED
value does not show the lines used by the headers.

TEXT SEG The text segment size in K characters (1K=1024 chars).


TEXT USED The number of text characters used. Note that for each
text there is an overhead of 3 characters.
TEXT FREE The number of remaining text characters.
NOTE: Data Blocks also share Text memory.

EXTN SEG The extension memory segment size in bytes.


EXTN USED The number of bytes of extension memory used.
EXTN FREE The number of bytes remaining in extension memory.
NOTE: Thes are not displayed if no extension memory
is configured.

PROGRAM NAME The name of the loaded program, from the .PCD file name.

M If the code or text in memory has been changed using


the "Write Program" or "Write teXt" commands, this
will be "*". If the code and text has not been changed,
thsi will be blank. This indicates whether the code
and texts in the PCD match the code and texts in the
original .PCD file and .SRC files.
SBUG - Page 28a

*** HEADER NOT INITIALIZED ***


This message is displayed if the CPU's header is
uninitialised because the CPU is not present if RAM
memory, or because EPROM memory has not been programmed
for this CPU, or because memory has not been allocated
using the Loader.

If the SEG value is 0K, then no code/text/extension memory partition


exists for that CPU.
SBUG - Page 29

3.5.10 Display History


-----------------------

Displays the "Halt Reason" and the "History Table". The Halt Reason
is written when the CPU halts, it is also written on power-up,
indicating the date and time of the power-up. Whenever the CPU
detects an error, an entry is written into the circular History
Table, which holds the last 12 errors in locations 0..11. Locations
12..15 count the number of battery fails, Index Register overflows,
I/O quit failures and the number of times the Error flag has been
set.

The History Table can be cleared using the "Clear History" command.
A list of messages and their meanings can be found in section 4.3.

Example:

Halt Reason.
>Display History |
000123 HALT INSTRUCTION 19/03/89 16:45:02 <---+
00 000022 BUS QUIT FAILURE 22/01/88 09:14:32
01 100D4500 BUS QUIT FAILURE 23/02/88 16:43:19
02 97520018 PARITY ERROR 23/02/88 16:44:02
03 00010000 HEADER FAIL 23/02/88 16:45:00
04 00000000 NO PROGRAM 26/03/88 12:35:08
05 008123 IR OVERFLOW 01/04/88 02:48:57
06 009044 INVALID OPCODE 02/05/88 19:32:42
07 FFFFFFFF 68k INVALID OPC 19/06/88 14:13:12
08 00002BED CHECKSUM FAIL 20/07/88 01:16:17
>>09 0002A00F BATT FAIL 12/09/88 16:35:47
| 10 EMPTY
| 11 EMPTY
| 12 0002A00F BATT FAIL 002 19/06/90 14:32:57
| 13 008123 IR OVERFLOW 378 25/05/90 10:16:32
| 14 00F43765 IO QUIT FAIL 001 14/03/89 00:01:19
| 15 000201 ERROR FLAG 129 19/07/90 12:33:49
| | | | | |
| | | | | |
| | | | | |
| | | | | +---- Date and time of error
| | | | +--------- Number of occurrences
| | | +---------------------- Error description
| | |
| | +-- Address where the error occurred. If this is 6 digits,
| | then it's a user program line number in decimal,
| | usually number of the line AFTER the instruction which
| | caused the error. If this is 8 digits, then it's a
| | hexadecimal internal processor address. If the location
| | has never been written to, it contains the text "EMPTY".
| |
| +------ History Table position, 00..15. Entries 00..11 are
| a circular buffer holding the last 12 errors. Entries
| 12..15 count the specific errors shown above.
|
+-------- The ">>" pointer indicates the latest entry in the
table.
SBUG - Page 30

3.5.11 Display Data-block


--------------------------

A "Data Block" (DB) is a block of memory which can contains one or


more 32-bit Register values. Data Blocks 0..3999 are available in
the text memory segment, and can hold up to 383 Register values
(elements 0..382). DBs 4000..7999 are available only if extension
memory is present, and can hold up to 16384 Register values
(elements 0..16383). Data Blocks are local to each CPU.

Data is copied from Registers into the DB using the PUT instruction,
and is copied from the DB back into the Registers using the GET
instruction. PUT and GET copy the entire DB, so the number of
Registers transferred by PUT and GET depends on the DB size.

Data Blocks can be displayed in Decimal (the default), Bcd, Hex,


Floating point or Ascii units, with the Refresh option if required.
(Note that the refresh window buffer only holds 100 lines, so DBs
larger than this will scroll off the top of the buffer.

>Display data-Block 2
2 (0): 2147483647 2147483647 2147483647 2147483647
2147483647
2 (5): 2147483647 2147483647 2147483647 2147483647
2147483647
>Display data-Block 3 Bcd
3 (0): 0010 0001 0100 0111 0100 1000 0011 0110 0100 0111
2 1 4 7 4 8 3 6 4 7
3 (1): 0010 0001 0100 0111 0100 1000 0011 0110 0100 0111
2 1 4 7 4 8 3 6 4 7
3 (2): 0010 0001 0100 0111 0100 1000 0011 0110 0100 0111
2 1 4 7 4 8 3 6 4 7
3 (3): 0010 0001 0100 0111 0100 1000 0011 0110 0100 0111
| | 2 1 4 7 4 8 3 6 4 7
| |
| |
| +------- Data item number 0..382
+---------- Data Block number 0..3999

*** NOTE ***

Data Blocks share the same numbering as Texts. For example, if Data
Block 10 is defined, then Text 10 is unavailable, and vice-versa.
DBs 0..3999 are stored in text memory, in a special encoded format.
DBs 4000..7999 (or 4000..4999 in PCD1, 4000..5999 in PCD2) are
stored in extension memory, directly in binary, and so are faster
to access than DBs in text memory. If the code and text segments
are in EPROM, which is read-only, then DBs 4000..7999 in extension
memory will be in RAM and can be written to.
SBUG - Page 31

3.5.12 Display Byte


--------------------

This command is not shown on the prompt line because it should


not normally be used by customers.

It displays byte values in hexadecimal from anywhere in the PCD's


internal memory. The addresses and count must be entered in hex.
The "Refresh" option can also be given.

The display shows the hex address, hex data and ASCII values.
Sixteen values values are shown on each line.

>Display bYte 0 Count 50


00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
0123456789ABCDEF --+
000000 00 C0 2C 2C 00 80 20 00-00 80 39 F8 00 80 3A DE
..,,.. ...9...:. |
000010 00 80 3B 38 00 80 33 42-00 80 33 74 00 80 33 A6
..;8..3B..3t..3. |
000020 00 80 33 D8 00 80 34 0A-00 80 3B 38 00 80 3B 38
..3...4...;8..;8 |
000030 00 80 34 3C 00 80 34 52-00 80 34 68 00 80 34 7E
..4<..4R..4h..4~ |
000040 00 80 34 94 00 80 34 AA-00 80 34 C0 00 80 34 D6
..4...4...4...4. |
| | | |
| | | |
| +---- Hex data ASCII data -----+ |
+------------- Hex address Byte offset ------------------------+

3.5.13 Display Exec path


-------------------------

This command displays the current execution path, which is a list


all the called blocks, and shows the Bloctec nesting. It indicates
the nesting level, the block and the return address.

>Display Exec-path
1 COB 0 0
2 FB 6 245
3 FB 7 344
4 PB 93 1034
| | |
| | +------- Return address
| +----------------- Called block
+-------------------- Nesting level
SBUG - Page 32

3.5.14 Display s-bUs


---------------------

Displays the PCD's S-BUS PGU port and gateway configuration, which
is stored in user memory. The S-BUS PGU port is configured from the
"Configure/s-Bus communications" and "Configure/Modem for SAIA PCD"
screens. The gateway is configured from the "Configure/Gateway master
port" sceen. The S-BUS and gateway configuration is ritten into user
memory with the "Up/download" program's "CONFIGURE S-BUS" command,
or with "SDNLD /S" from the DOS prompt.

S-BUS can only be configured if P800 protocol is being used for


communications, because re-configuring the link might cause the PCD
to go off line.

>Display s-bUs
S-BUS PGU PORT
Station: 0 TS delay: 0 mS (default)
Baud rate: 9600 Timeout: 250 mS (default)
Mode: Break TN delay: 1 mS (default)
PGU port: CPU0=0
PUBLIC LINE MODEM
Modem name: Miracom WS3000
Reset modem: "ATZ\r"
Init modem: "ATM0E0S0=2\r"
GATEWAY PORT
Port number: 1 TS delay: 0 mS (default)
Baud rate: 9600 Timeout: 250 mS (default)
Mode: Parity TN delay: 1 mS (default)
Port on CPU: 0
SBUG - Page 33

3.6 Write Commands


===================

Excluding the Inputs and the Display Register (which are both read
only), all elements can be written to. The "Write" command allows
elements to be written in binarY, Decimal, Hex, Bcd or Floating-point
units as appropriate. It is also possible to write to more than one
element at the same time with a single command.

Each "Write" command is described separately in the following


sections.

3.6.1 Write Accu and Write Status-flag


---------------------------------------

While the CPU is in Run or Halt, it is not possible to write to the


Accumulator or the Arithmetic Status flags, the Accumulator and Status
prompts will not appear on the "Write" prompt line unless the CPU is
in Stop.

"Write Status" sets/clears the three Arithmetic Status flags. Refer


to section 3.3.1 for a description of the flags.

Examples:

>Write Accu 0
>Write Status-flag Zero 1
>Write Status-flag Negative 1
>Write Status-flag Positive 0
>Write Status-flag Error 1
>_

3.6.2 Write Output and Write Flag


----------------------------------

Outputs and Flags can be written in binarY (the default units, 1


bit), Bcd (4 bits), Hex (4 bits) or Decimal (1-32 bits). One or
more Outputs or Flags can be written at the same time with either
the same value, or a set of values, using the "To" and "Count"
options.

Manual control (display and edit) is also provided, this is similar


to the "MAN BIT" operation of the PCA's P05 and P10 programming
units.

The following examples describe writing Outputs or Flags in the


different units.
SBUG - Page 34

Write Output and Write Flag Continued


-------------------------------------

Binary Units
------------

Binary is the default base for writing Outputs and Flags. A single
bit can be set or cleared with the following command:

>Write Output 0 1 (sets Output bit 1 High)


>Write Flag 100 0 (Flag 100 := 0)

A number of bits may be written to the same value by specifying an


address range, followed by a 1 or a 0:

>Write Output 0 To 99 1 (sets Outputs 0 to 99)


>Write Output 0 Count 100 0 (clears Outputs 0 to 99)

A sequence of bits may be written by specifying an address range,


followed by the correct number of bits:

>Write Output 0 To 5 100110 (writes Outputs 0 to 5 to 100110)


>Write Output 0 To 5 000000 (writes Outputs 0 to 5 to 000000)

Binary writes may be done in either ascending or descending order:

>Write Output 5 To 0 100110 (writes Outputs 0 to 5 to 011001)


>Write Output 99 To 0 1 (sets Outputs 0 to 99 )

Bcd and Hex Units


-----------------

Since both Bcd and Hex digits use 4 bits, both these commands are
the same, except Bcd digits can be 0..9, Hex digits can be 0..F.
Since one Bcd or Hex digit consists of 4 binary bits, when the
address range of bits to be written is specified it must also be a
multiple of 4 value, followed by the correct number of Bcd or Hex
digits. For Bcd or Hex values the order (ascending or descending)
of the address range affects which is the most significant bit and
digit. The rules are the same as for the "Display Output/Flag"
commands, see section 3.5.2.

>Write Output 0 Count 12 123 Hex (bits 11..0 are written with )
(3 hex digits as follows: )
( 1098 7654 3210 )
( 0011: 0001 0010 0011 )
>Write Output 0 To 11 123 Hex (same as above)
>Write Output 11 To 0 123 Hex (bits 0..11 are written with )
(3 hex digits as follows: )
( 0123 4567 8901 )
( 0000: 1000 0100 1100 )
SBUG - Page 35

Write Output and Write Flag Continued


-------------------------------------

Decimal Units
-------------

Up to 32 bits can be written with a decimal number. The number is


converted to binary and written to the specified bits. This command
is useful for A/D and D/A conversion, where the address range is the
convertor data width (8-bit, 12-bit etc). If the value is too big to
be written to the address range bits, an error message is displayed,
no values are written. The order of the address range defines which
is the most significant bit, the rules are the same as for the
"Display Output/Flag" commands, see section 3.5.2.

If "Count" is used, the least significant bit is the lowest addressed


bit, for example:

>Write Output 0 Count 8 123 Decimal (writes the value 123 to )


(Outputs 7..0, Output 0 is )
(the LSB, Output 7 is the )
(MBS, value is 7B Hex: )
( 76543210 )
( 0007: 01111011 )

Manual
------

Write Output <number SP> Manual <CR>

When this command is entered, the Flag or Output address is displayed,


followed by its present value (1 or 0). The value is highlighted,
indicating that it is being refreshed, and the cursor is placed on
the value. Since the data is constantly refreshed, it shows the
actual value at all times.

The following prompt is displayed, shown here for Outputs:


┌────────────────────────────────────────────────────────────────────────────────┐
│ MANUAL OUTPUT: <1> set output, <0> clear output, <ESC> exits, │
│ <DOWN ARROW> or <CR> next address, <UP ARROW> previous address. │
└────────────────────────────────────────────────────────────────────────────────┘

The Output or Flag value can be toggled using the <1> and <0> keys.
The next or previous output or flag is displayed by pressing the
<DOWN ARROW>, <CR> or <UP ARROW> keys. <ESC> exits manual write mode.

Example:

>Write Output 0 Manual (Write Manual command, start at Output 0)


0000: 0 (Output 0 selected and can be changed)
>_ (ESCape pressed, exits manual write)
SBUG - Page 36

3.6.3 Write Register, Timer and Counter


----------------------------------------

The Write Timer, Counter and Register commands are all the same,
except that only Registers can be written in Floating-point or Ascii
units, and Timers and Counters cannot contain negative values.

A single Timer, Counter or Register or a number of them, can be


loaded with a single Decimal (default), Bcd, Hex, Floating-point
(Registers only) or Ascii (Registers only) value.

The units can be defined by the format of the entered number, or


by giving the optional units type as part of the command. e.g. 45H
is Hex, 12.3 or 1E0 is Floating-point, 'abcd' is Ascii, 10001Q or
10001Y is binarY.

Examples:

>Write Timer 0 100 (Timer 0 loaded with 100 decimal.)


>Write Counter 10 To 20 0 (Counters 10 to 20 loaded with 0.)
>Write Counter 10 Count 10 0 (Same as above example. )
>Write Register 200 1.23 Floating-Point
>Write Register 10 'a' (Loads bits 7..0 with ASCII 'a', )
(bits 31..8 are set to 0. )
>Write Register 10 a Ascii (Same as above example. )
>Write Register 100 45H (Loads R 100 with 45 Hex. )
>Write Register 100 45 Hex (Same as above example. )
>Write Counter 0 10001Y

*** NOTE ***

When a Timer is written to, it is automatically started and begins


decrementing until it reaches zero, regardless of the status of the
CPU (Run, Stop etc).
SBUG - Page 37

3.6.4 Write Program


--------------------

With this command, instructions can be written into program memory,


overwriting what is already there. If the CPU is in Stop, Conditional
Stop or Halt, program lines can also be inserted or deleted using
<ALT+I> and <ALT+D>.

The command format is:

Write Program <address CR>

When this command is entered, the existing program line at the given
address is read, disassembled and displayed (as for the "Display
Program" command) and a cursor is placed after it on the line. A new
instruction line can now be entered. Opcodes and medium control codes
(mc) are entered in mnemonic form, the operand defaults to decimal
units. Either the <SPACE> or the <TAB> key can be used to separate the
mnemonic, mc and operand. <DEL> and backspace can be used to edit the
line.

This is the Write Program prompt line:


┌────────────────────────────────────────────────────────────────────────────────┐
│ WRITE PROGRAM: Enter new instruction line < [mnemonic [mc] [operand]] CR >, │
│ <ESC> exits. In HALT or STOP only: <ALT+I> insert line, <ALT+D> delete line. │
└────────────────────────────────────────────────────────────────────────────────┘

Instruction lines are checked and stored in the PCD when <CR> is
pressed. If <CR> is pressed without entering an instruction, program
memory is NOT changed and the next instruction line is displayed.
This feature can be used to step to the desired line. The <ESC> key
is used to end the programming session.

Hexadecimal, binary, floating point and ASCII values are allowed


for any operand (floating point is allowed only for 32-bit operands).
Hex values are postfixed with an "H", e.g. 7EA1H. Binary values are
postfixed with a "Q" or a "Y", e.g. 11001Q, 1110000Y. Floating point
value must contain a "." or an "E", e.g. -1.24E3, .2, 1E-8. ASCII
values must be enclosed in single quotes, e.g. 'a', '$', 'Fred'.

For the Jump Relative (JR) instruction, an absolute (actual) address


instead of a relative address can be entered by preceding the number
with a "#" or a "$" symbol. The relative value is calculated and
stored. DO NOT program absolute jumps forwards if the destination is
beyond the end of the program, as the program is written, lines are
inserted automatically, and the jump addresses will be changed!!

If the existing instruction line read from memory contains an error,


an error message is displayed in the entry field position and the
cursor is also placed there. When the first character of the new
instruction line is typed, the error message is cleared.
SBUG - Page 38

Write Program Continued


-----------------------

Lines can be inserted and deleted only when the CPU is in Stop,
Conditional Stop or Halt. When <ALT+I> is pressed, a NOP instruction
line is inserted AFTER the current line number. Pressing <ALT+D>
deletes the current line.

Example, insert two lines at 1025 and 1026:

>Display Program 1024 Count 2


001024 STH I|O 37
001025 ANH I|O 38
>Write Program 1024
001024 STH I|O 37 (ALT+I key pressed)
001025 NOP (ALT+I key pressed)
001026 NOP (<ESC> pressed)
>Display Program 1024 Count 4
001024 STH I|O 37
001025 NOP (1st inserted line)
001026 NOP (2nd inserted line)
001027 ANH I|O 38 (was line 1025)
>_

Now delete line 1026:

>Write Program 1026


001026 NOP _

When <ALT+D> is pressed, line 1026 is removed from the screen, and
line 1027 is displayed in its place, now it's line 1026. All lines
above it will have been shifted down 1, and all jumps are adjusted.
The display now looks like this:

>Write Program 1026


001026 ANH I|O 38 _

*** NOTES ***

When programming, existing instruction lines are overwritten. If


overwriting multi-line instructions, or inserting new multi-line
instructions, errors may be generated. Ensure this does not happen if
the CPU is in Run and could execute a partially entered instruction.

If inserts or deletes are done or the program structure is altered,


A RESTART MUST BE DONE before running or tracing the program. After
an insert or delete line, SBUG will not allow the "Run", "Stop" or
"Trace" commands until a restart is done. Lines can only be inserted
and deleted within the "USED" area of memory, as shown in the memory
map, see section 3.5.9.

DO NOT program absolute jumps forwards if the destination is beyond


the end of the program. As the program is written, lines are inserted
automatically, and the jump addresses will be changed!!
SBUG - Page 39

3.6.5 Write Text


-----------------

Existing texts can be edited or deleted, and new texts can be added
with this command. A simple text editor is provided. Texts can be
typed directly from the keyboard, or the decimal codes for individual
ASCII characters can be entered.

The "Write Text" command prompts for a text number, this can be the
number of a new text, or the number of an existing text which is to
be edited.

The text is displayed in the same ASCII format as for the "Display
Text" command. The cursor is placed over the first character of the
text, and editing can commence. The prompt line changes to indicate
text entry, and which keys are valid:
┌────────────────────────────────────────────────────────────────────────────────┐
│ WRITE TEXT: Edit text on screen. <ARROW> moves cursor, <ALT+S> stores, │
│ <INS> insert/overtype mode, <DEL> or <BS> deletes, <ESC> aborts. │
└────────────────────────────────────────────────────────────────────────────────┘

The text can now be entered or edited. The <ARROW> keys can be used
to move around the text, the <HOME> and <END> keys move to start or
end of the current line.

If any non-printable control characters are typed, such as <CTRL+Z>


or <CTRL+A>, those with decimal codes 1..31 or 127..255 (excluding
<CTRL+H> which is backspace), these are automatically displayed in
decimal, enclosed in angle brackets, e.g. <10>. Decimal characters
can also be entered by typing their decimal ASCII codes, enclosed
in angle brackets. Leading zeros such as <000001> are ignored, the
value here is the same as <1>. The range of values permitted is <1>
to <255>. The <0> character NUL is not allowed in Texts 0..3999, as
this character is used to mark the end of text - but it is allowed
in Texts 4000..7999 in extension memory, if present.

To enter angle brackets or double inverted commas into the text,


they must be enclosed in angle brackets, for example:

<<> enters <


<>> enters >
<<><>> enters <>
<"> enters "

If the text is longer than the screen width, it automatically wraps


around to the next line, no carriage return or line feed is inserted
in the text. To store the new text and return to command level, type
<ALT+S>. If the text fills more than one screen, the arrow keys scroll
the screen up or down if the cursor is at the top or bottom of the
screen.

The <DEL> key deletes the character under the cursor, backspace <-
deletes the character before the cursor, <INS> toggles between insert
and overtype mode. Insert mode is indicated by a block cursor, overtype
mode by the standard underline cursor.
SBUG - Page 40

Write Text Continued


--------------------

When the CPU is in Run or Conditional Run, only overtyping of an


existing text can be done. New texts cannot be written, the length of
a text CANNOT be altered while a CPU is in Run or Conditional Run.

If an existing text is displayed, if the text contains a carriage


return character <13>, a new line is started on the display. This
improves readability. Therefore, when ending a line with a line feed
and carriage return combination <10><13>, the line feed <10> should
be first to produce a better text display.

The maximum size of text that can be edited is 3072 characters (3K),
including the terminating NUL.

A text containing invalid decimal values within "<..>" cannot be


stored, the <ALT+S> key beeps when pressed, displaying an error
message. Note that a decimal code of <0> is invalid since the NUL
character is used to terminate the text in memory. If text memory is
full and the new text will not fit, an error message is displayed,
the edited text is lost.

*** WARNING ***

The first character of Text 0..3999 must NOT be 0FDH, 0FEH or 0FFH
(253..255 decimal) because these indicate that the Text has a
special format or is in use as a Data Block.
SBUG - Page 41

3.6.6 Write Clock


------------------

To write to the clock the traditional format is used. The week-of-


year and day-of-week can optionally be entered, SBUG calculates
these if not supplied.

<dd/mm/yy hh:mm:ss [week-of-year [day-of-week]] CR>

Where: dd day 1-31 depending on month and year


mm month 1-12
yy year 87-99, 00-10 (1987-2010)
hh hours 0-23
mm minutes 0-59
ss seconds 0-59
week-of-year 1..53
day-of-week 1..7, 1=Monday ... 7=Sunday

Either one or two digits may be typed for each field, separated by
any non-numeric delimiter, such as "/", ":" or a space. A minimum
of six numeric values must always be entered, for example:

>Write clocK 01/02/86 8:15:00 (This sets the clock to)


WEEK 5 DAY 6 (1st Feb 1986, 8.15 am.)
>Write clocK 1 2 86 8 15 0 (Does same as above example)
WEEK 5 DAY 6 <--- these are calulated by SBUG)

3.6.7 Write Index-register


---------------------------

The Index Register of the current COB or XOB (each has its own Index
Register) can be written in decimal only, no units can be selected.
The Index Register cannot be written while the CPU is in Run or
Conditional Run. Maximum values are 0..8191.

>Write iNdex-register 0
>_
SBUG - Page 42

3.6.8 Write Data-block


------------------------

Data Blocks (DBs) contain one or more 32-bit Register values.


DBs 0..3999 reside in the text memory segment, and can contain
up to 383 values (elements 0..382). DBs 4000..7999 reside in
extension memory, and can contain up to 16384 values (elements
0..16383).

The "Write data-Block" command has three forms: a new Data Block of
a given size can be created or the Data Block deleted; element values
can be edited interactively; or one or more elements can be loaded
with a given value. Element values can be changed while the CPU is
in Run mode.

Creating or deleting a Data Block


---------------------------------

The following format of the command creates a new Data Block of a


given size. All elements in a new Data Block are set to zero (0). To
delete an existing Data Block, set the <size> to zero.

Write data-Block <number> Size <size>

It is not possible to change the size of a Data Block or create a


new Data Block while the CPU is in Run or Conditional Run.

Examples:

Write data-Block 10 Size 100 (Creates DB 10 of 100 elements)


Write data-Block 10 Size 0 (Deletes DB 10)

Setting one or more elements to a single value


----------------------------------------------

One or more elements of the Data Block can be written with a single
value using the familiar "To" and "Count" ranges.

Write data-Block <number> Element <element> [To/Count ...] <value>

Examples:

Write data-Block 10 Element 0 Count 100 0.0


(Sets all 100 elements of DB 10
to floating point value 0.0)
Write data-Block 10 Element 15 25 (Sets the single element 15 of
DB 10 to 25 decimal)
Write data-Block 10 Element 0 To 9 '0000'
(Sets elements 0..9 of DB 10
to '0000' ASCII (30303030H))
SBUG - Page 43

Write Data-block continued


--------------------------

Interactive editing of Data Block elements


------------------------------------------

Existing element values are displayed and can be edited interactively


using this format of the command:

Write data-Block <number> [Decimal/Hex/Floating-point/Ascii]

The optional units (Decimal/Hex/Floating-point/Ascii) selects the


initial units for the display of existing values. The display units
can also be changed interactively, see below. DB elements cannot be
displayed in Bcd or binary (use the Hex display instead), but new
values can be entered in binary by using the "Q" or "Y" suffix.

The first element's current value is displayed in the chosen units


(default is decimal), and a cursor is shown on the same line. A new
value can then be entered in any units, regardless of the display
units, e.g. 12 (decimal), 14H (hex), 1.2 (floating point), 'a' and
'1234' (ASCII), 1001010Y (binary). The default units are decimal.

<ENTER> or <DOWN ARROW> selectes the next DB element, <UP ARROW>


selects the previous element. The <HOME> and <END> keys move to the
first or last element, <PGUP> and <PGDN> move 10 elements up or down.
If you don't want to change the value, move to another element
without typing a new value. The display units can be changed by
pressing <ALT+U>, which toggles the units between decimal, hex,
floating point and ASCII.

Changed values are only written into the CPU's memory when <ALT+S>
is pressed. Editing can be aborted by pressing <ESC>, and all the
changes are discarded without writing to the PCD's memory.
SBUG - Page 44

3.6.9 Write Byte


------------------

This command is not shown on the prompt line because it should not
normally be used by customers.

It writes binary data to anywhere in the PCD's internal memory. The


address and data are given in hexadecimal.

The command has two forms. The first form accepts one or more hex
values on the command line, which are checked and then written to the
given hex address and consecutive bytes. Each data value must be a
2-digit hex value.

The second form allows individual bytes to be displayed and optionally


changed interactively. If no data is given on the command line, then
the address and the existing value (in hex) are shown, and a cursor is
placed after the value. A new value can now be entered (2 hex digits),
or <CR> can be pressed to step to the next byte without changing the
existing value. The <DOWN ARROW> or <UP ARROW> keys can be used to
step to the next or previous bytes. Press <ESC> to exit.

Interactive "Write bYte" command:

>Write bYte 4001CA (no data on command line)


4001CA 00 A7 (4001CA := A7 hex, <CR> pressed)
4001CB C0 4B (4001CB := 4B hex, <CR> pressed)
4001CC 2C 3C (4001CC := 3C hex, <CR> pressed)
4001CD FF (only <CR> pressed, 4001CD unchanged)
4001CC 3C (<UP ARROW> pressed, shows 4001CC)
>_ (<ESC> pressed to exit)

Immediate "Write bYte" command:

>Write bYte 4001CA A7 4B 3C (same as above, 4001CA := A7, )


>_ (4001CB := 4B, 4001CC := 3C )

*** WARNING ***

Do NOT use this command unless you are certain about the contents
of the memory locations. Changing the wrong memory locations will
cause incorrect operation and may crash the CPU.
SBUG - Page 45

3.6.10 Write s-bUs station


---------------------------

The S-BUS station number of the connected PCD can be changed with
this command. The station number is the only S-BUS parameter that
can be changed from S-BUG, other parameters can only be changed from
the "Configure/s-bUs communications" menu, and must be downloaded
from the "Up/download" menu, or with "SDNLD /S".

SBUG first checks the network to see if another station with the
new number exists. If not, the connected station's number is changed,
and SBUG switches to the new station number. The PCD's operating mode
(Run/Stop) is not affected, and no "restart" is done.

*** NOTE ***

If the PCD contains old firmware (released before September 1994),


then a "restart cold" is done to register the new station number,
and all CPUs in the rack will be stopped. In this case the user is
prompted "This will stop all CPUs, continue (Y or N)?" before the
operation is done. For old firmware, the station number cannot be
changed if the user program is in EPROM.
SBUG - Page 46

3.6.11 Write passWord


----------------------

PCDs with the latest firmware (PCD2 V003, PCD4 V005, PCD4.M4 V001,
PCD6.M5 V004, PCD6 V007) now have a password protection mechanism.
When protected by the password only reduced protocol communications
can be used. This allows access only to Registers, Timers, Counters,
Inputs and Outputs and the clock. The user program and all other
data cannot be accessed unless a valid password is entered.

Password protection is restored either by entering an invalid


password with SBUG's "Write passWord" command, or by the PCD's
"inactivity timeout". The inactivity timeout can be set to between
1 and 60 minutes. This automatically restores password protection
if no telegrams are received by the PCD within that period.

Whenever one of the SAIA PCD Programming Utilities online programs


is run, a pop-up window is displayed if the PCD is password protected.
This prompts for entry of the password, so that password protection
can be removed. To skip password entry, press ESCape, this causes
a reduced p[rotocol connection to be made and all protected online
commands will produce a "command not accepted by PCD" error.

╔══════════════════════════════════════════════════╗
║ ONLINE PASSWORD PROTECTION IS ACTIVE ║
║ ║
║ Enter password: _________________________ ║
║ ║
║ Press ENTER to continue, ESC for reduced access. ║
╚══════════════════════════════════════════════════╝

The password is defined either using SBUG's "Write passWord" command,


if using RAM or Flash EPROM memory, or from SPROM's "F7=Password"
screen if programming EPROMs.

Use the "Write passWord New" to define a password for the first time:

Write passWord New <new password> SP <inactivity


timeout (1..60 minutes)> CR

The password can be entered to temporarily remove password protection


using:

Write passWord Enter <current password> CR

Password protection can be restored immediately, without having to


wait for the inactivity timeout period, by entering an invalid
password. This generates an "INVALID PASSWORD" error, and restores
password protection.

Write passWord Enter X CR (where "X" is any invalid password)

To change the password or the inactivity timeout, use:

Write passWord Change <current password> SP <new password> SP


<inactivity timeout (1..60 minutes)> CR

To remove password protection completely use:

Write passWord Remove <current password> CR


SBUG - Page 47

3.7 Batch
----------

With the "Batch" command, a simple "program" of up to 100 debug


commands (lines 00..99) can be written, displayed, edited, executed,
renamed, copied, or saved to or loaded from a file. The batch can be
executed once, repeated many times using the "Count" option, or run
continuously (until <ESC> pressed) using "forEver". The "Nodisplay"
option stops the batch commands being displayed as they are processed.

When a batch is executed, commands are read and executed from the
batch instead of from the keyboard. While executing, all commands and
data are displayed as usual, unless the "Nodisplay" option has been
specified.

Batch execution can be aborted by pressing <ESC> or paused by pressing


<SPACE>.

A default batch file named SBUG.DBA is automatically loaded by SBUG.


This file contains some pre-defined batches which are assigned to the
Function Keys, see section 3.1.1. If batches are written with names
"F2" to "F40", the batch is executed whenever the corresponding
function key is pressed. For example, pressing key F2 executes the
batch named "F2" etc.

Up to 40 batches can be in memory at one time, and each can have a


name up to 40 characters long.

When the "Batch Write" command is entered, none of the commands


entered afterwards are executed (except "eNdbatch"), instead they are
placed in consecutive lines of the batch. The batch line number (0..
99) is displayed at the start of the line, followed by the command as
it is entered.

Element numbers, addresses and other data values are NOT checked as
they are entered, these are checked only when the batch is executed.
If an invalid command is found when the batch is executed, an error
message is displayed and the batch is aborted. Some commands can be
executed only if the CPU is in Stop, Conditional Stop or Halt, these
can also be invalid when the batch is executed.

Batches can contain comments, such as a description of the batch. To


enter a comment, precede it with a ";" character. PCD instructions
can be included in the batch, using the "Instruction" command, to
simulate a short PCD program.

The "eNdbatch" command is used to end the batch.

There are two major functional differences between the execution of


commands from a batch, and execution of commands from the command
line:

1) When in Conditional Run, the batch pauses until the CPU reaches
the breakpoint (goes into Conditional Stop) before the next batch
line is executed. If not executing a batch, further commands can
be executed from the keyboard when in Conditional Run.

2) The "ARE YOU SURE (Y or N)?" prompts are NOT displayed if the
"File" and "Clear" commands are executed from a batch, so ensure
that dangerous batches are not executed by mistake.
SBUG - Page 48

Batch Commands Continued


------------------------

During the writing or editing of a batch, the top level prompt shows
only the valid batch commands , including the extra "eNdbatch" command
needed to terminate the batch write or edit. When on line 99 of a
batch, the prompt line will change to force the user to terminate, it
allows only the "eNdbatch" command. See section 3.1.

When a batch is executing, this prompt is displayed:


┌────────────────────────────────────────────────────────────────────────────────┐
│ BATCH "FRED" RUNNING: <SPACE> pauses, <ESC> aborts. │
└────────────────────────────────────────────────────────────────────────────────┘

These are examples of all the "Batch" commands:

Batch Display Displays the names of all the batches in


memory.
Batch Display FRED Displays the contents of batch FRED.
Batch Run FRED Executes batch "FRED" once.
Batch Run FRED Count 10 Executes the batch 10 times.
Batch Run FRED Nodisplay Executes the batch once, but without the
screen being updated.
Batch Run FRED forEver Executes continuously until <ESC> pressed.
Batch Run FRED Count 10 Nodisplay
Executes the batch 10 times, without
screen update.
Batch Write FRED Starts creation of new batch, a batch with
the same name must not already exist.
Batch Kill FRED Deletes the batch from memory.
Batch Kill * Deletes ALL batches from memory.
Batch Edit FRED 10 Edits the batch starting from line 10.
Existing batch lines can be edited, <ESC>
or "eNdbatch" ends the edit.
Batch Save Saves all batches in memory to the default
batch file SBUG.DBA in the current
directory.
Batch Save HARRY Saves all batches in memory to file HARRY.
The file name can contain a drive name
(e.g. A:), a directory name and a file type
(default file type is ".DBA").
Batch Load Loads all batches from the default batch
file SBUG.DBA in the current directory,
all existing batches in memory are deleted
first.
Batch Load HARRY Loads all batches from file HARRY. Defaults
are as for the "Batch Save" command. All
existing batches in memory are deleted
first.
Batch Load HARRY FRED Loads only batch named FRED from file HARRY.
Only one batch is loaded, existing batches
in memory are NOT deleted.
eNdbatch This ends the batch write or edit, and is
always the last command in every batch.
SBUG - Page 49

Batch Commands Continued


------------------------

Here is an example of a short command batch named "DEMO".


>Batch Write DEMO (write the batch)
00>; **** A LITTLE DEMO BATCH **** (give it a title)
01>Run From 0 Until Output 0 1 (run program)
02>Display Output 0 To 20 (display some stuff)
03>Display Register 0 To 10 Hex
04>Write Register 0 To 10 0 (clear registers)
05>Trace Count 3 (execute 3 lines)
06>eNdbatch (end the batch)
>Batch Run DEMO Count 2 (run the batch twice)
00>; **** A LITTLE DEMO BATCH **** (1st time)
01>Run From 0 Until Output 0 1
CONDITIONAL RUN (goes into cond run)
CONDITIONAL STOP (WAITS FOR COND STOP)
*001024 STH I|O 37 [1] (displays next line)
02>Display Output 0 To 20
0123456789 0123456789 0
0000: 0111111111 1010101010 1
03>Display Register 0 To 10 Hex
0000: 00000000 0001: 12345678 0002: ABCDEF00 0003: 00000000
0004: 00000001 0005: 00000000 0006: 00000064 0007: 00000064
0008: 499602D2 0009: 5F5E0FF0 0010: 00000064
04>Write Register 0 To 10 0
05>Trace Count 3
001024 STH I|O 37 [1] A0 Z1 N0 P1 E0 INDEX 12
001025 ANH I|O 38 [1] A0 Z1 N0 P1 E0 INDEX 12
001026 ANL I|O 39 [1] A0 Z1 N0 P1 E0 INDEX 12
*001027 SET I|O 0
00>; **** A LITTLE DEMO BATCH **** (2nd time)
01>Run From 0 Until Output 0 1
CONDITIONAL RUN
CONDITIONAL STOP
*001024 STH I|O 37 [1]
02>Display Output 0 To 20
0123456789 0123456789 0
0000: 0111111111 1010101010 1
03>Display Register 0 To 10 Hex
0000: 00000000 0001: 12345678 0002: ABCDEF00 0003: 00000000
0004: 00000001 0005: 00000000 0006: 00000064 0007: 00000064
0008: 499602D2 0009: 5F5E0FF0 0010: 00000064
04>Write Register 0 To 10 0
05>Trace Count 3
001024 STH I|O 37 [1] A0 Z1 N0 P1 E0 INDEX 12
001025 ANH I|O 38 [1] A0 Z1 N0 P1 E0 INDEX 12
001026 ANL I|O 39 [1] A0 Z1 N0 P1 E0 INDEX 12
*001027 SET I|O 0
>_ (back to command level)
SBUG - Page 50

3.8 File
---------

These are the "File" commands, which are described in more detail
below:

File Load ... Loads from an absolute object file of


type .PCD or .UPL.
File Save ... Saves the user program to a .UPL type
file.
File Directory ... Displays names of selected files in the
given drive and directory.
File View ... Displays the contents of an ASCII file.

File Compare ... Compares the user program in the file


with the user program in the connected
CPU.
File Get-pcdsetup Reads the PCD configuration from the
connected PCD and writes it to the
PCDSETUP.DAT file in the current
directory.
File set-load-Options Configures the "Clear all outputs" and
"Run all CPUs on completion" options
which are used when a new program is
loaded into the connected CPU with the
"File Load" command.

File Load and File Save


-----------------------

An entire absolute object file (.PCD or .UPL) can be loaded from


disk into the memory of the connected CPU, or saved from PCD memory
into a file (.UPL). If the PCD contains RAM memory, then a single
COB, XOB, PB, FB, SB, ST, TR, TEXT or DB, can be loaded from a file.
Extension memory can also be loaded separately.

The default file type for "File Load" is .PCD. Tor "File Save" it
is .UPL (UPLoaded file), which prevents overwriting of the original
.PCD file.

To load a complete user program (code/text/extension memory) use:

File Load <filename>

To save a complete user program (code/text/extension memory) use:

File Save <filename>

For the "File Save" and "File Load" (without a specified block), the
file name is optional, if not specified then the name of the program
already present in the connected CPU is used. If no drive or path
name is given, the current drive and directory are used by default.
If no file extension is given, the defaults .PCD (File Load) and
.UPL (File Save) are used.
SBUG - Page 51

File Load and File Save continued


---------------------------------

For "File Load", a filename mask containing the wildcard characters


"*" and "?" can be entered. This displays the pop-up directory
window, and a file name can be selected by moving the cursor onto
the name and pressing Enter.

Before a file is loaded, a check is made to ensure that it is a valid


loadable absolute object file and its checksum is verified. A check
is also made to ensure that the file (or block) will fit in the
allocated code, text and extension memory segments.

When loading an entire program (not a single block, text, DB), the
CPU's memory is cleared and a "Restart Cold" or "Restart Warm" (see
NOTE below) is done. This means that the CPU's memory remains empty
if the download fails or is aborted. After the download, the CPU will
always remain in Stop.

Since a download can be started when the program is running, the user
is prompted to prevent him inadvertently stopping and restarting a
CPU. Note that if an entire program is downloaded to CPU 0, all other
CPUs will be restarted and will go into Stop. If not connected to CPU
0, only the connected CPU is restarted and will be stopped.

Before the file is loaded, this prompt is displayed:

WARNING: This will reset all cpus!! Continue (Y or N) ?

Typing "N" aborts without stopping any CPU or downloading anything.


"Y" continues the download, resetting all the CPUs and clearing all
the outputs (see the "Clear all outputs" option below).

Before a file is saved, a check is made to see if a file of that name


already exists on the disk, if it does, the user is prompted:

FILE EXISTS: Overwrite it (Y or N) ? _

The user can then either overwrite it with "Y", or abort the operation
with "N".

*** NOTE ***

When downloading a program, outputs are cleared if the "Clear all


outputs" option is "Yes". If "No", then outputs retain their existing
states. If PCD firmware does not support this feature, a warning
message will be displayed, and the action will depend upon the PCD's
"Reset Outputs" jumper (if the PCD has one): If the jumper is in,
then outputs are cleared at the start of a download; if it's out,
they are only cleared when the download is complete.

After a successful download, all CPUs are put into Run automatically
if the "Run all CPUs on completion" option is "Yes".
SBUG - Page 52

Loading single blocks, Texts or Data Blocks


-------------------------------------------

To load a single block, Text or Data Block use:

File Load <filename> Cob|Xob|Pb|Fb|sB|St|Tr|tExt|Data-block <number CR>

"File Load ..." is available when the CPU is in Run. This enables a
single block to be downloaded when in Run, thus changing the process
"on the fly". Once a new block is downloaded, the new block is used
in place of the old block. Blocks are added to the end of the existing
code or text segments. The original block is NOT DELETED, it remains
in memory, so if the program is uploaded then all the old blocks will
also be present in the .UPL file. If more than one block with the
same number is present in memory, the *last one* is always used by
the PCD.

Before the block is downloaded, SBUG checks to see if the block calls
any other blocks which are not defined in the CPU, or references Texts
or DBs which do not exist. If so, and the CPU is in Run, a fatal error
occurs, indicating the undefined block, and the download is aborted.
No data will have been downloaded.

ERROR 80: REFERENCED BLOCK NOT DEFINED: FB 10

If the CPU is not in Run, then the user is prompted: "ABORT, CONTINUE
OR IGNORE (A, C or I) ?". Answering 'A' aborts the download, 'C'
continues the checking and 'I' continues the download without any
further checks.

*** NOTES ***

If the PCD contains Flash EPROM memory, then individual blocks cannot
be downloaded, unless they are Texts or DBs in extension memory.

The CPU must not be in Run to load an SB (Sequential Block), ST (Step)


or TR (Transition). After loading an SB, a "restart cold" is done
automatically. After loading an ST or TR, the user must manually do
a "Restart Cold". This sets up the CPU's internal ST/TR tables.

Texts and Data Blocks in extension memory are NOT added to the end
of the extension memory segment if the Text or DB to be downloaded
already exists, and is the same size. In this case the existing Text
or DB is overwritten. This allows extension memory to be altered if
the code and text segments (and memory map) are in read-only EPROM.

Checksums and modified programs


-------------------------------

During the "File Save" operation, the checksum on the code and text
segments is calculated. If this doesn't match the checksum stored
in the CPU's header, a warning message is displayed and the correct
(calculated) checksum is written to the file. The warning can mean
either that the code or text of the connected CPU has be modified
with "Write" commands, or that memory has become corrupted.
SBUG - Page 53

File Load <filename SP> Extension-memory


----------------------------------------

The extension memory segment can be downloaded separately. This


is useful if the user program is in EPROM (read-only) memory.

File Directory
--------------

This command displays the contents of a directory in a pop-up window.


A filename mask can be provided to select a different drive or
directory, or to list certain files only. A "*" in the mask matches
any characters, a "?" matches any single character. In the display,
a sub-directory is indicated by a "\" after the name, e.g. SOURCE\.
The parent and current directories are shown by ".\" and "..\".

File Directory (displays all files in current directory)


File Directory *.PCD (displays only the .PCD type file names)
File Directory \PCD (displays all files in directory \PCD)

File View
---------

Displays the contents of the given ASCII file. The file can be
viewed using the <ARROW>, <PGUP>, <PGDN>, <HOME> and <END> keys.
It can also be scrolled left and right using the <LEFT ARROW> and
<RIGHT ARROW> keys. The default filename extension is ".SRC". If
wildcard characters are used in the file name or the file name is
empty, the directory window is displayed, and a file can be chosen
from the list.

File Compare
------------

Compares the contents of a file with the contents of the connected


a CPU's memory. This checks that the code and text in a CPU are the
same as the code and text in a file, and checks that the extension
memory segments are the same size. The actual contents of the
extension memory segments, and the name of the program in memory
are NOT compared. The compare is fast because it does not actually
compare all the bytes, but compares the segment sizes and checksums.

*** NOTE ***

If the program in the PCD's memory has been edited on-line, then the
checksum of the program has been invalidated, and "File Compare"
will always fail, even if compared with a copy of the same program.
SBUG - Page 54

File Get-pcdsetup
-----------------

Reads the PCD configuration from the connected PCD and stores it
in the PCDSETUP.DAT file in the current directory. This saves the
"hardware and memory", "S-BUS communications", "modem for SAIA PCD"
and "gateway master port" configurations. These can then be viewed
and edited from the configurator's "SAIA PCD CONFIGURATION" menus.

In effect, this is the reverse of the downloader's "ALLOCATE MEMORY"


and "CONFIGURE S-BUS" commands.

The Up/downloader's "UPLOAD PCD SETUP" command does the same thing,
but the Up/downloader also has a "DOWNLOAD PCD SETUP" command, which
does the reverse.

*** WARNING ***


This command overwrites the settings in the PCDSETUP.DAT file in
the current directory, but a warning prompt is issued first:

WARNING: File pcdsetup.dat exists, overwrite it (Y or N) ? _

File set-load-Options
---------------------

When a new program is downloaded into the connected CPU using the
"File Load" command, the settings of two options are used. The
current settings are shown at the bottom of the screen when "File
Load" or "File set-load-Options" is typed:

FILE LOAD OPTIONS: Clear all outputs: YES


Run all CPUs on completion: NO

Clear all outputs:

If this is "YES", then all PCD Outputs are cleared at the start of
the File Load. If "NO", then the Outputs are not cleared, and retain
their current states. If the PCD firmware does not support this
feature, a warning message will be displayed, and the action will
depend upon the PCD's "Reset Outputs" jumper (if the PCD has one):
If the jumper is in, then outputs are cleared at the start of the
download; if it's out, they are only cleared when the download is
complete.

Run all CPUs on completion:

If "YES", then all CPUs containing programs are put into Run after a
successful "File Load" operation. If "NO", all CPUs will remain in
Stop. CPUs which don't contain programs will always remain in Halt,
regardless off the setting of this switch. Use this switch to minimize
the amount of time that outputs are cleared or not under PCD control.

*** WARNING ***


Only set this switch to "YES" if the downloaded program has been
tested and you know they will run correctly without damaging any
controlled hardware!
SBUG - Page 55

3.9 Instruction
----------------

The "Instruction" command executes the given instruction in the


connected CPU. This command is available when the CPU is in Stop,
Conditional Stop or Halt. This facility is useful in a batch or for
testing purposes.

The prompt for the "Instruction" command is:


┌────────────────────────────────────────────────────────────────────────────────┐
│ < mnemonic [mc] [operand] [, [mc] operand ] [,..] CR > │
└────────────────────────────────────────────────────────────────────────────────┘

The instruction can contain up to 4 operands. The delimiter between


operands must be a comma, a space is needed between the mnemonic, mc
and operand. e.g. "ADD R 0,R 1,R 2". The entries in square brackets
are optional.

Not all instructions are allowed, the program flow, program structure
and definition instructions cannot be executed:

CPB, PB, EPB, FB, EFB, COB, ECOB, XOB, EXOB


JR, JPD, JPI
SB, ESB, CSB, IST, ST, TR, EST, ETR, CCOB, NCOB, RCOB, SCOB
DEFWPR, DEFWPH, DEFTB, DEFTC, DEFTR

Certain instructions are executed only if the ACCU is High (1). If the
ACCU is Low (0), the instruction is not executed and an error message
is displayed. ACCU dependent instructions are:

COM, SET, RES, SETD, RESD.

LD, LDL, INC, DEC - ACCU dependent only if accessing a Timer


or Counter.

Examples:

>Instruction STH I 3
>Instruction MUL R 0,R 1,R 6
>Batch Run TOGGLE_OUTPUT_1 Count 100000
00>Instruction SET O 1 (a batch containing the)
01>Instruction RES O 1 (Instruction command )
00>Instruction SET O 1 (which toggles Output 1)
01>Instruction RES O 1
00>Instruction SET O 1
01>Instruction RES O 1
00>Instruction SET O 1
01>Instruction RES O 1
00>Instruction SET O 1
01>Instruction RES O 1
.
.
.
ABORTED (ESC aborts execution)
>_ (of the batch )
SBUG - Page 56

3.10 Locate
------------

Searches the connected CPU's memory, looking for a Mnemonic, Operand


or a complete instruction line. These are the commands:

Locate Mnemonic <mnemonic CR>


Locate Operand < [type] value CR>
Locate Instruction <mnemonic [mc] [operand] CR>
Locate Next
Locate From <address CR> } These commands are used to set
Locate To <address CR> } the range of memory searched.

"Locate Mnemonic" searches for the instruction, and ignores any


operands. e.g. "STH", "COB".

"Locate Operand" searches for any operand, which can be a reference


to any element or constant. The element type and value must be given,
e.g. "I 0", "COB 10", "1.2". See below for a list of operand types.

"Locate Instruction" searches for the complete instruction line, e.g.


"STH I 0".

"Locate Next" repeats the previous Locate command, searching for the
next occurrence of the item.

The range of memory to be searched can be set using the "From" and
"To" options. Initially, "From" is set to 0, and "To" is set to the
last program line.

During the search, the address being examined is displayed. If the


search is successful, the instruction line is displayed. If the search
fails, the message "NOT FOUND" is displayed. The search can be aborted
at any time by pressing ESCape.

These are the types which can be used in the "Locate Operand" command:

TYPE DESCRIPTION RANGE EXAMPLES


-------------------------------------------------------------------
I Input } Share same 0..8191 I 16 I 8191
O Output } addresses 0..8191 O 32 O 8191
F Flag 0..8191 F 8000 F 0
T Timer } Share same 0..450 T 45 T 0
C Counter } addresses 0..1599 C 100 C 1599
R Register 0..4095 R 1000 R 4095
K K constant, decimal 0..16383 K 1234 K 'A' K 32H
COB Cyclic Org'n Block 0..15 COB 0 COB 15
XOB Exception Org'n Block 0..31 XOB 0 XOB 16
PB Program Block 0..299 PB 12 PB 0
FB Function Block 0..999 FB 10 FB 999
SB Sequential Block 0..31 SB 31 SB 0
ST Step 0..999 ST 999 ST 0
TR Transition 0..999 TR 123 TR 999
TEXT Text (or X) } Share same 0..3999/7999 TEXT 456 X 3999
DB Data block } addresses 0..3999/7999 DB 100 DB 3999
Decimal constant -2147483648..+2147483647
Hex constant 0..FFFFFFFFH 0ABCDEFH 1234H
Binary constant 0Q..1111111111111Q
ASCII constant (1..4 chars) 'a' 'B' '%' 'abc' 'DEAD' etc.
Floating Point (FFP) ±2.710505E-20..±9.223371E+18
ALGI/ALGO channel+base adds 0..7 0..8180 0 0, 3 8181, 3 32
SBUG - Page 57

3.11 Restart
-------------

The "Restart" command has two options, "Restart Cold" and "Restart
Warm". A CPU number can also be supplied, so that individual CPU's
(not just the connected CPU) can be restarted. A Restart command
with no CPU number restarts the connected CPU.

"Restart Cold" simulates a power up of the CPU, the CPU's internal


data tables are set up, and the instruction pointer is set to the
start of the startup Exception Organisation Block 16 (XOB 16), if
present. XOB 16 is therefore executed when the CPU is subsequently
put into Run mode, before starting COB 0.

"Restart Warm" initialises the CPU's internal data tables, but sets
the instruction pointer to the start of COB 0. XOB 16 is NOT executed
when the CPU is put into Run.

A restart MUST be done after program lines have been inserted or


deleted, or the program structure has been changed, see section
3.6.4.

A "rEstart Cold" must be done to recover a CPU from the Halt state.

The following elements are cleared to zero (0) by a restart:

Accumulator and the Status Flags Z, N, E.


All Outputs.
All volatile Flags, see "DEFVM" instruction.
All Timers, see "DEFTC" instruction.
Index Registers.

The following elements are NOT changed by a restart:

Registers and Counters.


Display Register.
Non-volatile Flags.

After the restart, all CPUs remain in Stop, see note below.

Examples:

>rEstart Cold All-cpus (All CPUs restart, and are stopped at )


(the first address of XOB 16. )
>rEstart Warm 3 (CPU 3 does a warm restart, it stops )
(at the first address of COB 0. XOB 16)
(will NOT be executed. )

*** NOTE ***

If the connected CPU is CPU 0, it is not possible to restart only CPU


0, ALL CPUs must be restarted. This is because CPU 0 is the master
CPU, and controls things like the Timers and the internal clock.
SBUG - Page 58

3.12 Clear
-----------

The "Clear" commands can clear (set to zero) all Outputs, all Flags,
all Timers and Counters, all Registers, All-elements (all the
preceding elements), all elements of a Data Block, or clear the
History Table. This command can also delete all program, text and/or
extension memory, see the clear memory commands below.

Before the command is executed the "ARE YOU SURE (Y or N)?" prompt is
displayed, pressing "Y" executes, "N" or ESCape aborts.

The clear media commands are:

Clear Outputs
Clear Flags
Clear Timers+counters
Clear Registers
Clear All-elements
Clear data-Block
Clear History

*** WARNING ***

Clearing elements if any CPUs are running may cause the program to
crash.

Clear memory commands:

Clear Memory (clears all program, text and


extension memory)
Clear Program-memory (clears only program memory)
Clear teXt-memory (clears only text memory)
Clear Extension-memory (clears only extension memory)

Memory can't be deleted unless the CPU is in Stop or Halt. Memory


is cleared by altering the CPU's header (memory map), then issuing
a "restart cold" command. When program memory is cleared, the first
location is set to a NOP instruction.

If the PCD contains EPROM or Flash EPROM, then no memory can be


cleared. However, individual Data Blocks in extension memory can
be cleared (all elements set to zeros) with the "Clear data-Block"
command.
SBUG - Page 59

3.13 Print
-----------

Data output to the display window can also be sent to the printer
or to a log file on the disk, for examination later. Output to the
printer is formatted according to the page format defined on the
"Configure" menu. Output to a file is not formatted.

These are the "Print" commands:

Print Enable Enables output to the printer or the file. If a


file has been opened with the "Print Open-file"
command, output is sent to the file, otherwise it
is sent to the printer.

Print Disable Disables output to the printer or file. If a file


has been opened, it remains open so that output
to the file can be re-enabled. To close the file,
execute the "Print Close-file" command.

Print Open-file Opens a file for output and executes the "Print
Enable" command. If another file is already open,
it is closed first. If the file already exists,
it will be overwritten.

Print Close-file Closes the file and executes the "Print Disable"
command. It is not necessary to close the file
before using the "Quit" command, the file is
automatically closed on exit of SBUG.

Print Page Sends a form feed character to the printer or file.

If the printer is not connected, powered off or not ready, an error


message is displayed whenever the "Print Enable" command is executed,
and the printer will not be enabled. If this occurs during a print,
an error message is displayed and the printer is disabled, another
"Print Enable" command must be executed to resume the print.

This example prints the contents of Registers 0 to 2:

>Print Enable (enable printer)


>Display Register 0 To 2 Hex (print the data)
0000: 00000000H 0001: 12345678H 0002: ABCDEF00H
>Print Disable (disable printer)
>_
SBUG - Page 60

3.14 Help
----------

SBUG is supplied with a "HyperHelp" system consisting of about 300


help screens. Executing the "Help" command displays the main help
index. An item can be selected from the index by moving the cursor
using the ARROW, HOME or END keys, then pressing ENTER. Many of the
help screens contain a highlighted word or phrase, this shows that
the item has its own help screen. To get help on any item, first
select it by moving the cursor onto it, then press ENTER.

The "F1" function key can also be used. If the command line is empty,
F1 displays the main help index. If F1 is pressed during the entry
of a command, then the help page displayed will describe that command.

Use these keys when displaying help:

F1 Returns to the help index.


F9, F10 F9 moves back to the previous help screen that was
displayed, F10 moves to the next help screen. A circular
buffer of the last 50 help screens is stored, F9 and F10
can be used to retrace the help path.
PGUP,PGDN These keys can be used to display the help screens page
by page. Some help items have more than one screen,
indicated by --More-->, pressing PGDN displays the next
page, PGUP displays the previous page.
HOME, END Move the cursor to the first or the last highlighted help
item on the screen.
ARROWS Move the cursor to select a highlighted help item. Pressing
ENTER displays the help screen of the selected item.
ESCape Exits help, and returns to the debug screen.

If the DOS command "SET PCD=path" has been executed, usually from the
AUTOEXEC.BAT batch file, this enables SBUG to locate its help file
SBUG.HLP from any sub-directory. "path" gives the drive and directory
name where SBUG.HLP can be found, usually "C:\PCD".
SBUG - Page 61

3.15 Connect
-------------

When communicating using the S-BUS mode on a multi-station network,


the "cOnnect Station" command can be used to connect to any station
on the network.

If connected to a PCD4, via the PGU or S-BUS modes, the "cOnnect


Cpu" command can select CPU 0 or CPU 1.

The "cOnnect Analyse-sbus-network" command scans all stations, or a


range of stations on an S-BUS network, using one or more baud rates,
and indicates which stations are responding. It displays the the PCD
type of each responding station and the baud rate (110..38'400).
NOTE: PCD5 = PCD6.M5.

This command has this format:

cOnnect Analyse-sbus-network [Baudrate <baud>] <from stn> <to stn>


[All-baudrates ]

For example:

>cOnnect Analyse-sbus-network Baudrate defaulT 0 21


STN TYPE BAUD STN TYPE BAUD STN TYPE BAUD STN TYPE BAUD STN TYPE BAUD
─────────────────────────────────────────────────────────────────────────────
0 PCD6 9600 1 None 2 None 3 None 4 None
5 None 6 None 7 None 8 None 9 None
10 None 11 None 12 None 13 None 14 None
15 None 16 None 17 None 18 None 19 None
20 None 21 None

3.16 Broadcast
---------------

If using S-BUS protocol, a broadcast message can be sent to every


station on the network with the "broAdcast" command. The message
is received and executed by *ALL* stations. It uses S-BUS station
number 255.

*** WARNING ***

The broadcast command is very powerful, and could have a disasterous


effect on program execution in CPUs on the network if they have not
been specifically programmed to accept the command. Before any
broadcast command is executed, the user is prompted "Are your sure
(Y or N) ?". Pressing 'Y' executes the command, 'N' or ESCape aborts.

These broadcast commands are available:

broAdcast Write Allows the same single Output, Flag,


Register, Timer or Counter in every
station on the network to be written
with the same value at the same time.
SBUG - Page 62

Broadcast Command Continued


---------------------------

broAdcast Run-all-cpus Puts all CPUs on the network into Run.

broAdcast Stop-all-cpus All CPUs on the network go into Stop.

broAdcast rEstart-cold-all-cpus
All CPUs on the network are reset and go
into Stop.

broAdcast run-Xob Executes XOB 17, 18 or 19 (if programmed)


in all CPUs on the network. The XOB is
only executed if the CPU is in Run or
Conditional Run. (Requires the latest
PCD firmware).

3.17 Quit
----------

This command exits SBUG and returns to DOS or to the PCD menu.

If batches have been altered and have not been sent to a batch file,
a prompt is displayed:

WARNING: Batches modified but not saved, QUIT (Y or N) ? _

Answering "Y" exits SBUG without saving the altered batches. "N"
aborts the "Quit" operation, allowing a "Batch Save" command to be
done. If no batches have been altered, or a "Batch Save" has already
been done, this prompt does not appear.

If a restart is required after a "Write Program" or "Write teXt",


and the restart has not been done, the prompt is displayed:

WARNING: Restart not done, QUIT (Y or N) ?

Answer "Y" to quit, "N" to stay in SBUG so that the "rEstart Cold"
can be done. NOTE: If the restart is not done, the program may fail
if the CPU is subsequently put into Run.

When "Quit" is executed, the screen is cleared, the printer is de-


initialised if it had been enabled (by a "Print Enable" command). If
a log file is open (by the "Print Open-file" command), it is closed
before exiting.

The PCD is left in its present state, Run or Stop etc.


SBUG - Page 63

4. ERROR REPORTING
===================

All error messages are accompanied by a long beep.

4.1 Miscellaneous Errors


-------------------------

WARNING: CODE OR TEXT HAS BEEN MODIFIED

During a "File Save" command, the code/text checksum and the


checksum in the header are found to be different. This means
that either the code or text has been modified or MEMORY IS
CORRUPTED. The correct checksum is written to the uploaded
.UPL file.

ERROR 0: INVALID VALUE

The data value entered at prompt <value CR> etc is out of


range.

ERROR 1: INVALID TEXT NUMBER

Texts are numbered 0..7999, or 0..4999 for the PCD1,


0..5999 for the PCD2. NOTE: Texts 4000..7999 are stored
in extension memory, and are only available if extension
memory is present.

ERROR 2: TEXT NOT DEFINED

An attempt has been made to edit an undefined text. Use the


"Write teXt" command to create the text.

ERROR 3: TEXT TOO BIG (MAX SIZE 3072 CHARACTERS)

When editing a text using the "Write teXt" command, the


size of the text has exceeded 3K characters.

ERROR 4: NO RESPONSE FROM PCD

Check that the PCD or P800 are properly connected to the


correct serial port, and the correct baud rates and
protocols are selected. This error can also occur if a SASI
instruction has been executed which re-assigns the PGU port.
For an S-BUS connection to the PGU ports of a PCD2, PCD4 or
PCD6.M5, the PCD8.K111 cable is needed, the old K100 and K110
cables will not work with S-BUS.

ERROR 5: BLOCK DOES NOT EXIST

An attempt has been made to load a COB, XOB, PB, FB, ST or TR


from a file using a "File Load" command, but the specified
block does not exist in the file.

ERROR 6: WRITE ERROR ON FILE: filename

A write error occurred while writing this file, the write has
not been completed. The destination disk may not be present,
may be write protected or may be full.
SBUG - Page 64

ERROR 7: READ ERROR ON FILE: filename

A read error occurred, the file read has not been completed.
Either the disk was removed or the file on the disk is
corrupted.

ERROR 8: CAN'T OPEN FILE: filename

The disk file cannot be opened for a read or write operation.


The disk may not be ready, the file may not be present (for
read), the disk or disk directory may be full (for write),
the disk may not be formatted correctly, the file name may
be invalid, or the given directory may not exist.

ERROR 9: BATCH "name" ALREADY EXISTS

An attempt has been made to write, rename or copy to a batch


which already exists. Either write a new batch with another
name, or kill or rename the existing batch.

ERROR 10: BATCH "name" DOES NOT EXIST

An attempt has been made to reference a batch which does not


exist. Load the correct batch file containing the desired
batch, or enter the correct batch name.

ERROR 11: START ADDRESS OUTSIDE CURRENT CODE BLOCK

The start address specified after "From" on the command line


is outside the present block (COB, XOB, FB, PB, SB, ST or TR).
To run from this address, first "Run To" this address.

ERROR 12: INSTRUCTION NOT ALLOWED

Program flow control and definition instructions are not


allowed in the "Instruction" command. See section 3.9.

ERROR 13: INVALID HELP FILE: SBUG.HLP

The help file SBUG.HLP is an old version and cannot be used


with this version of SBUG. Copy the new help file from the
distribution diskette.

ERROR 14: SERIAL PORT COMn NOT PRESENT

The serial port (COM1..COM4) selected for the PCD connection


cannot be used. Select another port from the "Configure/
Serial ports" menu.

ERROR 15: CODE SEGMENT FULL


ERROR 16: TEXT SEGMENT FULL

Either no more program lines or texts can be inserted


because the present code or text segment is full, or there
is not enough memory remaining to load the block or text.
This error also occurs if the CPU has not been allocated a
code or text segment from the "Configure" menu, or the
memory allocation has not been written to the PCD using
the downloader.
SBUG - Page 65

ERROR 17: OUT OF MEMORY

Not enough memory available to execute the operation. If


there are any large memory-resident programs, such as a
RAM Disk, remove these from memory before running SBUG, or
try running PCD menu program with the /X switch.

ERROR 18: INVALID COUNT

The value given for a <count> prompt is greater than


2147483647.

ERROR 19: INVALID BATCH LINE NUMBER

The line number given for a "Batch Edit" command does not
exist in the batch, therefore it cannot be edited.

ERROR 20: INVALID BATCH FILE: filename

The file given in a "Batch Load" command is not a batch


file, or if it is, it has been altered somehow. Batch files
contain a check number which is verified. No batches are
loaded from the invalid file, and existing batches are not
removed from memory.

ERROR 21: TOO MANY BATCHES (MAXIMUM IS 40)

No more than 40 batches are allowed in memory at one time.

ERROR 23: CPU NOT PROGRAMMED

The "File Save" command has no program to save.

ERROR 24: INVALID ADDRESS RANGE OR DATA LENGTH

When writing or displaying Inputs, Outputs or Flags, using


"To" or "Count", the range is invalid or the length of the
value does not match the range. When writing or displaying
Inputs, Outputs or Flags in Decimal, the maximum number of
bits allowed is 32. When writing Outputs or Flags, the
number of elements given in the range must match the number
of elements in the value, Bcd and Hex values require 4 bits
per digit.

ERROR 25: COMMAND NOT ACCEPTED BY PCD (NAK RESPONSE)

The connected CPU cannot execute a command sent by SBUG.


This can occur if connected to a device which does not
support the full P800 or S-BUS protocol, or if password
protection is active and an illegal command is executed.
It can also occur if an invalid batch is executed, which
attempts an an illegal operation due to the CPU's status
(Run, Halt etc). For example, the CPU was in Run, but
halted just before a Stop command was issued. This error
occurs on a PCD2 or PCD4 if an I/O address above 511 is
referenced. NAK is also returned if the PCD is out of
memory.
SBUG - Page 66

ERROR 26: INVALID RESPONSE FROM PCD

This can occur if the PCD or PCD8.P800 contains old


firmware, or the protocol or baud rate is invalid. If
this persists, reset the PCD with a "rEstart Cold" command.

ERROR 27: HEADER NOT INITIALISED

Cannot load or save a file because the connected CPU's


header has not been initialised, or there is no program
name present. This message is also displayed when the
"Display Memory-map" command finds the header is empty and
cannot display any data.

ERROR 28: PCD NOT CONNECTED TO COMn OR POWERED OFF

No debug commands can be executed (except some of the


"Batch" and "Help" commands) until the IBM PC is connected
to a PCD and it's on line. This error sometimes occurs if
the PCD's manual halt switch is operated, because the PCD
is momentarily reset.

ERROR 29: MISSING OPERAND

The instruction entered in an "Instruction" command requires


more operands.

ERROR 30: TOO MANY OPERANDS

The instruction has too many operands.

ERROR 31: ADDRESS NOT AT START OF INSTRUCTION

The "From" or "To" address in a Run or Trace command is not


at the first line of an instruction, it cannot be executed.

ERROR 32: INVALID MNEMONIC

The mnemonic is not a valid PCD instruction mnemonic.

ERROR 33: CAN'T READ HALT REASON

This occurs if reduced protocol is used (if using mode D or


a password protected PCD) because the telegrams to read this
data are not supported.

ERROR 34: INVALID ADDRESS

Bad address value given.

ERROR 35: INVALID FILENAME: filename

Not a valid DOS filename.

ERROR 36: INVALID ABSOLUTE OBJECT FILE

The file to be loaded by a "File Load" command is not a


valid .PCD or .UPL file, or the file checksum is not
correct.
SBUG - Page 67

ERROR 37: NUMBER OF VALUES MUST BE MULTIPLE OF 4

In a "Write" command, where the units are Bcd or Hex, the


address range (using "To" or "Count") must be a multiple
of 4 bits, since Bcd and Hex values are 4-bit values.

ERROR 38: CAN'T WRITE TO EPROM MEMORY

Data in EPROM memory cannot be changed. EPROMS can only be


programmed by the "Program EPROMs" utility. This error also
occurs if an attempt is made to change the size of a text
or DB in extension memory, if the memory map is in EPROM.

ERROR 39: MEMORY WRITE FAILED

While executing a "File Load" command, data could not be


written into the PCD's memory. This can be caused by a write
protected memory card (see write protect jumper), or if not
enough memory exists on the card (missing RAM chips), or if
the wrong sized RAM chip is fitted.

ERROR 40: CAN'T WRITE TO THIS ADDRESS

The program line number selected in a "Write Program" command


is a protected location. This error occurs when the user
attempts to write only the least significant word of a 32-bit
constant.

ERROR 41: ADDRESS OUTSIDE CODE SEGMENT

The specified or next program line number is outside the


connected CPU's code area, and cannot be accessed. The
"CODE USED" value shown by the "Display Memory-map" command
indicates the end of the code area.

ERROR 42: CODE SEGMENT TOO SMALL: HAS nK: NEEDS nK


ERROR 43: TEXT SEGMENT TOO SMALL: HAS nK: NEEDS nK

Attempt to load a program with a code or text size greater


than the size of the connected CPU's memory segment. The
memory allocation must be changed to the "NEEDS nK" size
from the "Configure" menu in order to load this program.

ERROR 44: PCDSETUP.DAT NOT FOUND OR INVALID

The configuration data file PCDSETUP.DAT is needed to


determine which serial port to use when communicating with
PCD and how to format the page when printing. If this
configuration data file can't be found, defaults are used.
PCDSETUP.DAT should be in the PCD utilities directory.

ERROR 45: INVALID ELEMENT OR BLOCK NUMBER

The number of the Input, Register, COB, FB etc. is out of


range.

ERROR 46: NO BATCHES PRESENT

"Batch Save" does not have any batches to save.


SBUG - Page 68

ERROR 47: NEW TEXT, CPU MUST BE IN STOP OR HALT

To create a new text with the "Write teXt" command, the


CPU must be is Stop, Conditional Stop or Halt. If the text
already exists, it can be edited while the CPU is running,
but it is not possible to change its length.

ERROR 49: PRINTER NOT READY

The printer is (or has gone) not ready, SBUG executes a


"Print Disable" command. The printer could be disconnected,
powered off or be out of paper. Once it has been made ready
again, execute the "Print Enable" re-enable printing.

ERROR 50: TEXT SIZE CHANGED, CPU MUST BE IN STOP OR HALT

When editing a text, if the CPU is in Run or Conditional


Run, the size of the text cannot be altered, only over-
writes are permitted. Either correct the text size, or
abort the edit and stop the CPU.

ERROR 51: INVALID VALUE IN <..>, OR MISSING < OR >

A decimal character value in a text, enclosed within angle


brackets <..> is invalid. Allowable values are <1..255>.
Double quotation marks and angle brackets themselves must
also be enclosed by angle brackets: <">, <<> and <>> are
valid.

ERROR 52: INVALID LINE IN BATCH

The batch line is not a valid SBUG command, it cannot be


displayed or executed. This may happen when using batches
written using an old version of SBUG. Edit the batch to
correct it.

ERROR 53: BAD CONNECTION BETWEEN P800 AND PCD6

Usually caused by dirt on the connector pins. Unplug the


PCD8.P800, check it's clean, then re-connect it.

ERROR 54: NOT EXECUTED, ACCU=LOW

Some instructions are executed only if the ACCU is High


(1). This error occurs if one of these is executed by the
"Instruction" command when the ACCU is Low.

ERROR 55: CPU NOT PRESENT

A CPU which is not present cannot be referenced.

ERROR 56: NOTHING TO LOCATE

To execute the "Locate Next" command, an original "Locate"


command must have been entered.
SBUG - Page 69

ERROR 57: INDEX OVERFLOW

The operand address plus the contents of the Index Register


has attempted to access an element which is outside the
addressable range. This error is detected only when single
stepping the program using "Trace". The actual address
accessed is displayed in brackets after the instruction.
XOB 12 (if present) is called to handle the error.

ERROR 58: RESTART REQUIRED

The command cannot be executed unless the connected CPU is


given a "rEstart" command.

ERROR 59: CPU MUST BE IN STOP

The command cannot be executed unless the connected CPU is


in Stop mode. If it's in Halt, a "rEstart" command must
be done first.

ERROR 60: INVALID CPU NUMBER

The PCD2 and PCD6.M5 have one CPU (0). The PCD4 has one or
two CPUs (0 and 1). The PCD6 can have up to seven CPUs (0
to 6).

ERROR 61: THIS COMMAND IS FOR PCD4 ONLY

The command is only valid if connected to a PCD4.

ERROR 62: INVALID DATA BLOCK

The referenced Data Block contains invalid data. If the


program reads this Data Block, the wrong values will be
returned. If this error occurs after a "File Load ...
data-Block" command, the data block is NOT loaded.

ERROR 63: TEXT USED AS DATA BLOCK

The address has already been assigned as a Data Block.


Data Blocks share the same addressing as Texts, if DB 1
is defined then TEXT 1 cannot be used.

ERROR 64: INVALID LAN TEXT

LAN texts are stored in a special binary format, for use


with the LAN2. SBUG converts the text into ASCII for display,
this error occurs if the format is invalid and the text
cannot be converted.

ERROR 65: DATA BLOCK NOT DEFINED

The specified Data Block doesn't exist.

ERROR 66: NOT USING S-BUS PROTOCOL

This command is only valid if S-BUS protocol is being used


for PGU communications. It doesn't work with P800 protocol.
SBUG - Page 70

ERROR 67: INVALID STATION NUMBER

S-BUS stations are numbered 0..254.

ERROR 68: NO RESPONSE FROM S-BUS STATION: n

Connection cannot be made to this station. Check it's


powered on, connected to the S-BUS network, and correctly
configured for S-BUS.

ERROR 69: IN USE AS TEXT

The Data Block has already been assigned as a Text. Data


Blocks and Texts share the same addressing.

ERROR 70: ELEMENT NOT IN DATA BLOCK

An element is not in the Data Block.

ERROR 71: NEW DATA BLOCK OR SIZE CHANGED, CPU MUST BE IN STOP OR HALT

To create a new Data Block or change the size of an


existing Data Block, the CPU must be is Stop, Conditional
Stop or Halt.

ERROR 72: CAN'T DOWNLOAD SB, ST OR TR IF CPU IS IN RUN

If an SB, ST or TR is downloadad with the "File Load"


command, then the CPU's internal ST/TR tables must be
updated by doing a "restart cold". This means that SBs, STs
and TRs cannot be downloaded while the program is running.

ERROR 73: EXTENSION MEMORY NOT PRESENT

Texts and DBs 4000..7999 are located in extension memory,


and cannot be referenced unless this memory exists.

ERROR 74: EXTENSION MEMORY FULL

No new texts or DBs 4000..7999 can be created or loaded.

ERROR 75: CPU HAS CORRUPTED HEADER

Reallocate the memory using the "Up/download" ALLOCATE


MEMORY command, or use "SDNLD /M" from the DOS prompt.
NOTE: This deletes all code, text and extension memory in
all CPUs in the rack!

ERROR 76: EXTENSION MEMORY SEGMENT TOO SMALL: HAS nnK, NEEDS nnK

Increase the size of extension memory from the "Configure/


Hardware and memory" menu and allocate memory again.

ERROR 77: COMMUNICATIONS ERROR (PARITY, FRAMING OR OVERRUN)

Usually caused by incompatible baud rates or comms


protocols.
SBUG - Page 71

ERROR 78: MISSING VALUE

"Write clocK" needs <dd/mm/yy hh:mm:ss>, which is min. 6


values. The '/' and ':' characters can be spaces.

ERROR 79: OPERATION NOT SUPPORTED BY PCD FIRMWARE

Old PCD firmware does not contain the features required by


this operation. Firmware can usually be upgraded, contact
your SAIA representative. NOTE: The PCD8.P800 contains
firmware which may also need upgrading.

ERROR 80: REFERENCED BLOCK NOT DEFINED: <type> <number>

When loading a single block with the "File Load..." command,


SBUG has noticed that it calls blocks or references texts or
DBs which do not exist. The program will fail unless these
blocks are also downloaded. Press 'A' to abort (nothing is
loaded), 'C' to continue or 'I' to ignore all further
undefined references.

ERROR 81: MEMORY MAP IN EPROM, CAN'T CHANGE EXTENSION MEMORY SIZE

If EPROM memory is used, then the extension memory segment


size cannot be changed without re-programming the EPROMs,
the user program would not be able to access it anyway.

ERROR 82: TEXT SEGMENT NOT PRESENT

Texts cannot be downloaded unless a text segment exists.

ERROR 83: CPU NOT IN RUN

The command cannot be executed unless the connected CPU


is in Run or Conditional Run.

ERROR 84: STATION n ALREADY DEFINED

The "Write s-bUs station" command does not allow more than
one S-BUS station with the same number to exist on the same
network, because both stations would go off line.

ERROR 85: INVALID TIMEOUT

The password protection timeout must be 1..60 minutes.

ERROR 86: INVALID PASSWORD

The password entered with the "Write passWord Enter" command


was not valid. Password protection has been enabled.

ERROR 87: MEMORY MAP CORRUPTED OR INVALID

The contents of the connected CPU's memory allocation map


is invalid and the data shown by "Display Memory-map" is
probably incorrect. Reallocate the memory from the
"Up/download" menu.
SBUG - Page 72

ERROR 88: FLASH EPROM MEMORY, CPU MUST BE STOPPED

To make changes to data in Flash EPROM, the CPU must be in


Stop (or Halt). Execute a "Stop" command first.

ERROR 89: FAILED TO CONNECT TO CPU n

The "cOnnect" command failed to connect to the desired CPU


(0 or 1) on the PCD4. This occurs if connected to a PCD4's
serial port which has been configured for S-BUS protocol
with a SASI instruction. The "cOnnect" command only works
for a PGU connection.

ERROR 90: NONVOLATILE REGISTERS OR REG NUMBER NOT SUPPORTED BY PCD


FIRMWARE

The PCD has old firmware/hardware which does not support


nonvolatile registers, or does not support the range of
registers which have been entered. The PCD1 has nonvolatile
registers 0..4, the PCD6.M3 has 0..100.

ERROR 91: NONVOLATILE REGISTERS ARE FOR PCD1 AND PCD6.M3 ONLY

Only the PCD1 and the PCD6.M3 have non-volatile registers.

ERROR 92: UNKNOWN ERROR (PcdComStatus <n>)

An unknown communications error occurred.

ERROR 93: GREATER THAN/LESS THAN, NOT ALLOWED FOR FLOATING POINT VALUE

The PCD cannot use floating point values for Greater-than


and Less-than breakpoints, only Equals and Not-equal-to
can be used.

ERROR 94: CAN'T WRITE TO FLASH EPROM MEMORY

If the PCD contains Flash EPROM, some commands cannot be used


because it is not possible to write to small sections of the
memory. The entire user memory must be loaded in one go using
"File Load".

ERROR 95: CAN'T CHANGE TEXT SIZE IF EPROM OR FLASH EPROM MEMORY

When using "Write teXt", the size of the text cannot be


changed if the connected PCD is fitted with EPROM or Flash
EPROM memory, because the memory mapping is read-only.
SBUG - Page 73

4.2 Assembler and Disassembler Errors


--------------------------------------

These errors occur during the "Write Program", "Display Program",


"Trace", "Run Until Mnemonic", "Run Until instruction-Line" and the
"Instruction" commands. They can also be displayed when the next
program line is shown after a change to Halt, Stop or Conditional
Stop status.

If the error occurs during a "Write Program" or "Instruction" command,


the instruction should be re-entered correctly. If the error occurs
after a displayed program line, the CPU's program is invalid. It must
be corrected before it is executed otherwise the program may not run.

ERROR 101: INVALID MEMORY FLAG

Define write protect instruction (DEFWP), memory flag must


be 1 (memory protected) or 0 (memory not protected).

ERROR 102: INVALID I|O NUMBER


ERROR 103: INVALID FLAG NUMBER
ERROR 104: INVALID T|C NUMBER
ERROR 105: INVALID REGISTER NUMBER

The element number is out of range, see section 1.3.

ERROR 106: INVALID TYPE


ERROR 107: INVALID CONDITION CODE

The medium control code (I|O|F|T|C|R|K|M) or condition


code (L|H|P|N|E|C) is invalid.

ERROR 108: INVALID CONSTANT

The values for constants K are 0..16383, 0..8191 for


the SEI instruction, 0..65535 for LDH and LDL, or
-2147483648..+2147483647 for LD.

ERROR 109: INVALID PB NUMBER

Invalid Program Block number, PBs are 0..299.

ERROR 110: INVALID FB NUMBER

Invalid Function Block number, FBs are 0..999.

ERROR 111: INVALID OPCODE

The opcode of the instruction is not recognised, the


instruction is invalid.

ERROR 112: INVALID OB NUMBER

Invalid Organisation Block number, Exception Organisation


Blocks (XOBs) are 0..31, Cyclic Organisation Blocks (COBs)
are 0..15.
SBUG - Page 74

ERROR 113: INVALID PRIORITY

LAN command priority is 0, 1, 2 or 3.

ERROR 114: INVALID TEXT NUMBER

Texts are numbered 0..7999, or 0..4999 for the PCD1,


0..5999 for the PCD2. NOTE: Texts 4000..7999 are in
extension memory, and are only available if extension
memory is present.

ERROR 115: INVALID TIMEBASE

Timebase in DEFTB instruction is 1..1000.

ERROR 116: INVALID ANALOGUE CHANNEL

The channel for an ALGI instruction is 0..7 (8 channels),


for an ALGO instruction it is 0..3 (4 channels).

ERROR 117: INVALID OPERAND

Operand out of range.

ERROR 118: INVALID OUTPUT NUMBER

Output number out of range, 0..8191.

ERROR 119: INVALID BASE ADDRESS

Base address of Analogue card is 0..8180.

ERROR 120: INVALID NIBBLE NUMBER


ERROR 121: INVALID BIT NUMBER
ERROR 122: INVALID BYTE NUMBER
ERROR 123: INVALID WORD NUMBER
ERROR 124: INVALID LONG WORD NUMBER
ERROR 125: INVALID DIGIT NUMBER

MOV instruction errors.


Digits (4-bits) 0..9
Nibbles (4-bits) 0..7
Bits (32) 0..31
Bytes (8-bits) 0..3
Words (16-bits) 0..1
Long word (32-bits) 0

ERROR 126: INVALID INSTRUCTION

Instruction cannot be assembled or disassembled.

ERROR 127: INVALID SEMAPHORE

LOCK and UNLOCK instructions, semaphore numbers are 0..99.

ERROR 128: INVALID TEST NUMBER

TEST instruction, test numbers are 0..777.


SBUG - Page 75

ERROR 129: INVALID EXPONENT

The correct exponent range is -20..+18.

ERROR 130: INVALID FB PARAMETER

Entry in parameter list of CFB instruction is invalid.

ERROR 131: MISSING OPERAND

The preceding instruction requires more operand lines, or


an MC, CC, SC or operand in missing from the operand line.

ERROR 132: UNEXPECTED OPERAND

An operand is encountered which does not belong to the


preceding instruction.

ERROR 133: OPERAND NOT ZERO

An instruction which requires no operand has a non-zero


operand.

ERROR 134: TOO MANY VALUES

Too many medium control codes or operands etc.

ERROR 135: INCOMPATIBLE DATA SIZES

In a MOV instruction, the source and destination data


sizes must be the same.

ERROR 136: NEGATIVE CONSTANT

The 32-bit constant for this instruction must be positive.

ERROR 137: INVALID RELATIVE ADDRESS

JR instruction address range is -4096..+4095.

ERROR 138: INVALID ACCU STATUS

The Accumulator or Arithmetic Status flags in an ACC


instruction are C|H|L|P|N|Z|E.

ERROR 139: INCOMPATIBLE DATA TYPES

The medium types for the source and destination operands


of STXM and SRXM instructions must be compatible. For
example, if the source is a Register, the destination
cannot be a Flag.

ERROR 140: INVALID SERIAL CHANNEL

Serial channels are 0..3.

ERROR 141: INVALID STATION NUMBER

Station numbers are 0..254.


SBUG - Page 76

ERROR 142: INVALID SWITCH

The SCON instruction switch is either 0 (off) or 1 (on).

ERROR 143: INVALID CONTROL SIGNAL

The control signal in a STHCL (Start High Control Line)


or OUTCL (Out Control Line) is invalid, must be 0..3.

ERROR 144: INVALID SB NUMBER

Sequential Block number are 0..31.

ERROR 145: INVALID ST/TR NUMBER

STep or TRansition numbers are 0..1999.

ERROR 146: INVALID GRAFTEC PARAMETER

The parameter in a Graftec STep or TRansition input/output


list is invalid, I 0..1999, O 0..1999.

ERROR 147: ILLEGAL FB PARAMETER REF

The instruction does not allow FB parameter references,


or the instruction is not inside an FB.

ERROR 148: INVALID FB PARAM NUMBER

FB parameters are numbered 1..255.

ERROR 149: INVALID DATA BLOCK NUMBER

Data Blocks are numbered 0..7999, or 0..4999 for the


PCD1, 0..5999 for the PCD2. NOTE: DBs 4000..7999 are in
extension memory, and are only available if this memory
is present.

ERROR 150: INVALID COUNT

For SRXM/STXM, the number of elements transferred (2nd


operand) is dependent on the element type. For R|T|C,
the maximum is 32, for I|O|F it's 128. For the clock,
CPU status and display register, the count must be 0.

FATAL INTERNAL ERROR: <location>

The program has detected an internal soft error, <location>


indicates the location of the error. The user is prompted
"CAN'T CONTINUE: Press any key to exit", pressing any key
exits to DOS or the PCD menu. Before exiting, <location>
**MUST** be noted and reported to SAIA Technical Support
(attn. MATT HARVEY) with details of **EXACTLY** what
produced the fatal error.
SBUG - Page 77

4.3 Warnings
-------------

WARNING: REFERENCED BLOCK NOT DEFINED: <block type> <block number>

When downloading a single block, the block contains a call


or reference to a block (e.g. FB, PB, Text, DB) which does
not exist. The "ABORT, CONTINUE, IGNORE ALL (A, C or I) ?"
prompt is displayed. Press 'A' to abort the download, 'C'
to continue the download or 'I'to ignore any subsequent
reference errors.

WARNING: CODE OR TEXT HAS BEEN MODIFIED

During a "File Save" command, the code/text checksum and


the checksum in the header are found to be different. This
means that either the code or text has been modified or
MEMORY IS CORRUPTED. The correct checksum is written to
the uploaded .UPL file.

WARNING: File pcdsetup.dat exits, overwrite it (Y or N) ?

"File get-pcdsetup" command warning. You are about to


overwrite the old off-line configuration in PCDSETUP.DAT.

WARNING: This will reset all cpus!! Continue (Y or N) ?

Downloading a new program with "File Load" resets all CPUs


in the PCD. Outputs may also be turned off, see the "Clear
all outputs" setting.

WARNING: Old firmware, outputs will be cleared!! Continue (Y or N) ?

The PCD's formware does not support "NO" for the "Clear all
outputs" setting. All outputs will be cleared anyway.

WARNING: Program requires <PCD version> or above. Continue (Y or N) ?

The PCD does not have the required firmware version. There
are instructions in the .PCD file which WILL NOT RUN on
this PCD.

WARNING: Program is for <PCD type> only. Continue (Y or N) ?

The PCD is the wrong type. There are instructions in the


.PCD file which WILL NOT RUN on this PCD.

WARNING: Program is for cpu <n> only. Continue (Y or N) ?

The .PCD file was designed to run on CPU <n> only, it will
probably not run correctly on the connected CPU.

WARNING: Program is for s-bus station <n> only. Continue (Y or N) ?

The .PCD file was designed to run on S-BUS station <n>


only, it will probably not run correctly on the connected
station.
SBUG - Page 78

WARNING: Batches modified but not saved, QUIT (Y or N) ?

One of the Batch commands has been used to edit the batches
in memory, and they have not yet been saved to the hard
disk. Answer 'Y' to exit WITHOUT SAVING. Answer 'N' to stay
in SBUG so the "Batch Save" command can be used.

WARNING: Restart not done, QUIT (Y or N) ?

The program in the connected PCD's memory has been modified,


and the PCD should not be put into Run until a "Restart" is
done. If SBUG is exited, the "Run" command will not be
disabled.
SBUG - Page 79

4.4 Halt and History Messages


------------------------------

If the connected CPU halts, a message similar to the following is


displayed, which indicates the location, reason, date and time of
the halt:

HALTED: 000160 HALT INSTRUCTION 12/10/87 11:03:34


│ │ │
│ │ └──── Date and time of halt
│ └───── Reason for halt
└──── Address when the Halt occurred - either decimal
or hex. If this is a 6-digit decimal value, then
it's a user program line number. If it's an 8-digit
hexadecimal value, then it's an internal processor
address.

Halts can be caused by fatal software errors in the user program,


parity errors on the CPU bus, absence of code, execution of a
HALT instruction etc. All halts, except those caused by the HALT
instruction, are also logged in the History Table, which can be
viewed with the Display History command.

An XOB can be programmed to handle certain errors. If the XOB is


present, the CPU executes the XOB and continues processing. If the
XOB is not programmed, or can't be programmed, the ERROR LED is lit,
and for XOBs with a 'Y' in the HALT column the CPU will HALT.

SERIOUS SYSTEM HARDWARE ERRORS


These errors are detected on POWER UP of the PCD, no XOB can be
programmed.

MESSAGE │ HALT │ PCD TYPE│ MEANING


─────────────────┼──────┼─────────┼───────────────────────────────────
RTC FAILURE │ Y │ 2,4,5,6 │ Real Time Clock is present but
│ │ │ not working.
DUART HW ERROR │ Y │ 2,4,5,6 │ One of the DUARTs is defective.
CHECKSUM FAIL │ Y │ 2,4,5,6 │ User program EPROM checksum fail.
BAD TXT/DB TABLE │ Y │ 2,4,5,6 │ Text/DB memory corrupted.
TXT/DB HW ERROR │ Y │ 2,4,5,6 │ Text/DB memory corrupted.
BAD MEM EXT INIT │ Y │ 2,4,5,6 │ Extension memory corrupted.
USR MEM HW ERROR │ Y │ 6 only │ User memory test failed.
CPU SYNCH ERROR │ Y │ 6 only │ Synch. error, CPU not running?
SBUG - Page 80

ERRORS WHICH EXECUTE AN XOB (if programmed)

MESSAGE │ HALT │ XOB │ PCD TYPE│ MEANING


─────────────────┼──────┼─────┼─────────┼─────────────────────────────
XOB START EXEC │ N │ 0 │ 2,4,5,6 │ XOB 0 has been started.
XOB 0 EXECUTED │ N │ 0 │ 2,4,5,6 │ XOB 0 has been completed
│ │ │ │ during a power down.
EXTERN PWR FAIL │ N │ 1 │ 2,5,6 │ Extension rack power
│ │ │ │ failure.
PARITY FAILURE │ N │ 4 │ 5,6 │ PCD6 backplane error.
>32 ST/TR ACTIVE │ N │ 9 │ 2,4,5,6 │ Too many active Graftec
│ │ │ │ tasks (TRs)
>7 CALL LEVELS │ N │ 10 │ 2,4,5,6 │ PB/FB nesting depth
│ │ │ │ overflow.
BATT FAIL nnn │ N │ 2 │ 2,4,5,6 │ The battery is flat.
IO QUIT FAIL nnn │ N │ 5 │ 4,5,6 │ An I/O which is not
│ │ │ │ present has been accessed.
IR OVERFLOW nnn │ N │ 12 │ 2,4,5,6 │ Index register incremented
│ │ │ │ beyond 8191.
ERROR FLAG 000 │ N │ 13 │ 2,4,5,6 │ Error flag set.

SERIOUS SYSTEM FIRMWARE ERRORS


These errors are written into the HALT REASON register which is
displayed by SBUG when a HALT is detected. They can occur on POWER
Up or when the PCD is in RUN.

MESSAGE │ HALT │ PCD TYPE│ MEANING


─────────────────┼──────┼─────────┼───────────────────────────────────
BUS QUIT FAILURE │ Y │ 2,4,5,6 │ FW has attempted to access non-
│ │ │ existant address.
68K INVALID OPC │ Y │ 2,4,5,6 │ Invalid 68000 instruction executed.
68K ADDR ERROR │ Y │ 2,4,5,6 │ Attempted to access an odd address.
ZERO DIVIDE │ Y │ 2,4,5,6 │ ─┐
68K CHK INSTR │ Y │ 2,4,5,6 │ │
68K TRAPV INSTR │ Y │ 2,4,5,6 │ │
PRIVILEGE VIOL │ Y │ 2,4,5,6 │ ├─ Internal system FW errors.
TRACE │ Y │ 2,4,5,6 │ │
INTERRUPT ERROR │ Y │ 2,4,5,6 │ │
ILLEGAL AUTO VEC │ Y │ 2,4,5,6 │ ─┘
SBUG - Page 81

START-UP MESSAGES
The following errors can be detected on POWER UP of the PCD.

MESSAGE │ HALT │ PCD TYPE│ MEANING


─────────────────┼──────┼─────────┼─────────────────────────────────
EVERYTHING IS OK │ N │ 2,4,5,6 │ Normal power up message.
MODIFIED PROGRAM │ N │ 2,4,5,6 │ User program has been modified
│ │ │ by SBUG. Only indicated when the
│ │ │ usre program is write protected.
CPU NUMBER > 6 │ Y │ 6 │ The CPU number set by the DIL
│ │ │ switches is invalid.
CPU 0 START FAIL │ Y │ 4,5,6 │ CPU 1-6 only: No CPU can be put
│ │ │ in RUN without a program in CPU 0.
INIT FAILURE │ Y │ 2,4,5,6 │ More than 32 Graftec Initial
│ │ │ Steps (ISTs) have been defined.
HEADER FAIL │ Y │ 2,4,5,6 │ User program header is corrupted.
NO PROGRAM │ Y │ 2,4,5,6 │ CPU has no program to execute.
MEM EXT CORRUPT │ Y │ 2,4,5,6 │ Extension memory corrupt (PCD2
│ │ │ X/DB >5999?)
INVALID OPCODE │ Y │ 2,4,5,6 │ An invalid instruction has been
│ │ │ found in the user program.
MEMORY LOSS │ Y/N │ 2,4,5,6 │ Caused by battery failure:
│ │ │ - User program in RAM - HALT
│ │ │ - User program WP or EPROM. Use
│ │ │ the TEST 400 instruction to
│ │ │ detect the error.
MISSING MEM PACK │ Y │ 4 │ Memory module not fitted.
RTC NOT EQUIPPED │ N │ 4 │ The real-time clock on the PCD4's
│ │ │ memory module is not present or
│ │ │ is faulty.

The following errors will be detected while the PCD is in RUN, those
which put the PCD into HALT will also write the message into the
HALT REASON REGISTER.

MESSAGE │ HALT │ PCD TYPE│ MEANING


─────────────────┼──────┼─────────┼──────────────────────────────────
BLOC NONEXISTANT │ Y │ 2,4,5,6 │ Call to missing PB, FB, SB, ST or
│ │ │ TR.
HALTED BY LAN-2 │ Y │ 4,6 │ The LAN-2 coprocessor has put the
│ │ │ PCD into HALT.
LAN-2 WATCHDOG │ N │ 4,6 │ The LAN-2 FW watchdog has been
│ │ │ activated.
HALT INSTRUCTION │ Y │ 2,4,5,6 │ A HALT user instruction has been
│ │ │ executed.
MANUAL HALT │ Y │ 4,5,6 │ CPU has been halted by the HALT
│ │ │ switch.
HALTED BY CPU 0 │ Y │ 4,6 │ The coprocessor(s) have been
│ │ │ halted by CPU 0.
SBUS-PGU ERROR │ N │ 2,4,5,6 │ Invalid SASI assignment of S-BUS
│ │ │ PGU port.
SBUG - Page 82

5. COMMAND SYNTAX DIAGRAMS


===========================

The following diagrams detail the syntax of all the SBUG commands.
To read the diagrams, start at the left, find the box containing the
desired command word, such as "Run", then move from box to box from
left to right, entering each box from the left, and exiting from the
right. The right-hand margin implies <CR> carriage return.

Words enclosed in angle brackets "<..>" are data descriptions, all


other words are command words, each with one capital command character.

Note that the order of commands in these diagrams is not necessarily


the order in which they appear on the prompt line.
SBUG - Page 83

╒═════════════════════════════════════════════════════════════════════╕
│ Run │
│ ╒══════════════════════════════════════════════════════════════╡
│ │ <cpu number 0-6> │
│ │ All-cpus │
│ ╞══════╤═══════════════════════════════════════════════════════╡
│ │ Xob │ 17 | 18 | 19 │
│ ╞══════╧═══════════════════════════════════════════════════════╡
│ │ From <address> │
│ │ ╒═════════════════════╤═════════════════════════════════╡
│ │ │ Count <count> │ │
│ │ │ Until { BP } │ ╒════╤═════════════════════╡
│ │ │ │ │ Or │ Count <count> │
│ │ │ │ │ │ Until { BP } │
│ │ ╞════╤════════════════╡ │ ╞════╤════════════════╡
│ │ │ To │ <address> │ │ │ To │ <address> │
│ │ │ ╞═════╤══════════╡ │ │ ╞═════╤══════════╡
│ │ │ │ Cob │ <number> │ │ │ │ Cob │ <number> │
│ │ │ │ Xob │ │ │ │ │ Xob │ │
│ │ │ │ Pb │ │ │ │ │ Pb │ │
│ │ │ │ Fb │ │ │ │ │ Fb │ │
│ │ │ │ St │ │ │ │ │ St │ │
│ │ │ │ Tr │ │ │ │ │ Tr │ │
│ ╘══════╡ ╞═════╧══════════╡ │ │ ╞═════╧══════════╡
│ │ │ End-of-block │ │ │ │ End-of-block │
╘═════════════╧════╧════════════════╧══════╧════╧════╧════════════════╛

Where breakpoint { BP } ::=


╒════════════════════════════════╤══════════════════════════════════╕
│ Accu │ 0 │
╞═════════════════════╤══════════╡ 1 │
│ Input │ <number> │ │
│ Output │ │ │
│ Flag │ │ │
╞═════════════════════╧══════════╪══════════════════════════════════╡
│ Status-flag │ Zero │
│ │ nOn-zero │
│ │ Positive │
│ │ Negative │
│ │ Error │
╞════════════════════════════════╪══════════════╤═══════════════════╡
│ Display-register │ Equals │ <value> │
│ iNdex-register │ Not-equal-to │ ╒══════════╡
╞═════════════════════╤══════════╡ Greater-than │ │ Decimal │
│ Register │ <number> │ Less-than │ │ Bcd │
│ Counter │ │ │ │ Hex │
│ Timer │ │ │ │ binarY │
│ │ │ │ │ Float (1)│
│ │ │ │ │ Ascii (1)│
╞═════════════════════╧══════════╪══════════════╪════════╧══════════╡
│ instruction-Pointer │ Equals │ <address> │
│ │ Not-equal-to │ │
│ │ Greater-than │ │
│ │ Less-than │ │
╞════════════════════════════════╪══════════════╧═══════════════════╡
│ Mnemonic │ <mnemonic> │
╞════════════════════════════════╪══════════════════════════════════╡
│ instruction-Line │ <mnemonic [mc] [operand]> │
╘════════════════════════════════╧══════════════════════════════════╛
(1) Floating-point & Ascii units for Register only.
SBUG - Page 84
╒══════════════════════════╕
│ Stop │
│ ╒══════════════════╡
│ │ <cpu number 0-6> │
│ │ All-cpus │
╘═══════╧══════════════════╛

╒═════════╤══════════════════════════════════════════════════════════════╕
│ Display │ Accu (1) │
│ ╞══════════════════════════════════════════════════════════════╡
│ │ iNdex-register (1) │
│ ╞══════════════════════════════════════════════════════════════╡
│ │ cpu-Status │
│ ╞══════════════════════════════════════════════════════════════╡
│ │ Memory-map │
│ ╞══════════════════════════════════════════════════════════════╡
│ │ History │
│ ╞══════════════════════════════════════════════════════════════╡
│ │ Exec-path │
│ ╞══════════════════════════════════════════════════════════════╡
│ │ s-bUs │
│ ╞════════════╤══════════════════════════════════╤══════════════╡
│ │ Input │ <number> │ │
│ │ Output │ ╒══════════╡ │
│ │ Flag │ │ Decimal │ │
│ │ Register │ │ Bcd │ │
│ │ Counter │ │ Hex │ │
│ │ Timer │ ╒═══════════════╡ binarY │ ╒═════════│
│ │ data-Block │ │ To <number> │ Float (2)│ │ Refresh │
│ │ │ │ Count <Count> │ Ascii (2)│ │ (3) │
│ │ │ │ ╘══════════╡ │ │
│ │ │ │ │ │ │
│ ╞════════════╧═══════╧══════════════════════════╡ │ │
│ │ Display-register │ │ │
│ ╞═══════════════════════════════════════════════╡ │ │
│ │ clocK │ │ │
│ ╞════════════╤════════════════╤═════════════════╧════╧═════════╡
│ │ Program │ <address> │ │
│ │ ╞═════╤══════════╡ │
│ │ │ Cob │ <number> │ │
│ │ │ Xob │ │ ╒═════════╡
│ │ │ Pb │ │ │ Refresh │
│ │ │ Fb │ │ ╒═════════════════╡ │
│ │ │ sB │ │ │ To <addresss> │ │
│ │ │ St │ │ │ Count <count> ╘═════════╡
│ │ │ Tr │ │ │ │
│ ╞════════════╧═════╧══════════╧════╧═══════════════════════════╡
│ │ teXt <number> │
│ │ ╒═════════╡
│ │ │ Ascii │
│ │ ╒════════════════╡ Decimal │
│ │ │ To <number> │ Hex │
│ │ │ Count <count> ╘═════════╡
│ │ │ │
╘═════════╧═══════════════════════════════════╧══════════════════════════╛

(1) Not available when in Run or Conditional Run.


(2) Floating-point & Ascii units for Register and data-Block only.
(3) "Refresh" option not available for "Display data-Block"
SBUG - Page 85

╒═══════╤═════════════════════════════╤═══════════════════════════════╕
│ Write │ Accu (1) │ 0 │
│ │ │ 1 │
│ ╞═════════════╤═══════════════╡ │
│ │ Status-flag │ Zero │ │
│ │ (1) │ Negative │ │
│ │ │ Positive │ │
│ │ │ Error │ │
│ ╞═════════════╪═══════════════╡ │
│ │ Output │ <number> │ │
│ │ Flag │ ╒════╧═══════════════════════════════╡
│ │ │ │ Manual (2) │
│ │ │ ╞═══════════════╤════════════════════╡
│ │ │ │ To <number> │ <value> │
│ │ │ │ Count <count> │ ╒═══════════╡
│ ╞═════════════╪══════════╧═══════════════╡ │ Decimal │
│ │ Register │ <number> │ │ Bcd │
│ │ Timer │ │ │ Hex │
│ │ Counter │ ╒═══════════════╡ │ binarY │
│ │ │ │ To <number> │ │ Float (3) │
│ │ │ │ Count <count> │ │ Ascii (3) │
│ ╞═════════════╧═════╤════╧═══════════════╧════════╧═══════════╡
│ │ iNdex-register (1)│ <value> │
│ ╞═══════════════════╪═════════════════════════════════════════╡
│ │ Program │ <address> │
│ ╞═══════════════════╪═════════════════════════════════════════╡
│ │ teXt (2) │ <number> │
│ ╞═══════════════════╪═════════════════════════════════════════╡
│ │ clocK │ <dd/mm/yy hh:mm:ss [week [day]] > │
│ ╞════════════╤══════╧═════════════════════════════════════════╡
│ │ data-Block │ <number> │
│ │ │ ╒═════════════════════════════════════════╡
│ │ │ │ Element <element> │
│ │ │ │ ╒═════════╡
│ │ │ │ │ Decimal │
│ │ │ │ ╒═════════╡ Hex │
│ │ │ │ │ <value> │ Float │
│ │ │ │ ╒═══════════════╡ │ Ascii │
│ │ │ │ │ To <element> │ ╘═════════╡
│ │ │ │ │ Count <count> │ │
│ │ │ ╞═════╧═══════════════╧═══════════════════╡
│ │ │ │ Size <size> │
│ ╞════════════╧══════╧═════════════════════════════════════════╡
│ │ s-bUs station <station number> │
│ ╞══════════╤══════════════════════════════════════════════════╡
│ │ passWord │ Change <current password> <new password> │
│ │ │ New <password> ╒═══════════╡
│ │ │ │ <timeout> │
│ │ ╞═════════╤════════════════════════════╧═══════════╡
│ │ │ Enter │ <current password> │
│ │ │ Remove │ │
╘═══════╧══════════╧═════════╧════════════════════════════════════════╛

(1) Not available when in Run or Conditional Run.


(2) Not available in "Batch Write".
(3) Floating-point & Ascii units for "Write Register" only.
SBUG - Page 86

╒══════╤═══════════════════════════════════════════╕
│ File │ Load │
│ │ ╒════════════════════════════════════╡
│ │ │ <filename> │
│ │ │ ╒══════════════════╤══════════╡
│ │ │ │ Cob │ <number> │
│ │ │ │ Xob │ │
│ │ │ │ Pb │ │
│ │ │ │ Fb │ │
│ │ │ │ sB │ │
│ │ │ │ St │ │
│ │ │ │ Tr │ │
│ │ │ │ tExt │ │
│ │ │ │ Data-block │ │
│ │ │ │ exteNsion-memory │ │
│ ╞══════╧══════╧══════════════════╧══════════╡
│ │ Save │
│ │ ╒═════════════════════════════╡
│ │ │ <filename> │
│ ╞═════════════╡ │
│ │ View │ │
│ ╞═════════════╡ │
│ │ Compare │ │
│ ╞═════════════╧═════════════════════════════╡
│ │ Directory │
│ │ ╒═════════════════════════════╡
│ │ │ <filename mask> │
│ ╞═════════════╧═════════════════════════════╡
│ │ Get-pcdsetup │
│ ╞══════════════════╤════════════════════════╡
│ │ set-load-Options │ Clear-all-outputs │
│ │ │ Run-all-cpus │
╘══════╧══════════════════╧════════════════════════╛
SBUG - Page 87

╒═══════╤═════════════════════════════════════════════════════════╕
│ Batch │ Display │
│ │ ╒═══════════════════════════════════════════════╡
│ │ │ <batch name> │
│ ╞═════════╡ │
│ │ Write │ │
│ │ Kill │ │
│ ╞═════════╧═══════════════════════════════════════════════╡
│ │ Load │
│ │ ╒═══════════════════════════════════════════════╡
│ │ │ <batch file name> │
│ │ │ ╒══════════════════════════│
│ │ │ │ <batch name> │
│ ╞═════════╧════════════════════╧══════════════════════════╡
│ │ Save │
│ │ ╒═══════════════════════════════════════════════╡
│ │ │ <batch file name> │
│ ╞═════════╪══════════════╤════════════════════════════════╡
│ │ Edit │ <batch name> │ <line number> │
│ ╞═════════╪══════════════╧════════════════════════════════╡
│ │ Run │ <batch name> │
│ │ │ ╒════════════════╡
│ │ │ │ Nodisplay │
│ │ │ ╒═══════════════╡ │
│ │ │ │ Count <count> │ │
│ │ │ │ ╘════════════════╡
│ │ │ │ │
│ ╞═════════╪══════════════╪════════════════════════════════╡
│ │ Copy │ <batch name> │ <new batch name> │
│ │ reName │ │ │
╘═══════╧═════════╧══════════════╧════════════════════════════════╛

╒═══════╤═══════════════════════╕
│ Clear │ Outputs │
│ │ Flags │
│ │ Timers+counters │
│ │ Registers │
│ │ All-elements │
│ │ History │
│ │ data-Block │
│ │ │
│ │ Memory (1) │
│ │ Program-memory (1) │
│ │ teXt-memory (2) │ (1) Not available when in
│ │ Extension-memory (1) │ Run or Conditional Run,
╘═══════╧═══════════════════════╛ also clears Data Blocks.
SBUG - Page 88

╒═══════╤═══════════════════════╕
│ Print │ Enable │
│ │ Disable │
│ │ Page │
│ │ Open-file <filename> │
│ │ Close-file │
╘═══════╧═══════════════════════╛

╒═════════╤═════════════════════════╕
│ rEstart │ Cold │
│ │ Warm │
│ │ ╒══════════════════╡
│ │ │ <cpu number 1-6> │
│ │ │ All-cpus │
╘═════════╧══════╧══════════════════╛

╒═════════════════════════════════════════════════════════════╕
│ Trace │
│ ╒══════════════════╡
│ │ To <address> │
│ ╒═════════════════╡ Count <count> │
│ │ From <address> │ │
│ ╒══════════╕ │ ╘══════════════════╡
│ │ No-Calls │ │ │
│ ╞══════════╧════╧═════════════════╤══════════════════╡
│ │ Mode │ One-block │
│ │ │ All-blocks │
╘════════╧═════════════════════════════════╧══════════════════╛

╒═════════╤═══════════════════════════════════════════════════╕
│ Locate │ ╒nstruction <mnemonic [mc] [operand]> │
│ ╞═══════════════════════════════════════════════════╡
│ │ Mnemonic <mnemonic> │
│ ╞═══════════════════════════════════════════════════╡
│ │ Operand <[type] value> │
│ ╞═══════════════════════════════════════════════════╡
│ │ Next │
│ ╞═══════════════════════════════════════════════════╡
│ │ From <address> │
│ │ ╒═════════════════════════════════╡
│ │ │ To <address> │
│ ╘═════════════════╡ │
│ │ │
╘═══════════════════════════╧═════════════════════════════════╛
SBUG - Page 89

╒═══════════╤═════════╤══════════╤══════════╤═══════════════════════╕
│ broAdcast │ Write │ Output │ <number> │ 0 │
│ │ │ Flag │ │ 1 │
│ │ ╞══════════╪══════════╪═══════════════════════╡
│ │ │ Register │ <number> │ <value> │
│ │ │ Timer │ │ ╒═════════════╡
│ │ │ Counter │ │ │ Decimal │
│ │ │ │ │ │ Bcd │
│ │ │ │ │ │ Hex │
│ │ │ │ │ │ binarY │
│ │ │ │ │ │ Float (1) │
│ │ │ │ │ │ Ascii (1) │
│ │ ╞══════════╪══════════╧═════════╧═════════════╡
│ │ │ clocK │ <dd/mm/yy hh:mm:ss [week [day]]> │
│ ╞═════════╧══════════╧══════════════════════════════════╡
│ │ Run-all-cpus │
│ ╞═══════════════════════════════════════════════════════╡
│ │ Stop-all-cpus │
│ ╞═══════════════════════════════════════════════════════╡
│ │ rEstart-cold-all-cpus │
│ ╞═════════╤═════════════════════════════════════════════╡
│ │ run-Xob │ 17 │
│ │ │ 18 │
│ │ │ 19 │
╘═══════════╧═════════╧═════════════════════════════════════════════╛

(1) Floating-point & Ascii units for "broAdcast Write Register" only.

*** END SBUG.DOC ***


***********************************************************************
* *
* SAIA PCD OFFLINE CONFIGURATOR *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME SCONFIG.DOC *
* AUTHOR Matt Harvey, SAIA Murten *
* *
***********************************************************************

REVISION HISTORY
05-Jan-98 V2.1
1) Supports 512KB RAM/EPROM/Flash EPROM for PCD2.
2) Added ERROR 29: CODE MUST BE MULTIPLE OF xxK FOR FLASH EPROM
and ERROR 30: TEXT/DB MUST BE MULTIPLE OF xxK FOR FLASH EPROM

10-Oct-97 V2.1 Beta-C


1) The S-BUS serial port can now be set as "PC/104" to
allow direct connection between the PC/104 and PCD2 in
a PCD2.M220 system.

21-Mar-97 $208
1) PCD1 can now have 13KB extension memory.
2) Now supports PCD6.M3.
3) Added "Serial port for S-BUS MODEM" to "Serial ports for
PC" menu and improved the screen's texts and layout.
4) PCD1 and PCD2 can now have flash eprom (128KB=112KB prog).
5) Added "BreakMode" value to MODEM.DAT file, see 2.7.1.
6) Add note on break mode and the break length, section 2.7.2.

15-Jan-97 $205
1) Added S-BUS "Data" mode selection to "S-Bus communications"
and "Gateway master port" menus.

21-Jun-96 V2.0

01-Nov-95 $199
1) Port 0 can now be used as the gateway port on all PCD types
(was only on PCD6).

16-Oct-95 $198
1) Modifications for PCD1.
2) "Serial port for P800 connection" now called the "Serial
port for PGU connection".
3) Added ERROR 28: GATEWAY NOT SUPPORTED BY PCD1 and
WARNING 5: PGU CONNECTION BAUD RATE IS NOT 9600.

24-Apr-95 V1.9

10-Apr-95 $18C
1) If the PCDCOLOR.DAT file in the PCD Programming Utilities
directory was read only, because it was on a network drive
or had the read-only attribute set, then SCONFIG did not
issue an error message if it tried to update PCDCOLOR.DAT
when the color set was changed (sometimes a brief "Access
denied" message displayed by DOS was visible).
SCONFIG now checks for this and issues "ERROR 27: ACCESS TO
MASTER PCDCOLOR.DAT FILE DENIED", and the prompt "Create
PCDCOLOR.DAT file in the current directory (Y or N) ?" is
displayed. This creates a PCDCOLOR.DAT file in the current
directory which is used instead of the one in the main PCD
programming utilities directory.

13-Mar-95 $18B
1) Added "Auto-answer on" and "Auto-answer off" strings to
"Modem for PCD" menu, see 2.7.

06-Feb-95 $18A
1) Re-designed the main menu and added the new "Gateway
master port" configuration screen, see sction 2.6.
2) Each modem type now has separate PCDReset and PCDInit
strings which are displayed on the "Configure/Modem for
SAIA PCD" menu. These replace the "Reset" and "AnswerOn"
strings of $187, and allow the PC and the PCD to have
different PC and PCD reset and init strings for the same
modem type, if required.
3) WARNING messages are now numbered. Added warnings 3 and 4.
Added ERROR 26.

19-Jul-94 $187
1) SWMR 652: S-BUS mode (Break/Parity) is now selectable from
the "s-Bus communications" screen.
2) Added "Modem for SAIA PCD" screen , changed "Modem type" to
"Modem for PC". 'Modem reset' and 'auto-answer' on strings
can now be chosen for the SAIA PCD.
3) Added selected CPU type description to "S-BUS communications"
screen.
4) Added section 2.6.2 "Important notes on modem configuration".
5) Added "WARNING: PCD'S S-BUS PGU PORT NOT CONFIGURED FOR
PUBLIC LINE MODEM" and "WARNING: PORT COMn DOESN'T EXIST".

12-Nov-93 $179
1) SWMR 575: TS delay, TN delay and Timeout are now ALWAYS used
for S-BUS comms (were only used for modems). Changed text on
"Serial ports" and "s-Bus communications" screens.

24-Sep-93 $175/V1.71
1) SWMR 541 & 542: "Echo=yes/no" now removed from modem
configuration. If the modem echoes command characters
these are now ALWAYS ignored because we don't know if the
modem is in echo on mode or not. Responses from the modem
are now recognized by being delimited with CR & LF, e.g.
<CR><LF>OK<CR><LF>, so they are not confused with command
characters which may be (or may not be) echoed back.
2) "Reset modem" string now displayed on "modem type" menu.
3) SWMR 548: The break length has been modem from the "Modem
type" screen to the "Serial ports" screen. BreakLen has
been removed from the MODEM.DAT file and is now in the
PCDSETUP.DAT file.
09-Jun-93 V1.7
1) New "Hardware and memory" menu. Defines the PCD type and
memory allocation, including extension memory (which was
called data memory).
2) New "s-Bus communications" menu for defining the S-BUS
station number and PGU port.
3) New "Modem type" menu, which selects the modem type from
those defined in the MODEM.DAT file.
4) Graftec code edtor name can now be entered (default SEDIT).
5) Separate serial ports and baud rates can now be selected for
P800, S-BUS and the EPROM programmer.
6) Section 3 Configuration Data removed. This is described in
PG3's source code documentation.
7) New errors 20 to 25.

28-May-92
1) Data memory allocation added for PCD6, completely new
"Memory, PCD, S-BUS" menu.
2) Memory allocation now has 4-digit input fields, to support
values up to 1024K (was max. 999K).
3) New error message "ERROR 19: EXACTLY nKB OF DATA MEMORY MUST
BE ALLOCATED".
4) If the PCDCOLOR.DAT file is not found or invalid, the default
colour set is used if a colour screen is present (monochorome
was used before even on a color screen).

06-Dec-91 $154
1) Baud rate for P800/PGU can now be entered on the "Serial
ports" menu (SWMR 120).
2) "Colour set" screen now shows Graftec editor colours.
3) Now has F1=hyperhelp.
4) Add errors 14 to 18.

06-Oct-91 $153
1) New PCD6.R600 memory module is selectable (512KB, 768KB or
1024KB).
2) Memory allocation now allows code up to 256K lines and text
segment up to 999K characters.

23-Aug-91 $152
1) SWMR 199 and 130: Min. chars per line now 40 (was 80).
2) Change "Memory and PCD type" to "Memory, PCD, S-BUS".
Add "S-BUS station number" to the sub-menu, see 2.7.
New ERROR 13.
3) SGRAF data is no longer in the PCDSETUP.DAT file (moved
to PCDMENU.DAT).

07-Sep-90 V1.4
1) SWMR 121. Can now select 64, 128 or 256K byte memories for
PCD4 (support for PCD7.R1 memory card). Changed text on
memory allocation menu.
22-Nov-89 V1.3
1) Now called SCONFIG, was called SINSTALL. Changed name because
"install" has the wrong meaning, "configure" is a more accurate
description.
2) User selectable Editor and Word processor programs. EXE, COM
or BAT file names can be entered (defaults to SEDIT and PE)
(SWMR 24).
3) Add memory card selection (SWMR 25).
4) Printer configuration now accepts 80 to 200 characters per
line (SWMR 35).
5) Add PCD4/PCD6 selection (SWMR 74)
6) Now works in colour as defined in PCDCOLOR.DAT.
7) Now has colour select menu which selects the colour set for
the entire package. This copies a chosen file (PCDCOLOR.n
to PCDCOLOR.DAT).
8) Now allows selection of COM1, COM2, COM3 or COM4 for PCD and
Eprom Programmer.
9) New default memory maps for PCD6 and PCD4.
10) PCDSETUP.DAT file now contains SGRAF data for D.Lüthi.
11) New format for "List" command output.

02-Dec-88 V1.2
1) INSTALL.DAT install data file now named PCDSETUP.DAT.
2) "pRint setup" command changed to "List the setup".
3) Registered user name now in a pretty box, to match
the main menu.

23-Mar-88 V1.1
1) New text on Memory allocation menu, to briefly describe
how to partition the R511 and R512 RAM cards, which don't
have a full 64K of memory (2.7).
2) Add Registered User name to main menu, shortened text on
main menu to allow it to fit.
3) Install data file format changed. It now contains the
Registered User name and a Package Indicator flag. The
file is also encrypted. The description of this file has
been removed from this document.
4) Text segment size in memory allocation can now be up to
256K characters, 3 digits now allowed (was 2, max. 99K).
5) Data on 'present configuration' screen displayed in
reversed video.
6) Use ENTER instead of ESCape to accept input on any screen,
and return to main menu. All prompts changed to indicate
this.

25-Jan-88 V1.0
1) If line length too long, line wraps around. Used to be
truncated.
2) Command characters displayed in bold video.
3) "eXit" changed to "Quit".
4) "Abort" exits immediately if the setup has not been
changed.

15-Jul-86 Initial edit.


SCONFIG - Page 1

CONTENTS
════════

PAGE

1. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . 2

2. MENUS AND COMMANDS . . . . . . . . . . . . . . . . . . . 4


2.1 User interface . . . . . . . . . . . . . . . . . . . . 4
2.2 Main menu . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Hardware and memory . . . . . . . . . . . . . . . . . 6
2.3.1 Extension memory . . . . . . . . . . . . . . . . . . 8
2.4 S-BUS communications . . . . . . . . . . . . . . . . . 9
2.5 Modem for SAIA PCD . . . . . . . . . . . . . . . . . . 12
2.6 Gateway master port . . . . . . . . . . . . . . . . . 13
2.7 Modem for PC . . . . . . . . . . . . . . . . . . . . . 17
2.7.1 MODEM.DAT file . . . . . . . . . . . . . . . . . . . 18
2.7.2 Important notes on modem configuration . . . . . . . 20
2.8 Serial ports for PC . . . . . . . . . . . . . . . . . 21
2.9 Printer . . . . . . . . . . . . . . . . . . . . . . . 23
2.10 Editor program names . . . . . . . . . . . . . . . . . 25
2.11 Colour set . . . . . . . . . . . . . . . . . . . . . . 26
2.12 List configuration . . . . . . . . . . . . . . . . . . 28
2.13 Quit . . . . . . . . . . . . . . . . . . . . . . . . . 29

3. ERROR AND WARNING MESSAGES . . . . . . . . . . . . . . . 30


SCONFIG - Page 2

1. INTRODUCTION
════════════════

SCONFIG is an off-line configurator program which edits configuration


data stored in the PCDSETUP.DAT file and the PCDCOLOR.DAT colour
definition file, and chooses modem types from a user-editable
MODEM.DAT file.

The PCDSETUP.DAT file contains the "registered user's name" and the
number of the package which has been purchased. This data is encoded
into the file when the customer purchases a copy of the PCD
Programming Utilities.

The PCDSETUP.DAT file is encrypted and checksummed using a virtually


un-crackable algorithm. This prevents anyone from altering the
registered user name, and will help to reduce software piracy.

All programs in the SAIA PCD Programming Utilities package use data
in the PCDDSETUP.DAT file, which must be either in the current
directory or in the directory containing the other programs. The DOS
"SET" command should be used to set environment variable "PCD" to
indicate this directory (e.g. "SET PCD=C:\PCD").

The configuration process covers the following:

* Selection of the PCD type (PCD1, PCD2, PCD4, PCD6.M5, PCD6.Mx).

* Memory allocation - selecting a memory type and size, and the


code, text and extension memory sizes for each CPU.

* The PCD's S-BUS station number, and configuration of the PCD's


S-BUS PGU port.

* Configuration of ports to use the PCD as an S-BUS gateway.

* Selection of modem types from those defined in the user-editable


MODEM.DAT file. Modems can be chosen for the SAIA PCD and the
personal computer.

* Selection of serial ports and baud rates for connection to the


PCD for PGU and S-BUS communications and for an EPROM Programmer.
Delays and timeouts for use with modem communications.

* Configuration of the printer and the page size for listings.

* Entry of the names of the programs to be called from the "Edit"


and the "Word processor" commands from the main menu (defaults
are SEDIT.EXE and EDIT.COM), and entry of the name of the code
editor program called from SGRAF (default SEDIT.EXE).

* Selection of the colours to be used for colour or LCD displays.

When SCONFIG is invoked, it first looks for the PCDSETUP.DAT in the


current directory or in the PCD Programming Utilities directory. If
found, it is read in, and can then be examined and modified using
this program.
SCONFIG - Page 3

Introduction continued
──────────────────────

If PCDSETUP.DAT can't be found, default values (see section 3) are


used, and a restricted-use PCDSETUP.DAT file can be created. This
file will not contain a registered user's name, and will allow only
the base package programs to be run (menus, debug and file handling
programs). No other programs (assembler, linker etc.) can be used with
this configuration file.

For different configurations, the user can have different PCDSETUP.DAT


files in different working directories. The recommended method is to
keep the default PCDSETUP.DAT file (the one from the distribution
diskettes) in the PCD Programming Utilities directory, and to create
an individual configuration file in each working directory.
SCONFIG - Page 4

2. MENUS AND COMMANDS


══════════════════════

2.1 User interface


───────────────────

Three types of entry fields are used on the menus. All entry fields
are displayed in intensified video to separate them from any text on
the screen.

Movement between entry fields is by the use of the ARROW keys, the
SPACE bar (except when on a "switch" field, see below), the TAB or
or the backtab (<-) keys.

When the cursor is on an entry field, the entire field is always


displayed in reverse video to highlight the cursor position.

The three types of entry fields are:

Select field: These are found on the main menu only. This field
allows selection of a sub-menu or execution of a
process. The selected field is highlighted in
reverse video.

Pressing ENTER displays the sub-menu or executes the


process. Alternatively, each description contains a
capital command letter, in bold video, this key can
be pressed to select the sub-menus or execute the
process with a single key stroke.

Data field: Numeric or text data, such as a file name or number


can be input. Full editing facilities (insert and
delete) are provided, unless the field is a "must
fill" field (overtype only). The arrow keys move
the cursor over any characters entered in the data
field. The HOME and END keys move to the start or
the end of the field.

Switch field: The field is a "switch", pressing the SPACE bar


selects the switch position. Normally these fields
have two positions "Yes/No".

Data entered into a data field is checked only when ENTER or ESC is
pressed to leave the sub-menu.

If the user attempts to leave a sub-menu with while there is invalid


data in an entry field, an error message is displayed and the cursor
is placed on the invalid data. The user is not allowed to leave a
sub-menu if there are any errors. If there is more than one error,
only the first error is indicated.
SCONFIG - Page 5

2.2 Main menu


──────────────

This is the first screen displayed, all the configuration options can
be selected from here.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 MAIN MENU │
├────────────────────────────────────────────────────────────────────────────────┤
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ U.CROAKED LTD, COFFIN MANUFACTURERS, STIFF STREET, GRAVESEND ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ │
│┌ SAIA PCD CONFIGURATION ──────────────────────────────────────────────────────┐│
││ Hardware and memory Select PCD type, memory type and memory allocation ││
││ S-Bus communications Configure the PCD's S-BUS station and PGU port ││
││ MoDem for SAIA PCD Modem for S-BUS PGU port via public line modem ││
││ Gateway master port Configure PCD for use as an S-BUS gateway ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│┌ PERSONAL COMPUTER CONFIGURATION ─────────────────────────────────────────────┐│
││ Serial ports for PC Select the PC's COM ports, baud rates and timing ││
││ Modem for PC Modem for Personal Computer using public line modem ││
││ Printer Define printer page format and control strings ││
││ Editor program names Editor, Graftec code editor and word processor names ││
││ Colour set Select the colours, for colour screens only ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│┌ COMMANDS ────────────────────────────────────────────────────────────────────┐│
││ List configuration List the present configuration on the printer ││
││ Quit Exit configurator, save or discard the configuration ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press ARROW or SPACE to select, ENTER or capital Command letter to execute. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The first option "Hardware and memory" is highlighted with a reverse


video cursor, indicating it is selected. This cursor can be moved to
select another option by using the ARROW, SPACE, TAB or backtab (<-)
keys. Pressing ENTER (carriage return), or the single capital letter
in the option's description executes that option.

Each option is described in detail in the following sections.


SCONFIG - Page 6

2.3 Hardware and memory


────────────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 HARDWARE AND MEMORY │
├────────────────────────────────────────────────────────────────────────────────┤
│ ┌───────────────┐ │
│ PCD processor type . . . │ PCD6.M1/M2/M3 │ │
│ └───────────────┘ │
│ Code/text/DB memory . . 256K Bytes, PCD6.R510/R600 │
│ │
│ Extension memory . . . . 256K Bytes │
│ │
│ │
│ ┌─────┬─────────┬─────────┬─────────┐ │
│ Memory Allocation: │ CPU │ CODE │ TEXT/DB │EXTENSION│ │
│ ├─────┼ K Lines ┼ K Bytes ┼ K Bytes ┤ │
│╓─────── NOTE ────────┐ │ 0 │ 56__ │ 32__ │ 256_ │ │
│║ Changes do not take │ │ 1 │ 0___ │ 0___ │ 0___ │ │
│║ effect in the PCD │ │ 2 │ 0___ │ 0___ │ 0___ │ │
│║ until the "ALLOCATE │ │ 3 │ 0___ │ 0___ │ 0___ │ │
│║ MEMORY" operation │ │ 4 │ 0___ │ 0___ │ 0___ │ │
│║ is done from the │ │ 5 │ 0___ │ 0___ │ 0___ │ │
│║ "Up/download" menu, │ │ 6 │ 0___ │ 0___ │ 0___ │ │
│║ or until "SDNLD /M" │ ├─────┼─────────┴─────────┼─────────┤ │
│║ is executed. │ │TOTAL│ 256K Bytes │ 256KB │ │
│╚═════════════════════╛ └─────┴───────────────────┴─────────┘ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select the type, ARROW moves cursor, ESC or ENTER accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The first, and the most important, item to be configured is the PCD
type. This governs the maximum number of CPUs in the system, and
the memory sizes which are available.

The "code/text/DB memory size" must be chosen according to the memory


card type which will be used, and the memory chip sizes. Code and
text memory can be in RAM (read/write) or EPROM (read only) memory.

The "extension memory size" should only be set to a value other than
"None" if extension memory is present. Extension memory is always
RAM memory, and contains Texts and Data Blocks 0..7999 (or or 0..4999
for a PCD1, 0..5999 for a PCD2). Mixed EPROM and RAM is allowed on
certain memory cards, with the code/text/DB memory in EPROM, and
extension memory in RAM.

Once the correct memory types have been selected, the memory can be
divided between the CPUs from the "Memory Allocation" box. When the
the cursor is in this box, pressing 'D' restores the default memory
allocation. The default allocation is also selected if the PCD type
or memory size is changed.
SCONFIG - Page 7

Hardware and memory continued


─────────────────────────────

Memory is allocated in K program lines for code (where 1K program


lines is 4096 bytes), K bytes for text/DB memory, and K bytes for
extension memory. All the memory in the selected memory card should
be allocated, the total amount of memory allocated is shown on the
menu in bytes.

PCD1 Memory Chips:

17KB RAM Default on-board RAM, with no chip in the USER PROG socket.
32/64/128KB + 13KB @Extension memory@
With 32KB RAM or 64/128KB RAM/EPROM in the USER PROG
socket,
the on-board RAM can be used as 13KB extension memory.
112KB FLASH EPROM
128KB flash eprom chip, 112K available to user program.

PCD2 Memory Chips:

32KB RAM Default on-board RAM, with no chip in the USER PROG socket
32/64/128/512KB(*) + 24KB @Extension memory@
With 32KB RAM or 64/128/512KB(*) RAM/EPROM in the USER
PROG socket, the on-board RAM can be used as 24KB
extension memory.
112/448KB FLASH EPROM
128KB or 512KB(*) Flash EPROM chip, 112KB or 448KB is
available for the user program.
(*) To use a 512KB chip, PCD2 hardware revision M or later is needed.

PCD4 and PCD6.M5 Memory Cards:

PCD4.R1xx 64/128KB EPROM


PCD4.R2xx 64KB RAM
PCD7.R1xx 64/128/256KB EPROM
PCD7.R210 64KB RAM (PCD4 CPU card >= Rev. E)
PCD7.R220 256KB RAM
PCD7.R300 64/256KB RAM, or 128/256KB EPROM
+ 0/172KB Extension Memory

PCD6.M1/M2/M3 Memory Cards:

PCD6.R500 64/128/256KB EPROM


PCD6.R510 256KB RAM
PCD6.R511 128KB RAM
PCD6.R512 64KB RAM
PCD6.R600 256/512/768/1024KB RAM/EPROM
+ 768/512/256/0KB Extension Memory

*** NOTES ***

The memory configuration must be loaded into the PCD with the
"ALLOCATE MEMORY" command from the "Up/download" menu, or by using
"SDNLD /M" from the DOS prompt. It is also programmed into EPROM by
the "Program eproms" utility (SPROM). Allocating memory *DELETES*
all user programs in the PCD.
SCONFIG - Page 8

2.3.1 Extension memory


───────────────────────

Extension memory is additional RAM memory for storing Texts and Data
Blocks. The standard text/DB memory segment holds TEXTs and DBs
0..3999. Extension memory holds TEXTs and DBs 4000..7999 (or 4000..
4999 for a PCD1, 4000..5999 for a PCD2). TEXTs and DBs in extension
memory are accessed faster than those stored in the text memory
segment, and so are ideal for storing large arrays for data logging
or user program configuration.

Extension memory is always RAM, which can be written to. Text/DB


memory can be either RAM or EPROM. If text/DB memory is in EPROM,
then this cannot be written to, and the PUT and TFR instructions
cannot be used to transfer data into text memory. If this is required,
then extension memory must be used.

Extension memory in PCD6.M1/M2:

The PCD6.R1xx public memory module must be used, with the PCD6.R600
memory card. This can contain RAM or EPROM for code and text/DB memory,
and RAM for extension memory. The amount of extension memory is
selected in 256KB steps because one pair of memory chips holds 256KB.

Extension memory in PCD4 and PCD6.M5:

The PCD7.R300 memory module must be used. This contains either RAM or
EPROM for the code and text/DB segments, freeing up the 172KB or RAM
on the CPU card for use as extension memory.

Extension memory in PCD1:

The PCD1 has an additional memory socket (marked "USER PROG") which
accepts a RAM, EPROM or Flash EPROM chip. If this chip is present,
then the on-board RAM provides 13KB of extension memory.

Extension memory in PCD2:

The PCD2 has an additional memory socket (marked "USER PROG") which
accepts a RAM, EPROM or Flash EPROM chip. If this chip is present,
then the on-board RAM provides 24KB of extension memory.
SCONFIG - Page 9

2.4 S-Bus communications


─────────────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 S-BUS COMMUNICATIONS │
├────────────────────────────────────────────────────────────────────────────────┤
│ ┌─────┐ │
│ Station number . . . . (0..255) │ 0__ │ (255 = No S-BUS support) │
│ └─────┘ │
│┌ S-BUS PGU PORT CONFIGURATION - FOR CPU TYPE PCD6.M2 ─────────────────────────┐│
││ ┌─────┬──────────┐┌─────┬──────────┐ ││
││ PGU Port Allocation: │ CPU │ PGU PORT ││ CPU │ PGU PORT │ ││
││ PCD6.M2/M3 is required. ├─────┼──────────┤├─────┼──────────┤ ││
││ │ 0 │ 0 ││ 4 │ None │ ││
││ NOTE: Port 4 is available │ 1 │ None ││ 5 │ None │ ││
││ on the PCD6.M3 only, via │ 2 │ None ││ 6 │ None │ ││
││ the connector marked PGU. │ 3 │ None ││ │ │ ││
││ └─────┴──────────┘└─────┴──────────┘ ││
││ PGU port baud rate (110..38400) 9600 ╓─────────── NOTE ────────────┐ ││
││ S-BUS mode (Break/Parity/Data) Parity ║ Changes do not take effect │ ││
││ PGU via Public Line Modem . . . . No ║ until a "CONFIGURE S-BUS" │ ││
││ ║ operation is done from the │ ││
││ S-BUS TIMING (0=default): ║ "Up/download" menu, or until│ ││
││ TS delay in ms (0, or 1..15000) 0____ ║ "SDNLD /S" is executed from │ ││
││ Timeout in ms (0, or 1..15000) 0____ ║ the DOS prompt. │ ││
││ TN delay in ms (0, or 1..15000) 0____ ╚═════════════════════════════╛ ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter decimal value, ARROW moves cursor, ESC or ENTER accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

This screen defines the S-BUS station number, and configures an S-BUS
PGU port for connection to a Personal Computer running the SAIA PCD
Programming Utilities. The S-BUS configuration is stored in the PCD's
public memory.

Each S-BUS station must have a unique station number (0..254). If the
PCD does not use S-BUS protocol, set the station number to 255. If
no S-BUS PGU port is required, set all the "PGU PORT" switches to
"None", all other entry fields are then ignored.

The "PGU Port Allocation" texts are different for each PCD type.
│ ┌─────┬──────────┐
│ PGU Port Allocation: │ CPU │ PGU PORT │
│ ├─────┼──────────┤
│ PCD1: Select port 0 or 1. │ 0 │ None │
│ Only port 1 works with a └─────┴──────────┘
│ public line modem.
SCONFIG - Page 10

S-Bus communications continued


──────────────────────────────

If the PCD type is a PCD2:


│ ┌─────┬──────────┬────────┐ │
│ PGU Port Allocation: │ CPU │ PGU PORT │ TYPE │ │
│ ├─────┼──────────┼────────┤ │
│ PCD2: Port 0 is software │ 0 │ 0 │ RS-232 │ │
│ selectable RS-232/RS-485, └─────┴──────────┴────────┘ │
│ for ports 1..3 the TYPE │
│ is hardware dependent. │

The PCD2's port 0 can be configured by software as either an RS-232


or an RS-485 port. The "TYPE" switch on this menu controls this.
For all other PCD2 ports, the "TYPE" switch is ignored.

If the PCD type is a PCD4:


│ ┌─────┬──────────┐ │
│ PGU Port Allocation: │ CPU │ PGU PORT │ │
│ ├─────┼──────────┤ │
│ PCD4: Only one PGU port │ 0+1 │ 0 │ │
│ allowed, both CPUs can └─────┴──────────┘ │
│ be accessed through it. │
│ The PCD4.M4 cannot use ports 2 or 3. │

If the PCD type is a PCD6.M5:


│ ┌─────┬──────────┐ │
│ PGU Port Allocation: │ CPU │ PGU PORT │ │
│ ├─────┼──────────┤ │
│ PCD6.M5: Use only port 2 │ 0 │ 0 │ │
│ for a public line modem. └─────┴──────────┘ │

PGU port baud rate (110..38400):


This must match the baud rate chosen for the S-BUS PGU
port on the "Serial ports for PC" menu.

S-BUS mode (Break/Parity/Data): This is the signalling method used


to indicate the start of a new telegram. Parity mode (S1)
uses the parity bit, Break mode (S0) uses the line break
character and Data mode (S2) uses a unique 4-character
sequence. Parity mode is usually for direct connections
or private line modems. Data or Break modes are for public
line (dial-up) modems which don't transfer the parity bit.

PGU via Public Line Modem:


Set to "Yes" if a dial-up public line modem is to be used.
The modem type for the SAIA PCD must be selected from the
"Modem for SAIA PCD" screen.

Timing (if 0, then the default value is used, see next page):

TS delay: Training sequence delay, in milliseconds. This is the


delay between setting RTS (Request To Send) and the
transmission of the message.
SCONFIG - Page 11

S-Bus communications continued


──────────────────────────────

Timeout: Response timeout in milliseconds. This is the timeout


until the END of the response message is received.

TN delay: Turnaround time in milliseconds. The minimum time between


the end of a response and transmission of the next
telegram. It gives the remote station time to switch back
to receive mode.

The above three values should be set to the minimum values required by
the hardware. If (TS delay + TN delay) is greater than about 500ms
then the "Debug" program WILL NOT WORK. It polls the PCD every 500ms,
and all the processing time is taken up by these delays. Timeout should
also be set as low as possible because this affects the processing of
key depressions if the PCD is off line.

If TS delay, Timeout or TN delay are set to 0, these default values


are used (all values are in milliseconds):

┌───────┬─────────────────────────────┐
│ BAUD │ TIMEOUT* TS DELAY TN DELAY │
├───────┼─────────────────────────────┤
│ 110 │ 15000 27 14 │
│ 150 │ 9000 20 10 │
│ 300 │ 5000 20 10 │
│ 600 │ 3000 5 3 │
│ 1200 │ 2000 3 2 │
│ 2400 │ 1000 2 1 │
│ 4800 │ 500 2 1 │
│ 9600 │ 250 1 1 │
│ 19200 │ 200 1 1 │
│ 38400 │ 200 1 1 │
└───────┴─────────────────────────────┘

* For S-BUS Data Mode, all TIMEOUT values are 50% longer, e.g.
250=375.

*** NOTES ***

Before configuring S-BUS, define the correct PCD type from the
"Hardware and memory" menu. S-BUS configuration does not take effect
until the "CONFIGURE S-BUS" command is done from the "Up/download"
menu, or until "SDNLD /S" is executed from the DOS prompt. The
Personal Computer also needs to be configured for S-BUS from the
"Serial ports for PC" screen.
SCONFIG - Page 12

2.5 Modem for SAIA PCD


───────────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 MODEM FOR SAIA PCD │
├────────────────────────────────────────────────────────────────────────────────┤
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ If using a public line (dial-up) modem on the PCD's S-BUS PGU port, set the ││
│║ "S-BUS communications" screen's "PGU via Public Line Modem" flag to "Yes". ││
│║ Then select from this screen the type of modem which will be connected to ││
│║ the PCD. The modem configuration is defined in a file called MODEM.DAT, ││
│║ which can be edited with any ASCII text editor such as PE or EDIT. Only two ││
│║ control strings are needed, one to reset the modem, and another to initialize││
│║ the modem into "auto-answer mode" so that it will answer an incoming call. ││
│║ If the PCD contains RAM, these strings must be loaded into the PCD using the ││
│║ "CONFIGURE S-BUS" command from the "Up/download" menu, or with "SDNLD /S" ││
│║ from the DOS prompt. If the PCD contains EPROM memory, then new EPROMs must ││
│║ be programmed. ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ ┌─────────────────┐ │
│ SAIA PCD modem name │ Factory Default │ │
│ └─────────────────┘ │
│┌ PCD MODEM COMMAND STRINGS ───────────────────────────────────────────────────┐│
││ Reset modem "ATZ\r" ││
││ Auto answer on "ATM0E0S0=2S25=250\r" ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select modem type, ENTER or ESC accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

If using a public line (dial-up) modem on the PCD's S-BUS PGU port,
use this screen to select the type of modem which will be connected
to the PCD. Modem configurations are defined in the MODEM.DAT file.
If this file does not contain your modem type, then it can be edited
with any ASCII text editor such as PE or EDIT.

Only two control strings are needed, one to reset the modem and
disable auto-answer mode, and another to enable auto-answer mode
so that the modem will answer an incoming call and connect to the
remote modem. To initialize the modem, the "reset" string is sent
first, followed 3 seconds later by the "auto-answer on" string.

These strings must be loaded into the PCD by a "CONFIGURE S-BUS"


command from the "Up/download" screen, or with "SDNLD /S" from the
DOS prompt. If this is not done, the default configuration strings
will be used: "ATZ\r" and "ATM0E0S0=2S25=250\r". NOTE: Some "Hayes
compatible" modems are not fully compatible, and the default command
strings may fail. It is usually the "S25=250" which fails, S-register
25 must be "DTR change detect time".

When using a public line modem, you must also set the "PGU via
Public Line Modem" flag on the "S-BUS communications" screen to
"Yes", and "S-BUS mode" on the same screen to "Break" (unless your
modems can transfer the parity bit).
SCONFIG - Page 13

2.6 Gateway master port


────────────────────────

The main disadvantage of S-BUS was that it was only possible to


have only a single master on a network. Now, using the new S-BUS
gateway feature, it is possible to have up to 4 masters which can
all communicate with each slave on the S-BUS network. This virtual
connection is managed by a "gateway station".

┌─────┐ ┌─────┐
│ PCD │ │ etc.│ Up to 4 S-BUS masters
└──┬──┘ └──┬──┘
│ │
┌──┴───────┴──┐<─── Up to 4 slave #gateway# ports
│ PCD gateway │
│ station │
└──────┬──────┘<─── Master gateway port

┌────────┬───┴────┬────────┬──── // ───┐
┌──┴──┐ ┌──┴──┐ ┌──┴──┐ ┌──┴──┐ ┌──┴──┐
│ PCD │ │ PCD │ │ PCD │ │ PCD │ ... │ etc.│ S-BUS slave network
└─────┘ └─────┘ └─────┘ └─────┘ └─────┘

The "gateway station" is the dedicated PCD which controls the


connection of a supervisor, Personal Computer or master PCD to the
S-BUS network. The "slave gateway port" is the port which connects
a S-BUS master to the S-BUS slave network via the gateway station.
The "master gateway port" is the port which connects the masters on
the gateway station to the S-BUS network.

The gateway station can have up to 4 slave gateway ports or 3 slave


gateway ports and a port configured by a SASI instruction which
allows the STXM/SRXM instructions to be used - so the gateway itself
can act as a master station. Each master can access the slave stations
at the same time (multiplexed).

The baud rates of the slave and master gateway ports can be selected
independently, as can the S-BUS signalling mode (Break/Parity).
SCONFIG - Page 14

The master gateway port is configured from the "Configure/Gateway


master port" screen shown below. The slave gateway ports are
configured either by the S-BUS PGU port configuration or by a SASI
instruction.
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 GATEWAY MASTER PORT │
├────────────────────────────────────────────────────────────────────────────────┤
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ The PCD must be assigned a station number from the "s-bUs communications" ││
│║ screen. The gateway master port can't be the same port as the S-BUS PGU port.││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ │
│ CPU TYPE: PCD4 │
│ S-BUS STATION: 2 S-BUS PGU PORT: None │
│ ┌──────┐ │
│ Gateway master port (None, 0..3) │ None │ │
│ └──────┘ │
│ │
│ Baud rate . . . . . (110..38400) 38400 ╓─────────── NOTE ────────────┐ │
│ Mode . . . (Break/Parity/Data) Break ║ Changes do not take effect │ │
│ ║ until a "CONFIGURE S-BUS" │ │
│ GATEWAY PORT TIMING (0=default): ║ operation is done from the │ │
│ TS delay in ms (0, or 1..15000) 1____ ║ "Up/download" menu, or until│ │
│ Timeout in ms (0, or 1..15000) 2____ ║ "SDNLD /S" is executed from │ │
│ TN delay in ms (0, or 1..15000) 3____ ║ the DOS prompt. │ │
│ Break length (characters, 1..25) 4_ ╚═════════════════════════════╛ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select the port, ARROW moves cursor, ESC or ENTER accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The following gateway parameters can be defined, and must then be


loaded into the gateway PCD with the "Up/download" utility's
"CONFIGURE S-BUS" command, or "SDNLD /S" from the DOS prompt.

Gateway port: This field defines the port number of the master
gateway port, 0..3. If "None" is chosen, no master
gateway port is configured and all other fields are
ignored.

Port on CPU: This field is only shown for a PCD6. It defines which
CPU has the master gateway port.

Baud rate: The S-BUS network's baud rate. It does not need to be
the same as the slave gateway port's baud rate.

Mode (Break/Parity/Data): The signalling method used to indicate the


start of a new telegram.

TS delay: Training sequence delay in milliseconds. The delay


between setting RTS (Request to send) and transmitting
the message.
SCONFIG - Page 15

Timeout: This timeout in milliseconds concerns the transmission


between the master gateway port and its connected
slave(s). This timeout is particularly important when
awaiting an answer from a station which never responds.
The table below lists typical values in ms according to
the master gateway port's baud rate. It may be necessary
to adjust these values if TN and TS delays differ from
the default values.

┌────────────┬──────────────────────────────────────────────────────┐
│ Baud rate │ 110 150 300 600 1200 2400 4800 9600 19200 38400 │
│ Timeout ms │ 15000 9600 4800 2400 120 600 300 150 75 40 │
└────────────┴──────────────────────────────────────────────────────┘

TN delay: Turnaround time in milliseconds. The minimum time


between the end of a response and transmission of
the next telegram. It gives the remote station time
to switch back to receive mode. The TN delay is
particularly important if using the PCD7.T100 repeater
or private line modems.

Break length: Used only if "Break" signalling is selected. This is


the duration of the break signal, in character times.
The break signal tells the remote station that a new
telegram is about to be sent. The default is 4 character
times.

Configuring the Slave Gateway Ports


───────────────────────────────────

The slave gateway port can be configured either as the S-BUS PGU port
(see section 2.4), or by using SASI instructions.

S-BUS PGU port:

The S-BUS PGU port is always linked to the master gateway port. This
means that if the S-BUS PGU port receives a telegram which is not for
the gateway station itself (the address doesn't match), it will be
automatically re-transmitted via the master gateway port.

With "SASI":

A slave gateway port can be configured by the user program by using


the SASI instruction. A new "GS mode" (Gateway Slave) has been added
which performs an automatic link between an S-BUS slave port and the
master gateway port.
SCONFIG - Page 16

Gateway slave port SASI text format:

"UART:<baud_rate>[,<timeout>,<ts-delay>,<tn-delay>];"
"MODE:GS<sig_mode>;DIAG:<flag>,<register>"

<baud_rate> 110|150|300|600|1200|2400|4800|9600|19200|38400
<timeout> Not used, should be blank or 0
<ts-delay> Training sequence delay in ms, blank or 0=use default
<tn-delay> Turnaround time in ms, blank or 0=use default
<sig_mode> 0=break, 1=parity
<flag> First diagnostic flag, e.g. F100
<register> Diagnostic register, e.g. R32

Example: TEXT 1000 "UART:9600;MODE:GS1;DIAG:F500,R500"

Master Gateway Port and STXM/SRXM instructions


──────────────────────────────────────────────

The gateway station is always the master of the S-BUS network, and
like the other masters it can exchange data through the master
gateway port using the STXM and SRXM instructions. To do this, the
port must be configured for the new GM mode (Gateway Master mode)
using the SASI instruction.

SASI text format:

"MODE:GM,<dest_reg>;DIAG:<flag>,<register>

<dest_reg> The register holding the destination S-BUS station


number
<flag> First diagnostic flag, e.g. F100
<register> Diagnostic register, e.g. R32

Example: TEXT 1000 "MODE:GM,R300;DIAG:F500,R500"

Note that the UART definition and MODE options are not specified,
these are defined by the master gateway port's configuration. The
"GM" SASI can only be executed by the CPU which owns the master
gateway port.
SCONFIG - Page 17

2.7 Modem for PC


─────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 MODEM FOR PC │
├────────────────────────────────────────────────────────────────────────────────┤
│ ┌──────────────────┐ │
│ PC modem type . . . . │ Hayes Compatible │ │
│ └──────────────────┘ │
│┌ PC MODEM COMMAND STRINGS ────────────────────────────────────────────────────┐│
││ Reset modem . . . . . "ATZ\r" ││
││ Initialize modem . . not defined ││
││ Dial command prefix . "ATDT" ││
││ Dial command suffix . "\r" ││
││ Hangup command . . . "ATH0\r" ││
││ Select command mode . "~~~+++~~~" ││
││ 500ms delay character "~" ││
││ Auto-answer on . . . "ATS0=1\r" ││
││ Auto-answer off . . . "ATS0=0\r" ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│┌ RESPONSES FROM PC MODEM ─────────────────────────────────────────────────────┐│
││ OK response . . . . . "OK" ││
││ Connected response . "CONNECT" ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│┌ MISCELLANEOUS ───────────────────────────────────────────────────────────────┐│
││ Connect timeout (secs) 45 Dial retries 3 ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select modem type, ENTER or ESC accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

If a dial-up public line modem is used to communicate with the PCD


(using S-BUS), then the modem type must be chosen. This menu choses
a modem type from those defined in the user-editable MODEM.DAT file,
see below.

When a modem is selected, values for that modem are read from the
MODEM.DAT file and displayed.

The baud rate for the modem, delays and timeouts, are defined on
the "Serial ports for PC" menu.
SCONFIG - Page 18

2.7.1 MODEM.DAT file


─────────────────────

The MODEM.DAT file is an ASCII file which contains command and


response string definitions for any number of modem types. It can
be edited with any standard ASCII text editor such as EDIT or PE.

MODEM.DAT contains a configuration for the standard Hayes Compatible


modem, which should work with all modern modems. If your modem isn't
Hayes compatible, then this file can be edited to provide a new modem
configuration, and the new modem type can be chosen from the "Modem
type" menu. A "User-defined" modem configuration is privided as a
starting point.

Configuration strings in MODEM.DAT are defined with this syntax:


descriptor="string", with one definition per line. Comments are
preceded by a semi-colon (;) and are ignored. The modem name must
be defined at the start of each configuration, enclosed in square
brackets, e.g. [Hayes Compatible]. This defines the modem types
which can be chosen from the "Modem type" menu. Refer to the example
below. Blank or undefined strings are ignored. Strings can contain
escape sequences, see below.

Reset Resets the modem to its default state.

Init Initializes the modem: set timeouts, disable error


control and data compression, enable call progress
detection etc.

DialPrefix Sent before the telephone number when dialling.

DialSuffix Sent after the number when dialling, this is usually


"\r" (CR).

Hangup The command to disconnect and hang up the line. If


empty, then it is assumed that dropping DTR (Data
Terminal Ready) for 2 seconds will hang up the line,
as for most Hayes compatible modems.

AnswerOn Places the modem in "auto-answer" mode, so that it


answers an incoming call automatically. This is used
only by the SAIA PCD, and is selected from the "Modem
for SAIA PCD" screen. This string should also set the
"DTR detect time" to greater than 250ms, to prevent
the line being hung up when a "restart" is done.

Command The sequence which switches the modem from data


transfer mode to command mode. The "+++" string is
preceded and followed by a 1.5 second delay, defined
by three 0.5 second "Delay" characters: "~~~".

Delay A special dummy character. Whenever this character


appears in a modem command string the system waits
for 500ms instead of transmitting the character to
the modem. Traditionally this is the tilde character
(~), which can be seen in the example "Command"
string.
SCONFIG - Page 19

Auto-answer on This string must put the modem into auto-answer mode
so that it will automatically answer an incoming call
and connect to the remote modem. This is used to
enable "auto-answer mode". This string usually loads
a register in the modem (S0) with a ring count. When
the ring count is non-zero, the modem answers an
incoming call on the defined number of rings.

Auto-answer off This must disable auto-answer mode, so that the modem
will not automatically answer an incoming call. This
string usually sets the modem's ring count register
(S0) to 0.

Timeout The time to wait after dialling for the detection of


the carrier signal (DCD) from the remote modem. NOTE:
The modem itself often has an internal timeout value
(usually 30-45 seconds). "Timeout" is never used if
the modem's internal value is less. To use a longer
timeout, change the modem's internal timeout value by
adding the command to the "Init" sequence. For Hayes
compatible modems this is "S7=n", where "n" is the
timeout in seconds, e.g. to set a 45 second timeout
on a Hayes compatible modem, use:
Init="ATS7=45\r" ;set 45 second timeout
Timeout=45

Retries The number of additional dialling attempts made on


failure to connect to the remote modem. Max. is 3.

CmdOk The string returned by the modem when a command is


accepted. This is the string returned when the
"Reset", "Init", "DialSuffix" or "Hangup" commands
are sent.

Connect The string returned by the modem after the dial


command, when the remote modem has answered, the
connection has been established, and the carrier
detect signal (DCD) is being returned.

BreakMode If "No" then the modem doesn't support S-BUS break


mode, and S-BUS data mode should be used. The default
is "Yes". If "No" then break mode is skipped during
the connect process, which makes it slightly faster
because

ParityMode "Yes"=S-BUS parity mode supported, default="No".


Modems do not usually support parity mode because
they do not transfer the parity bit.

PCDReset For the modem connected to a PCD only. Resets the


modem.

PCDInit For the modem connected to a PCD only. Places the


modem into "auto-answer" mode so that it automatically
answers an incoming call. This string should also set
the "DTR detect time" to greater than 250ms or stop
the modem hanging up the line when a "restart" is
done.
SCONFIG - Page 20

Strings can contain escape sequences for the common ASCII control
characters or for hex values in strings. These are preceded by a
backslash '\':
\r 0x0D CR carriage return
\n 0x0A LF line feed
\a 0x07 BEL bell
\b 0x08 BS backspace
\f 0x0C FF form feed
\t 0x09 HT tab
\v 0x0B VT vertical tab
\xhh 0xhh hex value \x00..\xFF
\\ 0x5C \ backslash
\" 0x22 " quotation mark

MODEM.DAT also contains a "Hayes Compatible High-Speed" modem type.


Use this type if the modem is a high-speed modem (e.g. Hayes
Smartmodem), which uses error control or data compression protocols
by default. S-BUS WILL NOT WORK with error control or data compression
is used, and these must be disabled.

The "Hayes Compatible" modem is defined in MODEM.DAT as:

[Hayes Compatible] ;Modem type


;*** PC Modem
BreakMode=Yes ;Yes=Break mode supported, default=Yes
ParityMode=No ;Yes=Parity mode supported, default=No
Reset="ATZ\r" ;Reset modem
Init= ;Initialize modem ("AT&Q0\r" for high-speed)
DialPrefix="ATDT" ;Sent before number ("ATDP"=pulse dialling)
DialSuffix="\r" ;Sent after number
Hangup="ATH0\r" ;If blank, dropping DTR for 2 seconds is used
Command="~~~+++~~~" ;Switch modem to command mode
Delay="~" ;Character to provide 0.5 second delay
AnswerOn="ATS0=1\r" ;Turn on auto-answer mode (S0=1->answer on 1st
AnswerOff="ATS0=0\r" ;Turn off auto-answer mode ring)
Timeout=45 ;Connect timeout in seconds
Retries=2 ;Number of dialler retries if Timeout occurs
CmdOk="OK" ;Response string, command executed OK
Connect="CONNECT" ;Response string, connected OK after dial
;*** PCD Modem
PCDReset="ATZ\r" ;Reset PCD modem
PCDInit ="ATM0E0S0=2S25=250\r" ;Init PCD modem, must include 'S0=x'
;(with x not 0) to put the modem into
;auto-answer mode
SCONFIG - Page 21

2.7.2 Important notes on modem configuration


─────────────────────────────────────────────

MODEM RESPONSE STRINGS (CmdOk and Connect):

The "CmdOk" and "Connect" response strings are delimited by CR/LF


characters. CR and LF must NOT be entered in the string definitions,
do NOT enter '\n' or '\r'. Only the characters entered in the "CmdOk"
or "Connect" string, EXCLUDING the delimiting CR/LF, are compared.
If the response is longer, the additional characters are ignored.
For example, "CONNECT" matches "<CR><LF>CONNECT 2400<CR><LF>", the
"<CR><LF>" and " 2400" are ignored.

Do NOT initialize the modem to return single digit result codes (e.g.
"0"), these will not work. String values, enclosed by CR/LF characters
must be returned (see Hayes command "V1").

Do NOT initialize the modem so that it does not return response


strings, these are required by the dialler to monitor connection
progress (see Hayes command "Q0").

HIGH-SPEED MODEMS WITH DATA COMPRESSION AND ERROR CORRECTION:

Data compression and error correction protocols are NOT COMPATIBLE


with S-BUS, and must be disabled. Usually the Hayes command "&Q0"
will do this, use Init="AT&Q0\r" (or use the pre-defined modem type
[Hayes Compatible High-Speed]).

CALL PROGRESS DETECTION:

Some modems have the ability to detect if the line is busy (engaged)
or there is no dial tone. If the modem has this capability, it is
useful to enable it with the "Init" string. This speeds up the dial
retries, because the dialler will be able to detect these conditions
instead of waiting for the dial timeout period to elapse.

BREAK MODE AND THE BREAK LENGTH:

Break mode is now superseded by Data mode.

"Break mode" can be unreliable when used with some modems, because
they do not always pass the break signal directly through to the
remote PCD. You may need to experiment with the break length to
obtain optimum performance. To do this, connect to the remote modem
and run the Debug program (SBUG) and display a refreshed register.
Observe the modem's TX/RX lamps which should be continuously flashing.
If they occasionally stop for a few moments it means that a comms
error has occurred, comms continues after a retry. If many retries
occur, quit SBUG and change the break length from the "Serial ports
for PC" screen. When you run Debug again, it will use the new break
length. Other S-BUS timing values can also be adjusted in this way.
SCONFIG - Page 21

2.8 Serial ports for PC


────────────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 SERIAL PORTS FOR PC │
├────────────────────────────────────────────────────────────────────────────────┤
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ Up to four serial ports (COM1..COM4) may be present in your PC. Select the ││
│║ ports and baud rates for PC to PCD communications and the EPROM Programmer. ││
│║ Ports can be shared if required. ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ Serial ports detected . . . . . . . . COM1 COM2 COM3 │
│ ┌──────┐ │
│ Serial port for PGU connection . . . . │ COM3 │ Baud rate 9600 │
│ └──────┘ │
│ Serial port for S-BUS connection . . . COM3 Baud rate 9600 │
│ │
│ Serial port for S-BUS MODEM connection COM3 Baud rate 9600 │
│ │
│ Serial port for EPROM Programmer . . . COM1 Baud rate 9600 │
│ │
│┌ S-BUS TIMING FOR PC ─────────────────────────────────────────────────────────┐│
││ TS delay in ms (0, or 1..15000) 0____ ─┬─ 0 = Use minimum default delays ││
││ Timeout in ms (0, or 1..15000) 0____ │ ││
││ TN delay in ms (0, or 1..15000) 0____ ─┘ ││
││ Break length (characters, 1..25) 4_ ─── For S-BUS "Break" mode only ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select the port, ARROW moves cursor, ESC or ENTER accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

This screen configures the serial ports to be used by the personal


computer, their baud rates and S-BUS communications timing. It also
shows which serial ports are present in the PC.

PGU mode is for direct connection to a local PCD's PGU port at a


fixed speed of 9600 baud, or for connection to a PCD6.M1 or PCD6.M2
via the PCD8.P800 communications co-processor.

S-BUS mode can be either RS-232 for point-to-point connection or use


with modems, or RS-485 for point-to-point or network communications.
Up to 253 stations can be connected to an RS-485 S-BUS network. The
PGU port of the PCD must be configured from the "S-BUS communications"
menu to use the S-BUS protocol.

S-BUS MODEM is for use with modems on private or public (dial-up)


lines.

To use an RS-485 connection for S-BUS, use a "SAIA RS-232 to RS-485


convertor" or an opto-isolated RS-485 card in the personal computer.
SCONFIG - Page 22

Serial ports for PC continued


─────────────────────────────

The "TS delay" (training sequence), "Timeout" (response timeout)


and "TN delay" (turnaround time) are used by the personal computer
when communicating via S-BUS. If 0, then the default values are used.
Other values may be needed if communicating via a modem or if using
the PCD7.T100 repeater. The TN delay is the most critical, Timeout
and TS delay are both usually 0 so that default values are used.
The response timeout is the time the personal computer will wait
until the START of the response message. It is rounded up to the
nearest 55ms, since the PC's internal clock ticks at 55ms intervals.
After the 1st character of a response has been received, the PC uses
and inter-character timeout of 55ms.

The "Break length" is needed only if S-BUS "Break" mode is used,


normally when public line (dial-up) modems are being used (the S-BUS
mode is selected from the "coNnect" menu). This is the duration of
the break signal, in character times. The break signal tells the
remote station that a new telegram is about to be transmitted. The
default is 4 character times, but some modems may need longer to
register the break signal. See the notes on break length in section
2.7.2.
SCONFIG - Page 23

2.9 Printer
────────────
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 PRINTER │
├────────────────────────────────────────────────────────────────────────────────┤
│ ┌─────┐ │
│ IBM compatible printer . . . . . . . . . │ Yes │ │
│ └─────┘ │
│ Automatic line feed after carriage return No ─┌───┬────────┐ │
│ A│ │ │ │
│ Use form feed character at end of page Yes ─├───┼────────┤ │
│ │ │ Page │ │
│ A) Blank lines at top of page . . (0..20) 0_ B│ │ Body │ │
│ │ │ │ │
│ B) Lines for page body . . . . (25..255) 60_ ─├───┼────────┤ │
│ C│ │ │ │
│ C) Blank lines at end of page . . (0..20) 0_ ─└───┴────────┘ │
│ │ D │ E │ │
│ D) Spaces for left margin . . . . (0..20) 0_ │
│ │
│ E) Characters per line . . . . (40..255) 132 │
│ │
│ Initialization string (Hex) __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │
│ │
│ Deinitialization string (Hex) __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to change (Yes/No), ARROW moves cursor, ESC or ENTER accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

This screen defines the printer type, its page size and initialization
or de-initialization strings which should be sent to the printer
before and after printing. See section 3 for details of each item.

The page size is shown in the diagram on the right of the screen. The
sizes of items (A) to (E) can be given. The initailization string is
typically used to set the printer to compressed pitch or to set the
margin or page length etc. The deinitialsation string could reset the
printer to normal pitch etc.

The init/deinitialization strings must be entered in hexadecimal. To


delete hexadecimal values, move the cursor to the end of the string
by pressing END, then use the DEL or backspace keys. HOME moves to
the start of the string.

The PCD Programming Utilities provide support for a parallel printer


on LPT1. If you have a serial printer, the DOS "MODE" command can be
used to redirect printer output to a serial port (see the help screen
on the "Serial ports" menu in section 2.8).
SCONFIG - Page 24

Using a serial printer


──────────────────────

The SAIA PCD Programming Utilities uses parallel printer LPT1. If you
have a serial printer, a serial port can be used. Configure the port
and redirect printer output with the DOS "MODE" command. Put the
"MODE" commands in your AUTOEXEC.BAT file. Refer to your "DOS User's
Guide and Reference" manual for details.

For example, to use COM3 for a serial printer:

MODE COM3:9600,E,8,1,P (This sets the baud rate etc. for COM3)
MODE LPT1=COM3 (Redirects LPT1 printer output to COM3)

*** NOTES ***

The initialization and de-initialization strings are sent to the


printer when any utility is invoked with the "output to printer"
switch as "Yes" (/P command line switch). This means that all
printouts will be the same. This may not be desirable, for example
you may want the documentation listings to be standard 80-column
pitch, but the init string always sets the printer to compressed
pitch. There are 2 solutions to this problem:

1) Leave the init/de-init strings blank, and use the "compressed


pitch" button on the front panel of your printer, if present.
This is the recommended procedure.

2) Use the DOS "PRINT" command from the "Ms-dos command" menu (which
ignores the init/de-init strings) to print using the default
format of your printer, and the utilities' print commands to
print using the format controlled by the init/de-init strings.
SCONFIG - Page 25

2.10 Editor program names


──────────────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 EDITOR PROGRAM NAMES │
├────────────────────────────────────────────────────────────────────────────────┤
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ Enter here the names of the programs to be invoked from the "Edit" and "Word ││
│║ processor" options on the PCD Programming Utilities main menu, and the editor││
│║ invoked by Graftec's "Edit Program" command. The Code Editor will normally ││
│║ be SAIA's code editor SEDIT.EXE, but any general purpose text editor can be ││
│║ used. The "Word Processor" option should invoke a general-purpose text editor││
│║ such as WordStar or IBM's Personal Editor. The Graftec Code Editor is usually││
│║ SEDIT.EXE, but if left blank then SGRAF's simple internal editor is used. ││
│║ ││
│║ For faster access, specify the full path name and extension, for example ││
│║ "C:\PCD\SEDIT.EXE". If no path name is given, all the directories indicated ││
│║ in the PATH are searched in sequence, which takes time. If no file extension ││
│║ is given, a search is made for a matching .EXE, .COM then .BAT file. ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ │
│ Name of Code Editor . . . . SEDIT.EXE_________________________________ │
│ │
│ Name of Word Processor . . EDIT.COM__________________________________ │
│ │
│ Name of Graftec Code Editor SEDIT.EXE_________________________________ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter "d:\path\name.ext" (F5=dir), ARROW moves cursor, ESC or ENTER accepts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Enter the names of your preferred instruction list code editor and
your word processor (text editor). These programs are invoked from
the PCD Programming Utilities main menu by the "Edit" and "Word
processor" commands, and from the Graftec editor's "Edit Code"
command.

For the "Name of the Code Editor" enter "SEDIT.EXE" if you want to
use SAIA's dedicated instruction list editor, or enter the name of
any ASCII text editor (for example "EDIT.COM" or "PE.EXE") if you
prefer to edit source files using a general purpose text editor.
Other editors may be available from SAIA in the future.

For the "Name of Word Processor" enter the name of your favorite
general purpose text editor (e.g. "EDIT.COM" or "PE.EXE"). This
editor can be used to edit ASCII files such as specifications and
documentation files. The Graftec editor is usually "SEDIT.EXE", but
if left blank then SGRAF's internal (simple) editor is used.

Program names can contain a drive and/or path name. If the complete
drive, path name and file type is given (e.g. C:\PCD\SEDIT.EXE), it
speeds up the loading of the programs. Program names can be those
of a .COM, .EXE or .BAT file.

If no drive or path is given, all the directories indicated in the


DOS environment by the "PATH" is searched.
SCONFIG - Page 26

2.11 Colour set


────────────────

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD OFFLINE CONFIGURATOR V2.1 COLOUR SET │
├────────────────────────────────────────────────────────────────────────────────┤
│ THIS IS THE HEADER COLOUR COLOUR SET FILE: PCDCOLOR.0 │
│╓──────────────────────────────────────────────────────────────────────────────┐│
│║ Selects the colour set for a colour screen, or highlighting for a monochrome ││
│║ screen. The selected colour set is demonstrated on this display. The colour ││
│║ set is defined in files PCDCOLOR.0 to PCDCOLOR.9. The colour file is copied ││
│║ into file PCDCOLOR.DAT when a colour set is chosen. PCDCOLOR.9 is a custom ││
│║ colour definition file, which can be edited to change the colours. ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│ ┌───────────────┐ │
│ Menu item This is a menu item. │ This is a box │ │<───────────────14 │
│ └───────────────┘ ▓ 1 │ │
│ Cursor This is the menu cursor. ┼ 2 │ │
│ ░ 3 │ │
│ ┌────────────── THIS IS A WINDOW ───────────────┐ ├─────┬─────┐ │ │
│ │ This is a window text, and a window Cursor │ ┼ 4 ┼ 5 ┼ 6 │ │
│ └───────────────────────────────────────────────┘ ░ 7 ░ 8 ░ 9 │ │
│ ┼ 10 ┼ 11 ┼ 12 │ │
│ This is the help text colour, and the help item colour. ├─────┴─────┘ │ │
│ ░ 13 │ │
│ This is the colour of normal text. ┼ 14 │ │
│ └─────────────────1 │
│ ERROR MESSAGE COLOUR │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select colour set, ESC or ENTER accepts. │
│ Status line colour: Data F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The colour set screen demonstrates the colours in the selected colour
set. Other colour sets are selected by pressing the SPACE key. The
colour set can't be changed if you have a monochrome screen. If you
have an electro-luminescent or LCD display it may be emulating a
colour screen, and selecting the correct colour set may improve display
readability. For example, some LCD displays do not have blinking video,
so colour set 5 should be used.

Several colour sets have been provided. These are stored in colour set
files named PCDCOLOR.n, where 'n' is a digit 0..9, e.g. PCDCOLOR.1.
The name of the selected color set file is displayed at the top of
the screen. Pressing the SPACE key loads the next PCDCOLOR.n file and
displays its colours.

The color set used by the utilities is always read from the file named
PCDCOLOR.DAT. If this file exists in the current directory then it is
used, otherwise the file in the PCD Programming Utilities directory
is used.

Press ESC or CR to accept the selected colour set. When a new colour
set
is chosen, the selected PCDCOLOR.n file is copied into the PCDCOLOR.DAT
file in the PCD directory on exit of SCONFIG.
SCONFIG - Page 27

Colour set continued


────────────────────

If the PCDCOLOR.DAT file in the PCD directory is read-only, because it


is on a network or has the read-only attribute set, then "ERROR 27:
ACCESS TO MASTER PCDCOLOR.DAT FILE DENIED" is generated and the user
is prompted:

Create PCDCOLOR.DAT file in the current directory (Y or N) ? _

Answering yes (Y) creates the PCDCOLOR.DAT file in the current


directory, which is used whenever the utilities are run from this
directory.

Custom colour sets


──────────────────
You can create your own colour set by editing the file PCDCOLOR.9.
This file is reserved for a custom colour set. Colours are defined
by the two digit hexadecimal numbers in this file. Change these to
change the colours.

NOTE: Do *NOT* edit anything else in this file, and do not change the
order of the hex numbers. The default colour set (CGA) is used if the
file is invalid.

Each colour set file has been designed for use with a particular type
of monitor:

No. FILE NAME MONITOR TYPE


──────────────────────────────────────────────────────────────
0 PCDCOLOR.0 CGA or VGA screen (default)
1 PCDCOLOR.1 VGA screen (grey)
2 PCDCOLOR.2 VGA screen (cyan)
3 PCDCOLOR.3 VGA screen (green)
4 PCDCOLOR.4 Monochrome screen
5 PCDCOLOR.5 Liquid crystal display (LCD)
6..8 Reserved
9 PCDCOLOR.9 Can be edited for a @custom colour set@
SCONFIG - Page 28

2.12 List configuration


────────────────────────

This command lists the current configuration on the printer. Before


printing it, the printer initialization string is sent to the printer.
After the configuration is printed, the deinitialization string is
sent. Example:
SAIA PCD OFFLINE CONFIGURATOR V2.1
Registered user: GARRY'S HANDMADE GARROTTES LTD, BREAKNECK STREET, GALLOWSVILLE
16/06/93 14:30

HARDWARE AND MEMORY


PCD processor type PCD6.M1/M2
Code/text memory size 256K Bytes, PCD6.R510/R600
Extension memory size 256K Bytes
Memory Allocation:
┌─────┬─────────┬─────────┬─────────┐
│ CPU │ CODE │ TEXT │EXTENSION│
├─────┼ K Lines ┼ K Bytes ┼ K Bytes ┤
│ 0 │ 56 │ 32 │ 256 │
│ 1 │ 0 │ 0 │ 0 │
│ 2 │ 0 │ 0 │ 0 │
│ 3 │ 0 │ 0 │ 0 │
│ 4 │ 0 │ 0 │ 0 │
│ 5 │ 0 │ 0 │ 0 │
│ 6 │ 0 │ 0 │ 0 │
├─────┼─────────┴─────────┼─────────┤
│TOTAL│ 256K Bytes │ 256KB │
└─────┴───────────────────┴─────────┘

S-BUS COMMUNICATIONS
Station number (0..254, 255=none) 0
┌─────┬──────────┐┌─────┬──────────┐
PGU Port Allocation: │ CPU │ PGU PORT ││ CPU │ PGU PORT │
├─────┼──────────┤├─────┼──────────┤
PCD6.M2 is required. │ 0 │ 0 ││ 4 │ None │
│ 1 │ None ││ 5 │ None │
│ 2 │ None ││ 6 │ None │
│ 3 │ None ││ │ │
└─────┴──────────┘└─────┴──────────┘

PGU port baud rate (110..38400) 9600


S-BUS mode . . . . (Break/Parity) Break
PGU via Public Line Modem (RS232) Yes
S-BUS Timing (0 = use default):
TS delay in ms (0, or 1..15000) 0
Timeout in ms (0, or 1..15000) 0
TN delay in ms (0, or 1..15000) 0
SAIA PCD modem type Hayes Compatible High-Speed

SERIAL PORTS
Serial port for PGU connection . . . . COM3 Baud rate 9600
Serial port for S-BUS connection . . . COM3 Baud rate 9600
Serial port for S-BUS MODEM connection COM3 Baud rate 9600
Serial port for EPROM Programmer . . . COM1 Baud rate 9600
S-BUS timing for PC:
TS delay in ms (0, or 1..15000) 0
Timeout in ms (0, or 1..15000) 0
TN delay in ms (0, or 1..15000) 0
Break length (characters, 1..25) 4
SCONFIG - Page 29

List configuration continued


────────────────────────────

PRINTER
IBM compatible printer . . . . . . . . . Yes
Automatic line feed after carriage return No
Use form feed character at end of page Yes
A) Blank lines at top of page . . (0..20) 0
B) Lines for page body . . . . (25..255) 66
C) Blank lines at end of page . . (0..20) 0
D) Spaces for left margin . . . . (0..20) 0
E) Characters per line . . . . (40..255) 132
Initialization string (Hex) None
Deinitialization string (Hex) None

EDITOR PROGRAM NAMES


Name of Code Editor . . . . SEDIT.EXE
Name of Word Processor . . EDIT.COM
Name of Graftec Code Editor SEDIT.EXE

2.13 Quit
──────────

Exits the configurator, returning to DOS or to the PCD Programming


Utilities main menu. The configuration data can either be updated
or it can be discarded.

If the configuration has been changed, this prompt is displayed:

├────────────────────────────────────────────────────────────────────────────────┤
│ QUIT: Configuration altered, save the changes (Y, N or ESC) ? _ │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' will save the changes and exit. Pressing 'N' exits
WITHOUT saving the changes. ESC aborts the "Quit" command and
remains on the Configurator menu.

The configuration is saved into file PCDSETUP.DAT in the current


directory. If the colour set has been changed, the new selected
PCDCOLOR.n file is copied into PCDCOLOR.DAT in the PCD Programming
Utilities directory.

If the configuration has not been changed, the above prompt is not
displayed, and an immediate exit is made. No files are updated.
SCONFIG - Page 30

3. ERROR AND WARNING MESSAGES


══════════════════════════════

Error messages are displayed in capital letters, in intensified video,


left justified on line 23, and are accompanied by a long beep. Error
messages are cleared from the screen on the next key depression.

ERROR 0: PCDSETUP.DAT NOT FOUND OR INVALID

The configuration data file PCDSETUP.DAT is not present in


the current directory and cannot be found in the PCD
Programming Utilities directory. Configuration of the full
package CANNOT be done. The original PCDSETUP.DAT file
supplied on the distribution diskettes should be copied into
the PCD Programming Utilities directory, and ensure that the
"SET PCD=directory" command is executed to indicate this
directory. Refer to the package installation instructions.

ERROR 1: WRITE ERROR ON FILE: PCDSETUP.DAT

The destination disk is not ready or full, and PCDSETUP.DAT


cannot be written. This message is accompanied by a prompt:
"Retry or Abort (R or A) ?". Pressing 'R' (or 'r') causes the
write to be retried. Pressing 'A' exits the configuration
program, file PCDSETUP.DAT is not written.

ERROR 2: PRINTER NOT READY

The "List configuration" command cannot be executed because


the printer is either off-line, not connected or powered off.

ERROR 3: NUMBER OF BLANK LINES AT TOP OF PAGE INVALID


ERROR 4: NUMBER OF LINES PER PAGE INVALID
ERROR 5: NUMBER OF BLANK LINES AT END OF PAGE INVALID
ERROR 6: NUMBER OF SPACES FOR LEFT MARGIN INVALID
ERROR 7: NUMBER OF CHARACTERS PER LINE INVALID

Printer menu error messages. The indicated parameter has an


invalid value, valid values are shown in brackets to the
left of the entry fields. The cursor is placed on the invalid
value, which must be corrected before the menu can be exited.

ERROR 8: INVALID CHARACTER, MUST BE 2 HEX DIGITS

The printer initialization or de-initialization strings must


consist of complete bytes, this requires two hexadecimal
digits per byte. The cursor is placed on the invalid
character.
This must be corrected before the menu can be exited.

ERROR 9: EXACTLY nKB OF CODE/TEXT MEMORY MUST BE ALLOCATED

All the memory on the selected memory card must be allocated


even if the programs do not need all the memory. Use the
"Total" value to see how much memory has been allocated so
far.
Do not allocate any memory to CPUs which do not exist, unless
they may be added later.
SCONFIG - Page 31

Error messages continued


────────────────────────

ERROR 10: CPU 0 MUST HAVE A CODE SEGMENT

CPU 0 is the master CPU and must contain a program.

ERROR 11: PORT COMn DOESN'T EXIST

The selected serial port is not present. See the "Serial


ports present" list for available serial ports on the
"Serial ports" menu.

ERROR 12: INVALID FILE NAME

The file name is not a valid DOS file name, or is a device


name (PRN, COM1 etc). File and directory names can be max.
8 characters. File types can be max. 3 characters.

ERROR 13: INVALID S-BUS STATION NUMBER (0..254, 255=none)

S-BUS stations are 0..254. If it's not an S-BUS station,


set this to 255.

ERROR 14: OUT OF MEMORY

Not enough memory to load the help text. Should never occur.

ERROR 15: CAN'T OPEN FILE: SCONFIG.HLP

The help text file should be in the PCD directory.

ERROR 16: WRONG HELP FILE VERSION: SCONFIG.HLP

The help file is not the one supplied with this version of
the Programming Utilities.

ERROR 17: INVALID HELP FILE FORMAT: SCONFIG.HLP

The help file has become corrupted somehow. Copy the


original file from the distribution diskette into the PCD
Programming Utilities directory.

ERROR 18: READ ERROR ON HELP FILE: SCONFIG.HLP

The help file cannot be read due to a disk read error.

ERROR 19: EXACTLY nKB OF EXTENSION MEMORY MUST BE ALLOCATED

If extension memory is configured, then the exact amount,


as defined by the "Extension memory size" must be allocated.
See the "Total" value.

ERROR 20: CPU WITH TEXT OR EXTENSION MEMORY MUST HAVE CODE

Text and extension memory needs a program to be able to


access it!
SCONFIG - Page 32

Error messages continued


────────────────────────

ERROR 21: INVALID VALUE

The value in the field is invalid, re-enter a valid value


before exiting the menu.

ERROR 22: MODEM TYPE NOT FOUND IN FILE: MODEM.DAT

The MODEM.DAT file in the PCD Programming Utilities'


directory does not contain the selected modem type. Replace
it with the file containing the desired modem configuration.

ERROR 24: CAN'T USE PORT 0 WITH A PUBLIC LINE MODEM

On the PCD2, PCD4 and PCD6.M5, port 0 lacks the control


lines needed for use with public line modems. Select any
other available port.

ERROR 25: PCD6.M5 ONLY PORT 2 (RS-232) SUPPORTS PUBLIC LINE MODEM

Only this port has the necessary control lines for use with
a public line modem.

ERROR 26: GATEWAY PORT SAME AS S-BUS PGU PORT

The port cannot be assigned for two different modes. Change


one of the port numbers. See section 2.6 for details of
gateway configuration.

ERROR 27: ACCESS TO MASTER PCDCOLOR.DAT FILE DENIED

This error occurs if the PCDCOLOR.DAT file in the PCD


directory is read-only, because it is on a network or it has
the read-only attribute set. The user is prompted: "Create
PCDCOLOR.DAT file in the current directory (Y or N) ?".
Answering yes (Y) creates the PCDCOLOR.DAT file in the
current directory, which is used whenever the utilities are
run from this directory.

ERROR 28: GATEWAY NOT SUPPORTED BY PCD1

The PCD1 cannot be used as a @Gateway@.

ERROR 29: CODE MUST BE MULTIPLE OF xxK FOR FLASH EPROM

Code memory must be allocated in blocks of 4K lines for the


128KB Flash EPROM, and 16K lines for the 512KB Flash EPROM.

ERROR 30: TEXT/DB MUST BE MULTIPLE OF xxK FOR FLASH EPROM

Text/DB memory must be allocated in blocks of 16K bytes for


the 128KB Flash EPROM, and 64K bytes for the 512KB Flash
EPROM.
SCONFIG - Page 33

FATAL INTERNAL ERROR: <location>

SCONFIG detected an internal error. <location> shows where


the error was found. Please notify SAIA Technical Support
(me) immediately, indicate the <location> and how it
occurred.

Warning messages
────────────────

WARNING 1: PORT COMn DOESN'T EXIST

The serial port is not present. The available ports are shown
A COM port which is not present should only be selected if
the PCDSETUP.DAT file is to be used on another machine.

WARNING 2: PCD'S S-BUS PGU PORT NOT CONFIGURED FOR PUBLIC LINE MODEM

For the PCD to use the reset and auto-answer on strings


defined on the "Modem for SAIA PCD" screen, the "PGU via
Public Line Modem" switch on the "S-BUS communications"
screen must be set to "Yes".

WARNING 3: S-BUS STATION NUMBER NOT DEFINED (255=NO S-BUS SUPPORT)

This warning is shown on the "Gateway master port" screen


if no S-BUS station namber has been defined on the "S-bus
communications" screen (the number is set to 255). To use
the PCD as a gateway it must have a station number.

WARNING 4: NO S-BUS PGU PORTS DEFINED

This warning is shown on the "Modem for SAIA PCD" screen


if the PCD does not have a PGU port defined from the
"S-bus communications" screen. For modem communications
between the Personal Computer and the PCD, the PCD's S-BUS
PGU port must be used.

WARNING 5: PGU CONNECTION BAUD RATE IS NOT 9600

Only 9600 baud should be used for the current default PGU
port connection. This menu allows it to be changed so that
the baud rate could be increased in the future.

*** END SCONFIG.DOC ***


*********************************************************************
* *
* SDAT - SAIA PCD DATA LOADER PROGRAM *
* FUNCTIONAL SPECIFICATION *
* *
* AUTHOR MATT HARVEY *
* FILENAME SDOC.DOC *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1

21-Jun-96 V2.0

24-Apr-95 V1.9

06-Feb-95 $18A
1) Password entry is now prompted for if data blocks are to
be read or written because this uses telegrams which are
not part of the reduced protocol.
2) Added "ERROR 29: VALUES PER LINE RANGE IS 1..256".

05-Jul-94 $189
1) User-defined output file formats and data separators.
The number of values per line in the .DBK file can now be
defined on the SDAT menu.
2) A new program called SDATFORM.EXE has been written.
This converts a .DBK file into a user-defined format for
reading by a database or spreadsheet package (e.g. Excel).
See section 9.

29-Nov-93 $17A
1) When the "LOAD DATA" operation is selected, the lower part
of the screen (which contains entry fields use only by the
"SAVE DATA" operation) is now blanked.

16-Nov-93 $179
1) Add "ERROR 28: OUT OF TEXT/EXTENSION MEMORY ON DB xxxx".
In previous versions then "ERROR 22: COMMAND NOT ACCEPTED
(NAK RESPONSE)" was displayed when there was not enough
memory to create a new DB. The new error 28 now gives a
a better description of the error.

21-Jun-93 $171
1) SDAT can now be run from the DOS prompt as well as being
menu-driven, see section 2.

09-Jun-93 V1.7
1) Now handles DBs 4000..7999 in extension memory.
2) Works with S-BUS and modems.
3) Can now abort the transfer of large data blocks by
pressing ESCape.
4) Load/save DBs now works much faster.
5) New error messages 21 to 27.
06-Dec-91 $154
1) Now displays "hyperhelp" instead of ASCII help file.
2) Added errors 19 and 20.

10-Sep-91 $152
1) No SDAT.DAT file now, stores data in PCDMENU.DAT.

06-Oct-90 V1.4
1) Can now load/save Data Blocks.
2) Add sections 6.1 - 6.3.
3) Add errors 15 to 18, change error 6 text.

06-Dec-89 Initial edit, version $001.


CONTENTS
════════
PAGE

1. INTRODUCTION . . . . . . . . . . 1

2. INVOCATION FROM DOS . . . . . . . 1

3. THE MENU . . . . . . . . . . . 2

4. SAVING DATA (from PCD to data file) . . 3

5. LOADING DATA (from data file to PCD) . . 4

6. DATA FILE (.DBK) FORMAT . . . . . . 5


6.1 Elements . . . . . . . . . . 5
6.2 Data Blocks . . . . . . . . . 7
6.3 Units . . . . . . . . . . . 8

7. ERROR MESSAGES . . . . . . . . . 9

8. IMPORTANT NOTES . . . . . . . . . 12

9. SDATFORM.EXE: DBK FILE FORMATTER . . . 13


SDAT - Page 1

1. INTRODUCTION
════════════════

This program (SDAT.EXE) can be used to save and restore the values of
Registers, Counters, Timers, Flags, Inputs, Outputs and Data Blocks.
It can also read a file containing user defined data, and load it
into the PCD. This feature can be used to re-configure a program or
to provide a new "recipie" etc.

SDAT can be either menu-driven, or commands can be given on the


DOS command line.

The SAVE DATA operation reads element values from the PCD and stores
them in an ASCII data file (.DBK).

The LOAD DATA operation reads an ASCII data file (.DBK) and loads the
element values into the PCD. The data file can be created either by
the SAVE DATA operation or by using any word processor (PE etc).
SDAT - Page 2

2. INVOCATION FROM DOS


═══════════════════════

The data loader is invoked from DOS with this command:

SDAT [filename[.DBK] [data...]] [/Rnnn] [/Innn]

Where: filename = Save/load file name, default type = ".DBK"


data := Defines data to be saved, if blank then
the file is loaded.
Format: <type><start>[-<end>][units]]
type = R|C|O|F|DB (C=counters/timers,
O=inputs/outputs)
start = start address
end = end address
units = D|H|F (Decimal, Hex, Floating point),
for R|C|DB only
/Rnnn nnn = values per line for R|T|C|DB (default=5)
/Innn nnn = values per line for I|O|F (default=10)

SDAT without the "filename" or "data..." parameters executes the


menu-driven version. The /R and /I switches can be used with the
menu-driven version.

Examples:
SDAT (invokes menu-driven SDAT)
SDAT /R50 /I100 (invokes menu-driven SDAT, with 50 R/T/C
per line, and 100 I/O/F)
SDAT C:\DATA1 (loads data from file C:\DATA1.DBK)
SDAT C:\DATA1 R0-4095H
(saves all registers to file C:\DATA1.DBK
in hex)
SDAT ALLDATA R0-4095 C0-1599 F0-8191
(saves all R/T/C/F to file ALLDATA.DBK in
the current directory)

SDAT can also be invoked from the PCD Programming Utilities main menu
using the "Transfer data" command.

Execution examples:

C:\WORK>SDAT TEST R0-4095 C0-1599 F0-8191

SAIA PCD DATA LOADER V2.1


Saving to file: TEST.DBK

Reading data...
Writing to file...

Operation complete

C:\WORK>SDAT TEST

SAIA PCD DATA LOADER V2.1


Loading file: TEST.DBK

Verifying file...
Writing data to PCD...

Operation complete
SDAT - Page 3

2.1 DOS Return Values


──────────────────────

SDAT returns the following status values to DOS when invoked from
the DOS prompt. A non-zero value means that the operation failed.
SDAT will have displayed an error message on the screen before
exiting. The return value can be checked by using ERRORLEVEL in a
batch file.

0 Operation successful
1 Invalid command line parameter
2 Failed, communications or other error
3 Aborted with Ctrl+C or ESC
SDAT - Page 2

3. THE MENU
============

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD DATA LOADER V2.1 │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│┌──────────────────────────────────────────────────────────────────────────────┐│
││ Operation, SPACE to select LOAD DATA: Data file -> PCD ││
││ ││
││ Data file name . . (.DBK) Q:TEST________________________________________ ││
│└──────────────────────────────────────────────────────────────────────────────┘│
│ │
│┌──────────────────────────────────────────────────────────────────────────────┐│ ┐
││ ADDRESS RANGES FOR THE "SAVE DATA" OPERATION ││ │
│├──────────────────────────────────────────────────────────────────────────────┤│ ├─ This section is
││ ││ │ visible only
││ Registers . . (R 0..4095) _____ 4095_ Register units Decimal ││ │ when the "SAVE
││ ││ │ DATA" operation
││ Counter/Timers (C 0..1599) _____ 1599_ R|T|C|DB values per line 5__ ││ │ is selected
││ ││ │
││ Flags . . . . (F 0..8191) _____ 8191_ I|O|F values per line 10_ ││ │
││ ││ │
││ Outputs/Inputs (O 0..8191) _____ _____ ││ │
││ ││ │
││ Data Blocks . (DB 0..7999) 0____ 7999_ DB units . . . Decimal ││ │
│└──────────────────────────────────────────────────────────────────────────────┘│ ┘
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select operation. ARROW keys move, ENTER executes, ESC exits. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The cursor is moved between the entry fields on the menu using the
ARROW, TAB or BackTab keys. Pressing ESCape exits to DOS or to the
PCD Programming Utilities menu. Pressing <CR> (Enter) executes the
selected operation. Function key F1 displays the help file SDAT.HLP.

The operation must be selected first by moving the cursor onto the
"Operation" field and using the SPACE bar to select:

LOAD DATA: Data file -> PCD


SAVE DATA: PCD -> Data file

A file name is required either as a source for the data to be loaded


into the PCD, or as a destination for the data read from the PCD.

The ADDRESS RANGES FOR "SAVE DATA" OPERATION box, on the lower part
of the screen, is only visible if the "SAVE DATA" operation is
selected. The address range entry fields are not used by the "LOAD
DATA" operation.

On exit of SDAT, the data in the entry fields is saved in the


PCDMENU.DAT file in the current directory. The next time SDAT is
used from this directory, the entry field data is restored from
PCDMENU.DAT.
SDAT - Page 3

4. SAVING DATA (from PCD to data file)


═══════════════════════════════════════

Before executing the SAVE DATA operation, the start and end addresses
of each element type to be saved must be entered on the menu. To
exclude an element type from being saved in the data file, leave the
start address blank. If the start address is blank, the end address
is ignored.

The units for representing the values of Registers and Data Blocks
saved in the data file can be selected as decimal, hex or floating
point. For floating point units, if the value is not a valid floating
point number, then it is stored in decimal. Timers and Counters are
always saved in decimal.

The number of values per line for 32-bit values and for boolean
values can also be entered.

*** NOTE ***

Data Blocks may or may not be present in the PCD's memory. SDAT
must read the PCD's memory to determine if the Data Block exists.
The start and end Data Block numbers should be set to the smallest
possible values, otherwise SDAT loses time examining non-existant
Data Blocks. It can take several minutes to check for the existence
of 8000 Data Blocks!
SDAT - Page 4

5. LOADING DATA (from data file to PCD)


════════════════════════════════════════

Before data can be loaded into the PCD, a valid data file (.DBK) must
be created. This can either be created by the SAVE DATA operation, or
it can be edited using any ASCII word processor (PE etc). The format
of the data file is described in section 6.

The data file is verified before any data is loaded into the PCD.
If an invalid line is found in the data file, an error message is
displayed (which shows the line number) and the LOAD DATA operation
is aborted. No data from an invalid data file is loaded.

The download runs faster if multiple values appear on each line in


the data file.

Data is downloaded into the PCD in the same order that it is defined
in the data file. The download of new data is not synchronized with
the execution of the program. It may be necessary to define elements
in a certain order so that the program in the PCD will run correctly
as the data is being downloaded. For example, a Flag could be set
which is read by the program and indicates that new data has been
downloaded. When this Flag is set, the program can copy the data into
working Registers or Flags, reset the Flag, and continue processing
using the new data. Here is an example of a data file and program
which illustrates this:

The .DBK file:

F 100-199: 0 ; DOWNLOAD THE NEW DATA


R 200-249: 999.0
...
F 100: 1 ; SET THE "NEW DATA AVAILABLE" FLAG

The program:

...
STH F 100 ; IF NEW DATA DOWNLOADED
CFB H 100 ; CALL FB TO COPY DATA INTO WORKSPACE
RES F 100 ; CLEAR THE NEW DATA DOWNLOADED FLAG
...

When a new Data Block is loaded, a Flag can be set to notify the
program, which can then copy the data block into Registers using
the GET instruction. For example:

...
STH F NEWDATA ; IF A NEW DATA BLOCK IS AVAILABLE
JR L NODATA
GET DB 100 ; READ IT INTO THE WORKING REGISTERS
R WORK
RES F NEWDATA ; AND RESET THE DATA AVAILABLE FLAG
NODATA:
...
SDAT - Page 5

6. DATA FILE (.DBK) FORMAT


═══════════════════════════

The data file (default type .DBK - meaning Data Block) is an ASCII
file which contains the element type, address and a set of values
to be loaded. Values can be in any units - decimal (the default),
hex, binary, ASCII. Floating point is also supported for Registers
and Data Blocks. Individual elements can be defined with their own
values, or a set of elements can be defined with a single value
(except for Data Blocks). The data file can also contain comments
and blank lines.

The order of the data in the file is unimportant, although only one
type can be defined per line.

6.1 Elements
─────────────

The format for R|T|C|I|O|F values in the ".DBK" file is like this:

type start [ - end ] : value [ value... ] [ ;comment ]

Where:

type The element's type: R = Register


(Every line must C = Counter } These are
begin with a type T = Timer } the same
and a start address) F = Flag
O = Output (or Input)

start The address of the first element.

[-end] Optional end address for a range of elements, must be


preceded by a dash '-'. A range of elements can be loaded
with a single value.

: A colon is required to separate the address from the data.

value The element's value. Values for Registers, Timers and


Counters can be represented in decimal, hex, binary or
ASCII units, see section 6.3. Register values can also be
represented in floating point. Timers and Counters cannot
loaded with negative or floating point values. For Outputs
and Flags, the binary value must be 0 or 1.

[value...] Additional values for consecutive elements, separated by


spaces or tabs. Additional values cannot be supplied if
an address range was given.

[;comment] Optional comments can appear on any line, and must be


preceded by a semicolon ';'. Everything after ';' to the
end of the line is ignored.
SDAT - Page 6

Examples of elements in a ".DBK" file


─────────────────────────────────────

; FULL-LINE COMMENTS (LIKE THIS) ARE ALLOWED, SO ARE BLANK LINES

F 100: 1 1 0 0 ; F 100=1, F 101 = 1, F 102 = 0, F 103 = 0

R 0-100: 1.2345E+2 ; LOADS REGISTERS 0 TO 100 WITH 1.234500E+02

R 0: 0 1 2 3 4 5 ; R 0 = 0, R 1 = 1, R 2 = 2, R 3 = 3 etc.

T 100: 100 ; LOADS COUNTER/TIMER 100 WITH 100 DECIMAL

C 100: 100 ; LOADS COUNTER/TIMER 100 WITH 100 DECIMAL

R 0: 30H '0' ; R 0 = R 1 = '0' (30H IS ASCII '0')

R 1: 'abcd' ; R 1 = ASCII 'abcd' = 61626364H

T 100-199: 0 ; CLEARS COUNTERS 100 TO 199

R 1000: 0ABCDH ; R 1000 = 0000ABCD HEX

R 1000: 101010111100Q ; R 1000 = 0000ABCD HEX

F 0-8191: 0 ; CLEARS ALL FLAGS


R 0-4095: 0 ; CLEARS ALL REGISTERS

; INVALID EXAMPLES

R 1001: ; INVALID - NO VALUE PRESENT

R 1002 100 ; INVALID - MISSING COLON DELIMITER

R 2000-3000: 100 200 ; INVALID - MORE THAN ONE VALUE AFTER AN


; ADDRESS RANGE

R 4000: 1 2 3 ; THIS LINE IS OK


4 5 6 ; INVALID - EACH LINE MUST BEGIN WITH A TYPE
; AND AN ADDRESS

C 10: -1 ; INVALID - NEGATIVE VALUE ILLEGAL IN COUNTERS


C 11: 1.2 ; INVALID - FLOATING POINT ILLEGAL IN COUNTERS
SDAT - Page 7

6.2 Data Blocks


────────────────

The format of Data Blocks in the data file is slightly different


to the other elements:

DB number '['len']' [ : value... [ ;comment ] ]


[ [ value... ] [ ;comment ] ]...

Where:

DB The data type, indicates it's a Data Block.

number The Data Block's number 0..3999.

'['len']' The length of the Data Block, the number of Registers


it holds. The square brackets MUST be present, for
example "[100]".

: Delimits the length from the data values. This must be


present if data values are present.

value... An optional list data values, in decimal (default),


hex, ASCII or floating point units, see section 6.3.
More than one line can be used to hold the data values.
There cannot be more values than the Data Block length,
but there can be fewer. Undefined values are set to
zero. If no values are present, all values are set to
zeros. If there are more values than will fit into the
Data Block in the PCD's memory, and error message is
displayed, and the additional values are ignored.

Data Block Examples


───────────────────

DB 100 [10]: 0 1 2 3 4 ; LOADS DATA BLOCK 100


5 6 7 8 9 ; WITH TEN VALUES 0-9

DB 101 [10] ; DATA BLOCK 101 HOLDS


; TEN VALUES, ALL 0

DB 102 [10] : 1 2 3 4 5 ; DATA BLOCK 102 IS SET


; TO: 1,2,3,4,5,0,0,0,0,0

DB 103 [3] : 1.23435 3.82143 56H ; MIXED UNITS ARE ALLOWED


SDAT - Page 8

6.3 Units
──────────

Binary Output and Flag values are always saved as 0 or 1.

Counters and Timers are always saved in decimal.

Values for Registers can be saved in decimal, hex or floating point.

Values for loading Registers, Timers, Counters or Data Blocks can be


represented in the data file as decimal, hex, binary or ASCII units.
Registers and Data Block values can also be represented in floating
point units. Timers and Counters cannot be loaded with negative or
floating point values.

The units of a value are determined by its representation:

Decimal Just a decimal number with optional sign

Eg. 1, -1, +1, -1234

Hexadecimal End the hex number with an 'h' or an 'H'

Eg. 1BH, abcdh, DeadBeefH, 0000000AH, FFH

Binary End the binary number (1's & 0's) with 'q' or 'Q'

Eg. 1001Q, 00001111Q, 11001010Q (or 'y')

ASCII 1 to 4 ASCII digits enclosed in single quotes,


IBM extended ASCII codes are supported

Eg. 'A', 'abcd', ' $', 'ÄäöÖ', '╔'

Floating point Must contain a decimal point or an 'E' followed


by an exponent

Eg. 1.2345, 1E7, -1E3, .1, 0.5


SDAT - Page 9

7. ERROR MESSAGES
══════════════════

Error messages are displayed on line 23 and are accompanied by a beep.

ERROR 1: MISSING FILE NAME

A file name (.DBK) is required for both the save and the
load operations.

ERROR 2: INVALID FILE NAME: <filename>

Not a valid DOS file name or is a device name (PRN etc).

ERROR 3: CAN'T OPEN FILE: <filename>

The file doesn't exist or cannot be created.

ERROR 4: READ ERROR ON FILE: <filename>

The file cannot be read, the disk is corrupted.

ERROR 5: WRITE ERROR ON FILE: <filename>

This is usually caused by a full or unformatted disk.

ERROR 6: LINE <n>: <text>

Data files (.DBK) are verified before anything is downloaded


into the PCD. This error occurs if an invalid line is found
in the file (see the invalid examples in section 6), 'n' is
the line number of the invalid line. Correct this line of the
file then try again. Note that Counters and Timers cannot be
loaded with negative or floating point values.

ERROR 7: START ADDRESS GREATER THAN END ADDRESS

Addresses must always be ascending.

ERROR 8: INVALID ADDRESS

The valid address range is shown on the menu.

ERROR 9: MISSING END ADDRESS

If a start address is entered, an end address must also be


given. To prevent elements being saved during a SAVE DATA
operation, clear the start address using SPACE or DEL. If
the start address is clear, the end address is ignored.

ERROR 10: SERIAL PORT COMn NOT PRESENT OR FAULTY

The serial port COMn cannot be used to communicate with the


PCD. Select another port from the "Configure/Serial ports"
menu.

ERROR 11: PCD NOT CONNECTED TO COMn OR POWERED OFF

This program cannot be used when off-line.


SDAT - Page 10

Error messages continued


────────────────────────

ERROR 12: COMMUNICATIONS FAILURE AT ADDRESS: <type> <address>

An error occurred while reading or writing PCD data. Some


of the data may have been correctly read or written. This
may be caused by a faulty cable or by a serious error in
the PCD. The address may not be the actual address, it
could be the first address of a group of up to 16 elements
which are read or written with a single telegram.

ERROR 13: INVALID RESPONSE FROM PCD

This can occur if the PCD contains old or pre-release


firmware.

ERROR 14: OUT OF MEMORY

SDAT doesn't have enough memory. Remove any memory resident


programs (SHELP, RAM disk etc.) and try again. Or try
running the main PCD menus program with the /X switch
("PCD /X") so that extended or expanded memory (if present)
can be used.

ERROR 15: INVALID DATA BLOCK: DB <n>

Data Block 'n' in the PCD's memory is corrupted. The data


in a Data Block is encoded, if the data cannot be decoded,
this error occurs.

ERROR 16: EPROM MEMORY, CAN'T WRITE DATA BLOCK

Data Blocks reside in the user's text memory area. If this


memory is EPROM memory instead of RAM, Data Blocks cannot
be changed.

ERROR 17: DATA BLOCK <n> NOT DEFINED

The Data Block must already exist in the PCD's memory before
data can be loaded into it. SDAT cannot create new Data
Blocks. This can only be done by the assembler or debugger.
The address may be in use as a TEXT, since Texts and Data
Blocks share the same addresses.

ERROR 18: DATA BLOCK <n> TOO SMALL

The Data Block is not large enough to hold the data.


Too many data values have been defined in the file.
The additional values are ignored.

ERROR 19: WRONG HELP FILE VERSION: SDAT.HLP


ERROR 20: INVALID HELP FILE FORMAT: SDAT.HLP

The help file is an old version, or is corrupted. Copy the


latest help file SLOAD.HLP from the distribution diskettes
into the PCD Programming Utilities directory.
SDAT - Page 11

Error messages continued


────────────────────────

ERROR 21: NO RESPONSE FROM S-BUS STATION n

Connection cannot be made to this station. Check it's


powered on, connected to the S-BUS network, and correctly
configured for S-BUS.

ERROR 22: COMMAND NOT ACCEPTED BY PCD (NAK RESPONSE)

The connected CPU cannot execute the command. This can


occur if an attempt is made load a Data Block and the
address is already in use as a Text. It can also occur if
trying to load or save Data Blocks via a serial channel
which does not support the full S-BUS or P800 protocol
(e.g. configured in MODE SD0).

ERROR 23: COMMUNICATIONS ERROR (PARITY, FRAMING OR OVERRUN)

The error remains present even after retries. Usually caused


by incompatible baud rates or comms protocols.

ERROR 24: BAD CONNECTION BETWEEN P800 AND PCD6

Caused by dirty or damaged connector pins. Power off the


PCD6, unplug the PCD8.P800, check it's clean and undamaged,
then re-connect it.

ERROR 25: NO RESPONSE FROM PCD

Check that the PCD or P800 are properly connected to the


correct serial port, and the correct baud rates and
protocols are selected. Can also occur if a SASI instruction
has been executed which reassigns the PCD's serial port, or
if the port is configured for the wrong protocol.

ERROR 26: CPU IN RUN, CAN'T CHANGE SIZE OF DATA BLOCK n

The Data Block is not the same size as the existing DB.
The size cannot be changed if the CPU is running because it
requires a "Restart Cold" to register the new DB size.

ERROR 27: EPROM MEMORY, CAN'T CHANGE SIZE OF DATA BLOCK n

If the user program is in EPROM, but the Data Block (4000..


7999) is in RAM extension memory, the size of DB cannot be
changed because the extension memory map is in EPROM and
this cannot be altered. Only the contents of the DBs can
be changed.

ERROR 28: OUT OF TEXT/EXTENSION MEMORY ON DB xxxx

This error occurs if a new Data Block is created, or the


size of an existing Data Block is increased, and there is
not enough memory in the PCD for the new DB. This should
not normally occur because the DBs should already exist
in the PCDs memory after downloading the program which
accesses them.

ERROR 29: VALUES PER LINE RANGE IS 1..256

The "values per line" figure is out of range.


SDAT - Page 12

8. IMPORTANT NOTES
═══════════════════

Inputs and Outputs

If Inputs or Outputs which do not exist are referenced by SDAT, then


"I/O QUIT FAILURE" errors are logged in the History Table. This does
not affect the running of the CPU.

Input and Output Addressing

Inputs and Outputs share the same addressing space, although each has
a unique address. SDAT has no way of knowing which addresses are Inputs
and which are Outputs. Therefore, Inputs are saved as Outputs 'O' in
the data file. It is not possible to download the state of Inputs into
the PCD, writes to Inputs are ignored.

Counters and Timers

These also share the same addressing space. SDAT treats these as the
same elements, C 100 references the same element as T 100. However,
if Timers are loaded with new values, they will immediately begin
decrementing. Which are Timers and which are Counters is defined by
the DEFTB instruction executed by CPU 0.

CPU Operating Mode

Data transfers can be done when the CPU is in any mode (Run, Stop,
Halt, Conditional Run or Conditional Stop). If any CPU is in Run
when loading new data into the PCD, ensure that its program is not
affected as the new data is downloaded, see section 5.

Floating point conversion errors

Tiny conversion errors may occur with floating point values if they
are uploaded from the PCD and converted from binary representation
into ASCII for the data file. If the data file is re-loaded into the
PCD it is converted back from ASCII into binary. During the convertion,
the least significant bit of the 32-bit precision value may be lost.
For example, this may change a value of 2.5 to 2.4999999. This happens
because the binary representation of a decimal floating point number
can never be exact (unless we had an infinate number of bits for the
value). These errors are so small that they can normally be ignored.

Data Blocks

Data Blocks may or may not be present in the PCD's memory. SDAT
must read the PCD's memory to determine if the Data Block exists.
The start and end Data Block numbers should be set to the smallest
possible values, otherwise SDAT loses time examining non-existant
Data Blocks. It can take over one minute just to check for the
existence of 4000 Data Blocks.
SDAT - Page 13

9. SDATFORM.EXE: DBK FILE FORMATTER


═══════════════════════════════════

The format of the ".DBK" file created by SDAT may not be suitable
for some applications. For example, it cannot be read into a spread-
sheet program such as Excel, and cannot be easily processed by a
database package. For this reason, the DBK file format program
SDATFORM.EXE has been provided. This utility reads and processes a
".DBK" file, created when SDAT reads data from the PCD, inserts a
user-defined delimiter between data values, and creates a new ".OUT"
file.

Using command line switches it can also optionally remove comments,


blank lines, addresses, data block sizes and carriage returns from
the file.

SDATFORM will only work on files created by SDAT. It may not work on
files created manually by a user with an ASCII text editor, because
the format of manually entered files is slightly different and is
less consistant.

Run the program from the DOS prompt (or the "Ms-dos command" menu):

SDATFORM delimiter infile[.DBK] [outfile[.OUT]] [switches]

delimiter Character(s) to delimit data values. Can be any ASCII


characters (except NUL 0), or these escape sequences:
\n Line feed
\r Carriage return
\t Tab
\s Space
\nnn Char code in decimal, e.g. \10
\xnn Char code in hex, e.g. \x0A
For Excel, use ";". Enclose < > or | in quotes, e.g. "|"

infile Input file name, default extension .DBK

outfile Optional output file name, default extension .OUT, if not


given then "infile.OUT" is used.

switches /NC No comments


/NB No blank lines
/NA No addresses
/ND No trailing delimiter at end of line
/LD Leading delimiter at start of line
/NL No linefeeds at end of each line
/NT No ':' address terminators
/NS No DB sizes, e.g. DB 0 [10]:=DB 0:

For example, to read file TEST.DBK, use a semi-colon delimiter (;),


and create file TEST.OUT:

>SDATFORM ; TEST
SDAT - Page 14

To read file TEST.DBK, use a tab character delimiter, remove all


blank lines, comments and addresses, and create file TEST.TMP (/ND
means that there is no trailing delimiter, so there will be no tab
character at the end of each line):

>SDATFORM \t TEST TEST.TMP /NB/NC/NA/ND


or >SDATFORM \9 TEST TEST.TMP /NB/NC/NA/ND

If the delimiter string is to contain spaces, enclose the string in


double quotes, or use the \s escape sequence:

>SDATFORM " " TEST


or >SDATFORM \s TEST

*** END SDAT.DOC ***


***********************************************************************
* *
* SDISASM - SAIA PCD DISASSEMBLER *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME SDISASM.DOC *
* AUTHOR Matt Harvey, SAIA AG *
* *
***********************************************************************

REVISION HISTORY
05-Jan-98 V2.1

21-Jun-96 V2.0

24-Apr-95 V1.9

09-Jun-93 V1.7
1) /E and /NE switches, Extension/No Extension (was /D /ND).
2) Handles new TFR and CPBI instructions.
3) Disassembles new encoded indirect LAN texts.

26-May-92
1) New /D and /ND switches to control disassembly of data
segment.
2) Turning on a disassebly control switch /C (Code), /T (Text)
or /D (Data) now automatically turns all the others off.
E.g. SDISASM FILE /T disassembles only the Text.
SDISASM FILE /C/D disassaembles the code and data, this is
the same as SDISASM FILE /NT.

06-Dec-91 $154
1) Can now disassemble new DATA segment.

04-Oct-90 $139
1) Empty texts "" now listed (SWMR 138).
2) Now disassembles Data Blocks. Invalid Data Blocks are shown
as texts.
3) Added "Error 19: Invalid data block" and "Error 68: Invalid
data block number".

02-Mar-90 $132
1) Now converts binary LAN texts into ASCII format and
inserts the $LAN..$ENDLAN directives.

22-Nov-89 V1.3
1) Allow start and end addresses to be given so that small
sections of the file can be disassembled. This prevents
huge .DSR files being created, which are too big to be
assembled. Added new switches to allow only the code or the
text to be disassembled:
/C /NC Code NoCode
/T /NT Text NoText (SWMR 68)
2) Gives help if invoked with a bad command line from DOS.
3) Removed PG1 format from DLS output.
4) Now disassembles faster due to better file buffering.
5) Added "Invalid address" error and re-numbered the error
messages.
02-Dec-88 V1.2
Changed sign-on format to match Assembler:
Disassembling: file
To: file

22-Mar-88 V1.1
1) Allow either '/' or '-' characters as switch delimiters
(2.0).
2) Missing or invalid install data file is now a fatal
error, add "Fatal error 13: Improper installation"
(4.1).
3) Remove Warning 1 (Section 4.3 removed).
4) Add Registered User name to listing and source format
output (5.1 and 5.2).

25-Jan-88 V1.0
Changed error messages 43, 58, 60, 61. All error messages
now lower case (4.2).

11-jun-87 Initial edit.


SDISASM - Page 1

CONTENTS
========

PAGE
1 OVERVIEW 2

2 INVOCATION FROM DOS 3

2.1 Return Values 4

3 PERFORMANCE AND LIMITATIONS 4

4 ERROR HANDLING 5

4.1 Fatal Errors 5

4.2 Disassembly-time Errors 7

5 OUTPUT FILE FORMAT 9

5.1 Listing Format (.DLS) 9

5.2 Source Format (.DSR) 10


SDISASM - Page 2

1. OVERVIEW
============

The disassembler SDISASM reads an absolute object file (either a


.PCD file created by the linker, or a .UPL file uploaded from the
PCD), and converts it into either listing format or source code
format. The operation performed is the reverse of the assemble-link
procedure.

Output can be sent either to a file or to the printer.

The listing format output is similar to the listing produced by the


assembler. The source format output is in a form which can be
re-assembled and linked to reproduce the original absolute object
file.

Procedure:

+-------+ *********** +-------+


|.PCD or| * * | .DLS |
|.UPL |------>* SDISASM *---+--->|listing|
| file | * * | | file |
+-------+ *********** | +-------+
|
Absolute object file | +-------+
| | .DSR |
+--->| source|
| | file |
| +-------+
|
| +++++++++++
| + listing +
| + or +
+--->+ source +
+ to +
+ printer +
+++++++++++
SDISASM - Page 3

2. INVOCATION FROM DOS


=======================

The disassembler is invoked from DOS with the following command:

SDISASM pcdfile [outfile] [startadds [endadds]] [switches]

Where:

pcdfile The name of the file to be disassembled. The


default file type is ".PCD".

outfile The optional output file name, ignored if output


is to the printer (/P switch). The default output
name is the input file name with file type ".DLS"
or ".DSR". The default file type is ".DLS" if
listing format output, or ".DSR" if source format
output.

Input and output file names can contain a drive


and path name, e.g. "A:\FRED\".

startadds Optional start and end address so that a given


endadds section of the file can be disassembled. Using
these, the file canm be disassembled into several
separate modules, for example each containing one
COB. If these are not used, a single .DSR or .DLS
file is produced, which may be over 1Mb in size
for a large program! Ensure that the start and end
addresses are not inside a multi-line instruction.

switches Optional, these select the output format and the


destination. Switches can be upper or lower case,
not necessarily separated by spaces. Either the
'/' or the '-' character may be used as the switch
delimiter.

/S Source format output, no addresses or


pagination, can be re-assembled.
/L Listing format output, has addresses
and page numbers etc, can't be
assembled.
/P /NP Print or NoPrint. /P sends the output
directly to the printer, no file is
created.
/C /NC Code or NoCode } Disassembly control
/T /NT Text or NoText } switches.
/E /NE Extension or }
No Extension

Turning one of these on automatically


turns the others off, for example
"/C" is the equivalent of "/NT /NE".

Default switches are: /L /NP /C /T /E


SDISASM - Page 4

Command line examples:

Disassemble file FRED.PCD, produce listing format file FRED.DLS:

SDISASM FRED

Disassemble file FRED.XXX, produce source format file FRED.SRC:

SDISASM FRED.XXX FRED.SRC /S

Disassemble only the code in file FRED.PCD, and send the listing
to the printer:

SDISASM FRED /P /C

Disassemble only the extension memory segment EXTN.PCD, into


source format:

SDISASM EXTN /E/S

Invocation example:

C:\>SDISASM FRED

SAIA PCD DISASSEMBLER V1.7


Disassembling: FRED.PCD
To: FRED.DLS

Disassembly complete, 0 error(s)

C:\>_
SDISASM - Page 5

2.1 Return Values


------------------

SDISASM returns a value to DOS on exit. This value can be used by


the parent process or by a batch file which invoked SDISASM (using
the ERRORLEVEL condition parameter).

0 Disassembly complete, no errors.

1 Disassembly completed, but there were disassembly-time


errors.

2 Fatal error, disassasembly was not completed.

3 Disassembly aborted with Ctrl-C or Ctrl-Break, the


output file may be partially completed.

3. PERFORMANCE AND LIMITATIONS


===============================

If the printer is used, the initialisation and de-initialisation


strings set up in the install program are used.

Limitations:

- Only one output file is produced. This file may be very large
because it will contain all the code and texts in the program.
If the source file produced is too big, the assembler SASM
will not be able to re-assemble it (depending on personal
computer memory size). To overcome this problem, use the start
and end addresses, and the switches, to create several smaller
files.

- No checks are made to the structure of the program being


disassembled (COB..ECOB etc).

- No labels or dummy symbols are generated, all operands are


absolute values.

- There are no comments.


SDISASM - Page 6

4. ERROR HANDLING
==================

There are two categories of error, fatal errors and disassembly-time


errors.

When a fatal error occurs, the disassembly procedure is stopped, an


error message is displayed and the program returns to DOS or the
parent process (menu program), with a return value of 2.

Disassembly-time errors do not stop the disassembly procedure (unless


more than 100 occur), but error messages are displayed. If any
disassembly-time errors have occurred, SDISASM exits with a return
value of 1 when disassembly is complete.

4.1 Fatal Errors


-----------------

If SDISASM is invoked from DOS, disk read and write errors will be
preceded by the standard DOS disk error prompt, for example:

Not ready error reading drive A


Abort, Retry, Ignore ? _

Pressing 'A' causes a return to DOS, closing any output file, perhaps
leaving a partly written output file on the disk, the printer deinit-
ialisation string is NOT sent to the printer. Pressing 'R' will retry
the disk operation, allowing recovery. Pressing 'I' causes a return
to the disassembler program, which will display its error message,
close and delete the output file and exit to DOS.

If SDISASM is invoked from the menu, DOS disk error handling is dis-
abled (by the menu program). In this case, the fatal error message
is displayed directly, and control is return to the menu.

These are the fatal errors:

Fatal Error 1: No file name(s)

At least one file name, the name of the input file to be


disassembled must be present.

Fatal Error 2: Too many parameters

The command line has too many parameters.

Fatal Error 3: Invalid switch "<switch>"

The specified switch is not a valid disassembler switch.

Fatal Error 4: Invalid file name: <filename>

Not a valid DOS file name or is a device.


SDISASM - Page 6

Fatal Errors Continued


----------------------

Fatal Error 5: Output file same as input file

The output file has the same name as the input file. If
disassembly continued, the output would overwrite the
input file.

Fatal Error 6: Invalid address

The start or end address is invalid, range is 0..999999.

Fatal Error 10: Read error on file: <filename>

A problem occurred while reading the file, it cannot be


read correctly.

Fatal Error 11: Write error on file: <filename>

An error occurred during a disk write, the disk may be


full.

Fatal Error 12: Can't open file: <filename>

The file cannot be opened for read or write. For reads


(input file), either the disk is not ready or the file
does not exist. For writes, either the disk is not ready,
the disk is full, or the disk or file is write protected.

Fatal Error 13: Printer not ready

The printer is or has gone off line. Data may be lost if


this occurs while printing.

Fatal Error 14: Invalid PCD file: <filename>

The input file is not a valid .PCD or .UPL file.

Fatal Error 15: Checksum error on file: <filename>

The input file has an invalid checksum, it is not a valid


PCD or UPL file.

Fatal Error 16: More than 100 errors

If more than 100 disassembly-time errors occur, disassembly


is aborted.

Fatal Error 17: Out of memory

There is not enough remaining memory to run SDISASM. Remove


any resident programs such as Norton Commander or a RAM
disk, which use large ammounts of memory. SDISASM requires
only about 64K of memory to run.
SDISASM - Page 7

Fatal Error 18: PCDSETUP.DAT not found or invalid

The configuration data file PCDSETUP.DAT can't be found or


is an old version.

Fatal Internal Error: Reference: <reference>

The disassembler detected an internal problem. <reference>


describes the module and position of the error. Notify
SAIA Technical Support (attn. Matt Harvey) immediately,
supplying the file and the Disassembler version number.

4.2 Disassembly-time Errors


----------------------------

During disassembly, the following program errors can be detected:

- Operand range errors.

- Invalid mc/cc/sc etc.

- Invalid instructions.

- Unexpected operands.

- Missing operands.

Error messages are reported to the console with an error number, the
instruction line number where the error occurs and a text describing
the error. The error description also appears as a comment in the
output, on the line containing the error.

Disassembly-time error messages:

Error 19: Invalid data block

A data block stored in encoded binary format in the text


segment has an invalid format and cannot be decoded. The
data block is disassembled as a text.

Error 20: Line n: Invalid memory flag


Error 21: Line n: Invalid I|O number
Error 22: Line n: Invalid flag number
Error 23: Line n: Invalid T|C number
Error 24: Line n: Invalid register number
Error 25: Line n: Invalid medium type
Error 26: Line n: Invalid condition code
Error 27: Line n: Invalid constant
Error 28: Line n: Invalid PB number
Error 29: Line n: Invalid FB number
Error 30: Line n: Invalid opcode
Error 31: Line n: Invalid OB number
Error 32: Line n: Invalid priority
Error 33: Line n: Invalid text number
SDISASM - Page 8

Disassembly-time Errors Continued

Error 34: Line n: Invalid timebase


Error 35: Line n: Invalid analogue channel
Error 36: Line n: Invalid operand
Error 37: Line n: Invalid output number
Error 38: Line n: Invalid base address
Error 39: Line n: Invalid nibble number
Error 40: Line n: Invalid bit number
Error 41: Line n: Invalid byte number
Error 42: Line n: Invalid word number
Error 43: Line n: Invalid long word number
Error 44: Line n: Invalid digit number
Error 45: Line n: Invalid instruction
Error 46: Line n: Invalid semaphore
Error 47: Line n: Invalid test number
Error 48: Line n: Invalid exponent
Error 49: Line n: Invalid FB parameter
Error 50: Line n: Missing operand
Error 51: Line n: Unexpected operand
Error 52: Line n: Operand not zero
Error 54: Line n: Incompatible data sizes
Error 55: Line n: Negative constant
Error 56: Line n: Invalid relative address
Error 57: Line n: Invalid accu status
Error 58: Line n: Incompatible data types
Error 59: Line n: Invalid serial channel
Error 60: Line n: Invalid station number
Error 61: Line n: Invalid switch
Error 62: Line n: Invalid control signal
Error 63: Line n: Invalid SB number
Error 64: Line n: Invalid ST/TR number
Error 65: Line n: Invalid Graftec parameter
Error 66: Line n: Illegal FB parameter ref
Error 67: Line n: Invalid FB param number
Error 68: Line n: Invalid data block number
Error 69: Line n: Invalid count
SDISASM - Page 9

5. OUTPUT FILE FORMATS


=======================

5.1 Listing Format (.DLS)


--------------------------

The listing type output of the .DLS file is similar to the .LST file
produced by the assembler, except that the width is 80 characters
(plus any margin), and any errors found are indicated by an error
message as a comment.

The listing is formatted according to the printer configuration.

Tabs are used for all spaces, minimizing the size of the output file.

The title lines appear at the start of each page. The title lines show
the input file name, the creation date and time of the input file, the
disassembly date and time and the page number.

Following the title lines is the registered user name.

The dates and times are in a COUNTRY dependent format (see MS-DOS
Manual for COUNTRY command).

Listing Example:
1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
*** SAIA PCD DISASSEMBLER V1.7 *** PAGE 1
FILE: MAMI.PCD ( 9.11.89 9.08 ) DISASSEMBLED: 23.11.89 16.52

<registered user name>

0 COB 1
1 0
3 CSB 1
4 ECOB
;
. . .
92 STXTX 1
93 20
94 LD T|C 10
95 6000
97 RES F 240
98 NOP
99 NOP
100 EST
;

;END
SDISASM - Page 10

5.2 Source Format (.DSR)


-------------------------

The .DSR source format can be used as input to the assembler. It is


not paginated according to the printer configuration and does not
contain addresses.

The width is up to 80 characters, any errors found are indicated by an


error message as a comment.

Tabs are used for all spaces, minimizing the size of the output file.

The title line, containing the input file name, it's creation date
and time, and the disassembly date and time appears only once at the
top of the source listing.

Following the title line is the registered user name.

The dates and times are in a COUNTRY dependent format (see your DOS
Manual for COUNTRY command).

Source format example:

1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
; FILE: MAMI.PCD ( 9.11.89 9.08 ) DISASSEMBLED: 23.11.89 16.52
; PRE-RELEASE VERSION FOR SAIA INTERNAL USE ONLY

COB 1
0
CSB 1
ECOB
;
. . .
STXTX 1
20
LD T|C 10
6000
RES F 240
NOP
NOP
EST
;

;END

**** END SDISASM.DOC ****


***********************************************************************
* *
* SDOC - DOCUMENTATION GENERATOR *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME: SDOC.DOC *
* AUTHOR: MATT HARVEY, SAIA AG *
* *
***********************************************************************

REVISION HISTORY
05-Jan-98 V2.1 No changes

21-Jun-96 V2.0
1) $INIT segments with actual addresses are now listed in
the .DOC file.

07-Jun-95 B2.0d
1) SWER 848: Add "Fatal Error 14: SDOC doesn't support $AUTO".

24-Apr-95 V1.9 No changes

09-Jun-93 V1.7
1) Can now use a temporary file for storing automatic comments
to prevent "out or memory' errors when processing very
large files. New /TEMP switch. This also causes macro
definitions to be stored in a temporary file.
2) 32-bit binary values can now be listed in binary if the
new /Q switch is used. Binray values of up to 12 bits long
are now always listed in binary, regardless of the /Q
switch. Previously binray 32-bit values were always
converted to hex.
3) Improved EQU/DEF statement output format.
4) The DOC statement now supports all data types. COB, XOB, PB,
FB, SB, ST, TR, TEXT and DB have been added (4.5), which
means that these can now have automatic comments.
5) $INIT segments containing XOB 16 initialization code are
not listed.
6) Updated to be compatible with assembler SASM V1.7.
7) New /R (Remove blank lines) and /NR (No removal of blank
lines) (2.).

06-Dec-91 $154
1) New "/Dysm[=typ]" switch for defining symbols on the DOS
command line (SWMR 244).
2) All SASM $154 changes also implemented.

04-Sep-91 $152
1) Added section 3.4 Important Notes.
2) Now formats EQU, DEF and DOC statements.
EXTN statements are not listed anymore (they cannot be
formatted because more than one external symbol usually
appears on the same line).
10-Apr-91 V1.51
1) Added /E /NE switches, control listing of EQUate, DEFine,
EXTN and DOC statements.
2) Absolute address in DOC listing now 6 digits to allow for
future program memory expansion.

04-Oct-90 $139
1) Now handles X (text) and DB (Data Block) types.
2) SWMR 145/146: Added /G /NG switches, control listing of
Graftec ST/TR incoming/outgoing parameter lists.

19-Apr-90 $133
1) Documentation can now include the source module line numbers,
use the new /L switch. (SWMR 111)
2) Blank lines in the source file are not listed in the
documentation - use ';' at the start of the line to produce
blank lines.
3) Corrected and updated the examples in section 5.

22-Nov-89 V1.3
1) Now allows more than 80 characters per line (SWMR 6).
2) Doesn't convert lower case symbols to upper case (SWMR 6).
3) Now puts labels into the DOC file (SWMR 6).
4) Allows international character set in labels and symbols
(SWMR 32).
5) Supports expressions in symbol field, eg. FRED+1, TOTO-100.
New /O /NO switches enable/disable this feature. This can be
disabled because the offset may affect the columnation of the
DOC file (SYMBOL+OFFSET may be too wide for the field).
(SWMR 42).
6) Now puts texts into DOC file (SWMR 70).
7) Allows 10 character symbol names (SWMR 71).
8) Gives help if invoked with an incorrect command line from DOS.
9) User selectable comments in DOC file using new switches:
/U User comments only
/A Automatic comments only
/B Both user and automatic comments
10) Don't put lines between $SKIP..$ENDSKIP directives into the
.DOC file.
11) The ';' is NOT stripped from comments.

05-Dec-88 V1.2
1) New, improved documentation format:
- No numeric opcodes.
- Automatic commenting
- Column containing absolute operands.
- Column containing user symbols.
- Shows absolute addresses for jump instructions.
2) "Free memory" indication given.
3) Fatal Error messages renumbered.
4) Warning 0 removed.

22-Mar-88 V1.1
1) Allow either '/' or '-' characters as switch
delimiters.
2) Missing or invalid install data file is now a fatal
eror. Add "Fatal error 13: Improper installation".
Remove Warning 1.

03-Aug-87 Preliminary.
SDOC - DOCUMENTATION GENERATOR - Page 1

CONTENTS
========

PAGE
1. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . 2

2. INVOCATION FROM DOS . . . . . . . . . . . . . . . . . 3


2.1 Return Values . . . . . . . . . . . . . . . . . . 4

3. COMMENTS . . . . . . . . . . . . . . . . . . . . . . . 5
3.1 Automatic Comments . . . . . . . . . . . . . . . . 5
3.2 User Comments . . . . . . . . . . . . . . . . . . 6
3.3 Choice of Comments . . . . . . . . . . . . . . . . 6
3.4 Important notes . . . . . . . . . . . . . . . . . 6

4. DOCUMENTATION FORMAT (.DOC File) . . . . . . . . . . . 7

5. DOCUMENTATION EXAMPLES . . . . . . . . . . . . . . . . 8
5.1 User OR automatic comments (default, no switches) 10
5.2 User comments only (/U switch) . . . . . . . . . . 11
5.3 Automatic comments only (/A switch) . . . . . . . 12
5.4 Both comments (/B switch) . . . . . . . . . . . . 13
5.5 With source file line numbers (/L switch) . . . . 14

6. ERROR HANDLING . . . . . . . . . . . . . . . . . . . . 15
6.1 Error Messages . . . . . . . . . . . . . . . . . . 16
SDOC - DOCUMENTATION GENERATOR - Page 2

1. INTRODUCTION
================

The documentation generator SDOC processes a source file (.SRC),


producing documentation either as a file (.DOC), or as a listing
on the printer.

The documentation is an "absolute" listing, it reflects the code


within the PCD exactly. All externals are resolved (shows the actual
values of all operands even if they are defined externally), and the
program line numbers are absolute (as in the PCD). The "relocatable"
listings produced by the assembler SASM contain unresolved externals
and the program line addresses are relative to the start of the
module (starts from 0 in each module).

Documentation listings can also contain "automatic comments". When


a symbol is defined with an EQU statement, or an element is defined
with a DOC statement (see Assembler Functional Specification): the
comment appearing after the definition is used as the automatic
comment. Wherever the symbol or element is used in the program, the
automatic comment is placed in the comment column of the document-
ation file, see section 3.1 for details.

SDOC uses information from the map file (.MAP) produced by the linker.
The map file contains the start address of the source module, and a
list of all global symbols. The global symbols are loaded into the
symbol table before the source file is processed, thus resolving all
externals. The module's start address provides the absolute addresses
for the documentation.

Documentation files can only be produced when the entire program has
been assembled and linked without errors.

Documentation files are primarily for use by PCD operators (in the
factory for example), not by the programmers themselves, where the
listing files produced by the assembler (.LST) may be of more use.

Functional Diagram
------------------

+--------+ +--------+
| .MAP | | .DOC |
| file |--------+ +---->| file |
| | | ************ | | |
+--------+ +------->* *------+ +--------+
* SDOC *
+--------+ +------->* *------+ +++++++++++
| .SRC | | ************ | + .DOC +
| file |--------+ +---->+ to +
| | + printer +
+--------+ +++++++++++
SDOC - DOCUMENTATION GENERATOR - Page 3

2. INVOCATION FROM DOS


=======================

The documentation generator is invoked from DOS with the command:

SDOC srcfile [mapfile] [switches]

Where:

srcfile The name of the source file for which the


documentation is to be produced. The default
source file extension is ".SRC".

mapfile The name of the map file produced by the linker


when the preceding source file's object module
was linked. The default map file extension is
".MAP". If the map file name is not given, the
map file is given the same name as the source
file, with extension ".MAP".

[switches] Optional switches, upper or lower case. Either


the '/' or the '-' character can be used as the
switch delimiter.

/P /NP Print or NoPrint. /P sends the documentation


directly to the printer, no .DOC file is produced.

/O /NO Offset or NoOffset. If /NO, the offsets are not


shown in the documentation. An offset is a value
added to a symbol name, see section 4. If offsets
are shown, it may affect the columnation if long
symbols with large offsets are shown. The /NO
switch will prevent problems by removing the
offset.

/L /NL Line numbers or No Line numbers. If /L is used,


the source file line numbers are included in the
documentation, see section 5.5.

/G /NG Graftec or NoGraftec. Controls the listing of


Graftec ST/TR incoming/outgoing parameter lists.

/E /NE Equates/NoEquates. Controls the listing or EQU,


DEF and EXTN declarations.

/R /NR Remove blank lines or No Removal of blank lines.

/Q /NQ Show 32-bit binary values in binary rather than


hex. Because 32-bit values are 32 characters
long, the symbol column is overwritten.
NOTE: Binary values of up to 12 bits long are
always displayed in binary, regardless of this
switch.

/Dsym[=val] Defines a symbol, with an optional value in any


units, e.g. /DFRED=1 /dtito=1.2 /dchar='A'
/dHexVal=0ABH. If no value is given, 0 is used.
Up to 10 symbols can be defined in this way.

These switches control which comments appear in the .DOC


file. If no switch is present, the comments are chosen by
priority, see section 3.3.
none User OR automatic comments.
/M Mixed user and automatic comments. The user
comment has priority if both user and automatic
comments are present.
/U User comment only.
/A Automatic comments only.
/B Both user AND automatic comments.

Default switches are: /NP /M /O /NL /G /E /R /NQ


SDOC - DOCUMENTATION GENERATOR - Page 4

Invocation from DOS continued


-----------------------------

File names can contain a drive and path name, eg. "A:\SRC\". The
name of the .DOC file produced is the name of the source file, with
extension ".DOC".

Invocation example, creates documentation for source file EXAMPLE:

C:\>SDOC EXAMPLE

SAIA PCD DOCUMENTATION GENERATOR V1.7


Processing files: EXAMPLE.SRC, EXAMPLE.MAP
Generating file: EXAMPLE.DOC

Free memory: 128452

Documentation complete, 0 error(s)

C:\>_

2.1 Return Values


------------------

SDOC returns a value to DOS on exit. This value can be used by the
parent process or batch file (using the ERRORLEVEL parameter) which
invoked SDOC.

0 Documentation complete, no errors.

1 Not used, there are no recoverable errors.

2 A fatal error occurred (see section 6.1), the


documentation was not completed.

3 Aborted with Ctrl+C or Ctrl+Break.


SDOC - DOCUMENTATION GENERATOR - Page 5

3. COMMENTS
============

3.1 Automatic Comments


-----------------------

Automatic comments are defined by either DOC or EQUate statements


in the source file. Automatic comments describe the data item, for
example the automatic comment for I 0 (Input 0) might be "Power on
switch".

A DOC statement attaches a comment to an type and number:

DOC I 0 ; THIS COMMENT IS ATTACHED TO ELEMENT "I 0"

Wherever element "I 0" (Input 0) is referenced, the automatic comment


can be listed. Allowable element types are:

I, O, F, T, C, R
COB, PB, FB, SB, IST, ST, TR
TEXT (or X), DB
SEMA (or S)

An EQUate statement attaches a comment to a symbol name, and also


gives the symbol a type and value:

INPUT EQU I 0 ; THIS COMMENT IS ATTACHED TO SYMBOL "INPUT"

The automatic comment can be listed wherever the symbol "INPUT"


appears as an operand.

If both DOC and EQU automatic comments exist for an item, then
the comment attached to the symbol has priority. For example, if
these two lines occur in a source file, then the automatic comment
for SWITCH will be "Big red button":

DOC I 0 ; Power on switch


SWITCH EQU I 0 ; Big red button

If a symbol is re-assigned to another symbol, the new symbol also


takes on the original symbol's comment, unless a new comment is
supplied:

BASEADDS EQU I 32 ; INPUT CARD 2


INPUT1 EQU BASEADDS + 1
INPUT2 EQU BASEADDS + 2
INPUT3 EQU BASEADDS + 3 ; UNUSED INPUT

Here, BASEADDS has the comment "INPUT CARD 2", this is also assigned
to INPUT1 and INPUT2. INPUT3 is assigned the comment "UNUSED INPUT",
it has its own automatic comment.

If more than one symbol is used in an expression, for example:

BASEADDS EQU I 32 ; INPUT CARD 2


OFFSET EQU 20 ; OFFSET FOR INPUT 20
INPUT20 EQU BASEADDS+OFFSET

then the comment attached to the LAST symbol in the expression is


used. Above, "OFFSET FOR INPUT 2" is the automatic comment for
INPUT20.
SDOC - DOCUMENTATION GENERATOR - Page 6

3.2 User Comments


------------------

A "user comment" is a comment in the source file which describes what


the program is doing. These can be entered anywhere in the source
module. For example:

; This is a full line user comment


; These are 'user' comments:
STH I 0 ; If button pressed
ANL F 123 ; and the alarm is off
SET O 32 ; then turn on the motor
...

3.3 Choice of Comments


-----------------------

SDOC lists either the automatic comments, the user comments or


both comments in the COMMENT column of the .DOC file. Which of the
comments are listed is selected with the /M (mixed comments), /U
(user comments only), /A (automatic comments only) or /B (both user
AND automatic comments) switches on the command line, see section 2.

If no switches are supplied (the default), then either the user OR


the automatic comments are listed (mixed). If a user comment exists
for a line, this takes priority over the automatic comment. If no
user comment exists for a line, then the automatic comment is listed.

If both comments are selected with the /B switch, then some lines
will have two comments. In this case, the user comment is listed
first, followed by the automatic comment in brackets. If the line has
only one comment, either a user or an automatic comment, then this is
listed.

3.4 Important Notes


--------------------

* The PCD4.B900 I/O card has an input and an output on the same
address. In order to have different automatic comments for both
the input and the output, symbols MUST be used for both elements,
otherwise SDOC will use the same automatic comment for both.

For example: Input0 EQU I 0 ; This is an input


Output0 EQU O 0 ; This is an output

* By default, SDOC removes ALL blank lines from the source file.
The /NR switch disables this feature, and blank lines are not
removed. This may spoil the documentation format, because EQU,
DEF and DOC statements may be removed, and all $INCLUDEs,
macros and false conditional statements are removed, but the
blank lines which were used as spacing between these statements
will not be removed. This produces large blank areas in the
documentation. To solve this problem, all blank lines should
normally be removed. This also removes blank lines which may
be needed, so instead of using blank lines for spacing, use
empty comment lines ";...", which are not removed.
SDOC - DOCUMENTATION GENERATOR - Page 7

4. DOCUMENTATION FORMAT (.DOC File)


====================================

Documentation is a formatted representation of the user's source


file (.SRC). It is formatted into columns with these headings:

"LINE ADDR MNEMO MC OPERAND SYMBOL COMMENT"

LINE The number of the line in the source or include file.


This column is only listed if the /L switch is used.

ADDR The absolute program line address. This is the address


within the PCD where the line can be found.

MNEMO The instruction mnemonic. Blank if it's an operand line.

MC The medimum control code, special code (MOV) or condition


code, blank if none.

OPERAND The absolute operand value, in decimal. For the jump


instructions both the relative address and the absolute
address (in brackets) are shown.

SYMBOL If the operand has been assigned with a symbol, this


shows the symbol name (up to 10 characters). Jump labels
are also shown here. If the symbol has a positive or
negative offset, the offset is shown. Eg. BaseAdds+10.
The offset can be excluded using the /NO switch.

COMMENT Shows either the comment entered in the source file for
this line (user comment, see section 3.2), or an automatic
comment (see section 3.1). Automatic comments are attached
to symbols using EQU or to elements by using the DOC
definition. Section 3.3 describes how comments are chosen
for listing in this column.

Certain data from the source file is removed, and does NOT appear
in the documentation:

* ALL blank lines are removed. For blank lines in the documentation
use a ';' at the start of the source line.

* Comments which begin with double semi-colons ";;" are removed.

* All $directives and PUBL statements are removed.

* Macro definitions and calls are removed. Only the code and
comments produced when the macro is expanded are listed.

* Lines following unsatisfied conditionals ( $IF <false expr> )


are removed.

* All statements between the $SKIP..$ENDSKIP directives are removed.

* Expressions are turned into simple offsets. For example,


"STH BaseAdds+(1 + (45/9) * 10)" is shown as "STH BaseAdds+51".

* If the /NE switch is used, then all EQUate, DEFine, DOC and EXTN
statements are removed. Otherwise they are re-formatted into
tidy columns, and listed.
SDOC - DOCUMENTATION GENERATOR - Page 8

5. DOCUMENTATION EXAMPLES
==========================

Source File (EXAMPLE.SRC):


-------------------------

; DOCUMENTATION EXAMPLE (1)


;; This is a source file (2)
; (3)
EXTN Process ; Process control FB (4)
EXTN MotorOn ; Turns on conveyor motor
;;
DOC I 1 ; Fault contact (5)
;;
OnSwitch EQU I 0 ; Power on switch (6)
Alarm EQU F 123 ; H if alarm condition
ConvCtrl EQU 100 ; Conveyor control PB
;
;---------- CONVEYOR CONTROL
;
PB ConvCtrl
STH OnSwitch ; If switch is on (7)
ANL Alarm ; and there are no alarms
OUT MotorOn ; then turn on the motor
EPB
;
;---------- MAIN COB
;
COB 0
0 ; No time supervision
CPB ConvCtrl
STH Alarm ; If there's an alarm
JR H Label ; then skip the process
CPB Process
Label: STH I 1 ; If there's a fault
OUT Alarm ; then set the alarm flag
ECOB ;;End of block (2)

NOTES:

1) Full line comment.

2) This comment begins with two semi-colons ";;", it will never


appear in the documentation.

3) Blank comment line (only ";"). Defines a blank line in the


documentation.

4) Automatic comments attached to externally defined symbols.

5) Automatic comment attached to absolute element number.

6) Automatic comments attached to local symbols.

7) User comments.
SDOC - DOCUMENTATION GENERATOR - Page 9

Listing file (EXAMPLE.LST)


--------------------------

Created with: SASM EXAMPLE /L

*** SAIA PCD MACRO ASSEMBLER V1.7 *** FILE: EXAMPLE.SRC (14/06/93 17:01 ) ASSEMBLED: 14/06/93
17:03 PAGE 1
SAIA AG, CH-3280 MURTEN

LINE ADDR MNEMO MC OPERAND IEM SOURCE

0001 ; DOCUMENTATION EXAMPLE


0002 ;; This is a source file
0003 ;
0004 EXTN Process ; Process
control FB
0005 EXTN MotorOn ; Turns on
conveyor motor
0006 ;;
0007 DOC I 1 ; Fault contact
0008 ;;
0009 I|O 0 OnSwitch EQU I 0 ; Power on
switch
0010 F 123 Alarm EQU F 123 ; H if alarm
condition
0011 PB 100 ConvCtrl EQU PB 100 ; Conveyor
control PB
0012 ;
0013 ;---------- CONVEYOR CONTROL
0014 ;
0015 0 PB 100 PB ConvCtrl
0016 1 STH I|O 0 STH OnSwitch ; If switch is
on
0017 2 ANL F 123 ANL Alarm ; and there
are no alarms
0018 3 OUT ? 0 E OUT MotorOn ; then turn on
the motor (1)
0019 4 EPB EPB
0020 ;
0021 ;---------- MAIN COB
0022 ;
0023 5 COB 0 COB 0
0024 6 0 0 ; No time
supervision
0025 8 CPB 100 CPB ConvCtrl
0026 9 STH F 123 STH Alarm ; If there's an
alarm
0027 10 JR H 2 JR H Label ; then skip the
process
0028 11 CPB 0 E CPB Process
(1)
0029 12 STH I|O 1 Label: STH I 1 ; If there's a
fault
0030 13 OUT F 123 OUT Alarm ; then set the
alarm flag
0031 14 ECOB ECOB ;;End of block

Assembly complete, 0 warning(s), 0 error(s)

NOTES:

1) Type and value of symbol is declared externally. The 'E' in the


IEM column shows this. The value in the LST file is shown as 0.
SDOC - DOCUMENTATION GENERATOR - Page 10

5.1 User OR automatic comments (default, no switches)


-------------------------------------------------------

Created with: SDOC EXAMPLE


*** SAIA PCD DOCUMENTATION V1.7 *** PAGE 1
FILE: EXAMPLE.SRC (14/06/93 17:01 ) PRODUCED: 14/06/93 17:02
SAIA AG, CH-3280 MURTEN

ADDR MNEMO MC OPERAND SYMBOL COMMENT

; DOCUMENTATION EXAMPLE
(1)
DOC I 1 ; Fault contact (2)
OnSwitch EQU I|O 0 ; Power on switch
Alarm EQU F 123 ; H if alarm condition
ConvCtrl EQU PB 100 ; Conveyor control PB
(3)
;---------- CONVEYOR CONTROL (4)

0 PB 100 ConvCtrl ; Conveyor control PB (5)


1 STH I|O 0 OnSwitch ; If switch is on (6)
2 ANL F 123 Alarm ; and there are no alarms
3 OUT I|O 32 motoron ; then turn on the motor
4 EPB (7)

;---------- MAIN COB

5 COB 0
6 0 ; No time supervision
8 CPB 100 ConvCtrl ; Conveyor control PB
9 STH F 123 Alarm ; If there's an alarm
10 JR H 2 (12) Label ; then skip the process
11 CPB 100 process ; Process control FB
Label: (8)
12 STH I|O 1 ; If there's a fault
13 OUT F 123 Alarm ; then set the alarm flag
14 ECOB (1)

Documentation complete, 0 error(s)

NOTES:

1) Comments beginning with two semi-colons ";;" never appear in


the documentation.
2) EQU, DOC, DEF and EXTN statements are not removed unless the /NE
switch is used.
3) Lines containing only a single ";" (empty comments) remain blank,
use this feature for spacing.
4) Comments are always listed.
5) The automatic comment is shown because there is no user comment.
6) The user comment is shown because this takes priority over the
automatic comment.
7) No comment exists for this line. Lines without operands can never
have an automatic comment. To assign automatic comments to blocks,
they must be referenced using a symbol as in "CPB Process".
8) Labels are always shown on a blank line.
SDOC - DOCUMENTATION GENERATOR - Page 11

5.2 User comments only (/U switch)


-----------------------------------

Created with: SDOC EXAMPLE /U /NE

*** SAIA PCD DOCUMENTATION V1.7 *** PAGE 1


FILE: EXAMPLE.SRC (14/06/93 17:01 ) PRODUCED: 14/06/93 17:06
SAIA AG, CH-3280 MURTEN

ADDR MNEMO MC OPERAND SYMBOL COMMENT

; DOCUMENTATION EXAMPLE
(1)

;---------- CONVEYOR CONTROL

0 PB 100 ConvCtrl (2)


1 STH I|O 0 OnSwitch ; If switch is on (3)
2 ANL F 123 Alarm ; and there are no alarms
3 OUT I|O 32 motoron ; then turn on the motor
4 EPB

;---------- MAIN COB

5 COB 0
6 0 ; No time supervision
8 CPB 100 ConvCtrl
9 STH F 123 Alarm ; If there's an alarm
10 JR H 2 (12) Label ; then skip the process
11 CPB 100 process
Label:
12 STH I|O 1 ; If there's a fault
13 OUT F 123 Alarm ; then set the alarm flag
14 ECOB

Documentation complete, 0 error(s)

NOTES:

1) EQU, DOCDocumentation complete, 0 error(s)


switch was used.

2) The automatic comment is not shown and there is no user comment.

3) Only the user comments are shown.


SDOC - DOCUMENTATION GENERATOR - Page 12

5.3 Automatic comments only (/A switch)


----------------------------------------

Created with: SDOC EXAMPLE /A/NE

*** SAIA PCD DOCUMENTATION V1.7 *** PAGE 1


FILE: EXAMPLE.SRC (14/06/93 17:01 ) PRODUCED: 14/06/93 17:07
*** PRE-RELEASE VERSION FOR SAIA INTERNAL USE ONLY ***

ADDR MNEMO MC OPERAND SYMBOL COMMENT

; DOCUMENTATION EXAMPLE
(1)

;---------- CONVEYOR CONTROL

0 PB 100 ConvCtrl ; Conveyor control PB


1 STH I|O 0 OnSwitch ; Power on switch
2 ANL F 123 Alarm ; H if alarm condition
3 OUT I|O 32 motoron ; Turns on conveyor motor
4 EPB

;---------- MAIN COB

5 COB 0
6 0
8 CPB 100 ConvCtrl ; Conveyor control PB (2)
9 STH F 123 Alarm ; H if alarm condition
10 JR H 2 (12) Label
11 CPB 100 process ; Process control FB
Label:
12 STH I|O 1 ; Fault contact
13 OUT F 123 Alarm ; H if alarm condition
14 ECOB

Documentation complete, 0 error(s)

NOTES:

1) EQU, DOC, DEF and EXTN statements are removed because the /NE
switch was used.

2) Only the automatic comments are shown.


SDOC - DOCUMENTATION GENERATOR - Page 13

5.4 Both comments (/B switch)


------------------------------

Created with: SDOC EXAMPLE /B/NE

*** SAIA PCD DOCUMENTATION V1.7 *** PAGE 1


FILE: EXAMPLE.SRC (14/06/93 17:01 ) PRODUCED: 14/06/93 17:09
*** PRE-RELEASE VERSION FOR SAIA INTERNAL USE ONLY ***

ADDR MNEMO MC OPERAND SYMBOL COMMENT

; DOCUMENTATION EXAMPLE

(1)

;---------- CONVEYOR CONTROL

0 PB 100 ConvCtrl ; Conveyor control PB


(2)
1 STH I|O 0 OnSwitch ; If switch is on (Power on switch)
(3)
2 ANL F 123 Alarm ; and there are no alarms (H if alarm
condition)
3 OUT I|O 32 motoron ; then turn on the motor (Turns on conveyor
motor)
4 EPB

;---------- MAIN COB

5 COB 0
6 0 ; No time supervision
8 CPB 100 ConvCtrl ; Conveyor control PB
9 STH F 123 Alarm ; If there's an alarm (H if alarm condition)
10 JR H 2 (12) Label ; then skip the process
11 CPB 100 process ; Process control FB
Label:
12 STH I|O 1 ; If there's a fault (Fault contact)
13 OUT F 123 Alarm ; then set the alarm flag (H if alarm
condition)
14 ECOB

Documentation complete, 0 error(s)

NOTES:

1) EQU, DOC, DEF and EXTN statements are removed because the /NE
switch was used.

2) No user comment exists so only the automatic comment is shown.

3) A user comment exists, so the automatic comment is shown in


brackets after the user comment.
SDOC - DOCUMENTATION GENERATOR - Page 14

5.5 With source file line numbers (/L switch)


----------------------------------------------

An extra column is listed on the left, with the heading "LINE".


This column shows the number of the line in the source module (.SRC)
or include file.

Created with: SDOC EXAMPLE /L

*** SAIA PCD DOCUMENTATION V1.7 *** PAGE 1


FILE: EXAMPLE.SRC (14/06/93 17:01 ) PRODUCED: 14/06/93 17:09
SAIA AG, CH-3280 MURTEN

LINE ADDR MNEMO MC OPERAND SYMBOL COMMENT

1 ; DOCUMENTATION EXAMPLE
3
7 DOC I 1 ; Fault contact
9 OnSwitch EQU I|O 0 ; Power on switch
10 Alarm EQU F 123 ; H if alarm condition
11 ConvCtrl EQU PB 100 ; Conveyor control PB
12
13 ;---------- CONVEYOR CONTROL
14
15 0 PB 100 ConvCtrl ; Conveyor control PB
16 1 STH I|O 0 OnSwitch ; If switch is on
17 2 ANL F 123 Alarm ; and there are no alarms
18 3 OUT I|O 32 motoron ; then turn on the motor
19 4 EPB
20
21 ;---------- MAIN COB
22
23 5 COB 0
24 6 0 ; No time supervision
25 8 CPB 100 ConvCtrl ; Conveyor control PB
26 9 STH F 123 Alarm ; If there's an alarm
27 10 JR H 2 (12) Label ; then skip the process
28 11 CPB 100 process ; Process control FB
29 Label:
29 12 STH I|O 1 ; If there's a fault
30 13 OUT F 123 Alarm ; then set the alarm flag
31 14 ECOB

Documentation complete, 0 error(s)


SDOC - DOCUMENTATION GENERATOR - Page 15

6. ERROR HANDLING
==================

The validity of the .MAP and .SRC files are checked first:

SDOC checks that the .MAP file is indeed the map file which was created
when the file to be documented was linked. It may not be able to detect
a map file which has since been edited or corrupted. These are checked:

* The delimiting lines for the list of files linked must be


"--------" characters.

* The file's code, text and extension memory sizes should match
those in the .MAP file.

* The actual number of global symbols in the file must be the same
as in the .MAP file.

* The names, values and types of all symbols should be valid.

* All file names should be valid.

SDOC checks the .SRC source file as follows:

* All assembly-time errors are detected, as for the assembler SASM.


Any such error is reported as "Fatal Error 10: Source file error".
For a more detailed error message, the source file must be re-
assembled using SASM.

* All external symbols in the map file which the map file indicates
are referenced by the source file must actually be referenced,
and no other externals should be referenced by the source file.
This is also reported as "Fatal Error 10: Source file error",
and can be remedied by re-assembling and linking the file.

Fatal errors 5, 7, 11 and 12 may be preceded by the standard DOS


error prompt (if invoked from DOS), for example:

Not ready error reading drive A


Abort, Retry, Ignore ? _

Other fatal errors are reported immediately, with no opportunity to


correct the problem.

All fatal errors cause the SDOC program to terminate, and a return is
made to DOS or the invoking menu. After a fatal error, if possible,
the DOC file is deleted, or if the output is to the printer, a form
feed is done and the de-initialisation string is sent.
SDOC - DOCUMENTATION GENERATOR - Page 16

6.1 Error Messages


-------------------

Fatal Error 1: Missing file name

A source file name must be supplied.

Fatal Error 2: Invalid file name: <filename>

The file name is not a valid DOS file name.

Fatal Error 3: Too many parameters

There are too many file names on the command line.

Fatal Error 4: Invalid switch "switch"

The given switch is not recognised.

Fatal Error 5: Can't open file: <filename>

If the file is a source or map input file, this probably


means that it doesn't exist.

Fatal Error 6: Invalid map file: <filename>

The file given as the .MAP file is not a .MAP file.

Fatal Error 7: Printer not ready

The printer is not ready. It is either powered off, not


connected, out of paper or off-line.

Fatal Error 8: Out of memory

There is not enough memory to produce the documentation.


If the source file can be assembled without this error,
then this error should never occur unless a new memory
resident program has been loaded. Remove the offending
program and try again.

Fatal Error 9: Source file <filename> not linked

The source file is not referenced in the map file, this


map file was not created when this module was linked.

Fatal Error 10: Source file error in <file>, re-assemble and link

This has one of 3 causes. To correct it, the file must be


re-assembled and linked.
* When the source file was re-assembled, an assembly-time
error was detected.
* The resulting code, text or extension memory sizes do
not match those in the .MAP file, meaning that the
source file has probably been edited since it was
linked.
* The source file does not have the same externals as
indicated by the .MAP file.
SDOC - DOCUMENTATION GENERATOR - Page 17

Error Messages Continued


------------------------

Fatal Error 11: Read error on file: <filename>

The file cannot be successfully read.

Fatal Error 12: Write error on file: <filename>

This usually means that the destination disk is full.

Fatal Error 13: PCDSETUP.DAT not found or invalid

The configuration data file PCDSETUP.DAT should be in


the current directory or the PCD directory. See the
package installation instructions in README.TXT.

Fatal Error 14: SDOC doesn't support $AUTO

Automatic resource allocation is not supported by SDOC,


documentation cannot be generated from source files
which use the $AUTO directive.
The allocation mechanism will be changed for the next
release of the PG3/Pg4, and SDOC will be updated to
support the new mechanism.

*** END SDOC.DOC ***


*************************************************************************
* *
* SFBREF - PARAMETER CROSS-REFERENCE UTILITY *
* FUNCTIONAL SPECIFICATION *
* *
* FILE NAME: SFBREF.DOC *
* AUTHOR: Matt Harvey *
* *
*************************************************************************

REVISION HISTORY
05-Han-98 V2.1 No changes

21-Jun-96 V2.0 No changes

29-May-96 B2.0d
1) Added Warning 3: Addr <n>: SB <n> has no Initial Step (IST),
and
Warning 4: Addr <n>: More than one Initial Step (IST) in SB <n>

24-Apr-95 V1.9 No changes

29-Mar-95 $185C
1) Added Graftec structure checks, see section 1.
2) New error messages
3) The default switch is now /NL (was /L), which means that
an FB parameter cross-refernce list is NOT generated by
default.

08-Jun-94 $185d
1) Handles new TFRI/STXMI/SRXMI instructions.

09-Jun-93 V1.7
1) Handles new TFR and CPBI instructions.

17-Jan-92 $155
1) SWMR 255: Change "Line" in error and warning messages
to "Adds", it's an absolute line address number, not
a source file line number.

05-Nov-90 V1.4
1) Now handles text (X) and data block (DB) parameters for
PUT and GET.
2) Corrected range check for SRXM/STXM count (0..16).

22-Nov-89 V1.3
1) Gives help if invoked with an incorrect command line from
DOS.

25-Apr-88 Initial edit.


SFBREF - Page 1

CONTENTS
════════
Page

1. OVERVIEW . . . . . . . . . . . . . . . . . . . 2
1.1 Bloctec parameter checks . . . . . . . . . . 3
1.2 Graftec parameter checks . . . . . . . . . . 4

2. INVOCATION FROM DOS . . . . . . . . . . . . . 5

3. FB PARAMETER CROSS-REFERENCE LISTING FORMAT . 6

4. FATAL ERRORS . . . . . . . . . . . . . . . . . 8

5. WARNINGS . . . . . . . . . . . . . . . . . . . 9

6. RECOVERABLE ERRORS . . . . . . . . . . . . . . 10

7. LIMITATIONS . . . . . . . . . . . . . . . . . 13
SFBREF - Page 2

1. OVERVIEW
════════════

This program, named SFBREF.EXE, checks the Bloctec and Graftec


parameters in a .PCD or .UPL type absolute object file.

For Bloctec, it checks that all Function Block (FB) parameter values
and references are valid. It can also produce a cross-reference list
if all Function Blocks and their parameters.

For Graftec, it checks that the incoming and outgoing parameters for
all Steps (ST) and Transitions (TR) are in the correct Sequential
Blocks.

SFBREF is not useful for programs which do not contain Function


Blocks or Sequential Blocks.

Action diagram
──────────────

┌────────────┐ ╔═══════════╗ ┌────────────┐


│ PCD or │ ║ ║ /L switch │ .FBR │
│ UPL ├──────>║ SFBREF ║───────┬────>│ Ref List │
│ file │ ║ ║ │ │ file │
└────────────┘ ╚═══════════╝ │ └────────────┘

│ ┌────────────┐
│ │ Ref List │
└────>│ to │
/P switch │ printer │
└────────────┘
SFBREF - Page 3

1.1. Bloctec parameter checks


─────────────────────────────

It is possible to call a Function Block, supplying it with invalid


parameters. The following piece of code illustrates the type of
error detected by this program:

CFB 0 ; Function Block 0 called, supplying


R 1 ; "R 1" as parameter number 1.

. . . .

FB 0 ; Function Block 0 uses parameter 1


STH = 1 ; in a STH instruction. This is
. . . . ; equivalent to "STH R 1" which is
EFB ; invalid.

The Assembler (SASM) and the Linker (SLINK) do not provide 100%
checks for Function Block parameters. The size of the program and
database required for detailed FB parameter checks would drastically
reduce the performance of the Assembler and Linker. Because of this,
the FB parameter checking is done by this stand-alone program, which
can be executed after the linkage, if required.

This program also creates an optional "Function Block parameter cross-


reference list" in a file or on the printer. This is a list of all
Function Blocks, all their parameter values and all the instructions
which reference these values. This is very useful for documentation
purposes and software maintenance.
SFBREF - Page 4

1.2 Graftec parameter checks


─────────────────────────────

A Graftec Sequential Block (SB) contains Steps (ST) and Transitions


(TR) with lists of incoming and outgoing STs and TRs which creates
the Graftec structure. SBs are numbered 0..31, STs are numbered
0..1999, and TRs are numbered 0..1999.

The same ST or TR cannot be defined more than once. An SB cannot


contain an ST or TR with the same number as an ST or TR in another
SB, and an ST or TR cannot reference and incoming or outgoing ST or
TR in another SB. For example, SB 0 might contain STs and TRs 0..99,
SB 2 might contain STs and TRs 100..299 and so on.

Errors occur if an ST or TR in one SB references an ST or TR in


another SB. This program verifies that all ST and TR references are
in the correct SBs.

Simple example of an illegal TR reference (TR 1 is defined in


SB 0, but called from SB 1):

SB 0: SB 1:

┌──────────────┐ ┌──────────────┐
╔═══╧═══╗ │ ╔═══╧═══╗ │
║ ║ IST 0 │ ║ ║ IST 100 │
╚═══╤═══╝ │ ╚═══╤═══╝ │
│ │ │ │
───┼─── TR 0 │ ───┼─── TR 100 │
│ │ │ │
┌───┴───┐ │ ┌───┴───┐ │
│ │ ST 1 │ │ │ ST 101 │
└───┬───┘ │ └───┬───┘ │
│ │ │ │
───┼─── TR 1 │ <──┬──> ───┼─── TR 1 │
│ │ │ │ │
└──────────────┘ │ └──────────────┘

└─ ERROR: TR 1 is in SB 0 not SB 1

SB 0 SB 1
IST 0 IST 100
I 1 I 1
O 0 O 100
EST EST
TR 0 TR 100
I 0 I 100
O 1 O 101
ETR ETR
ST 1 ST 101
I 0 I 100
O 1 O 1
EST EST
TR 1 ESB
I 1
O 0
ETR
ESB
SFBREF - Page 5

2. INVOCATION FROM DOS


═══════════════════════

SFBREF infile [outfile] [switches]

Where:

infile The input file name, it must be a valid absolute object


file (.PCD or .UPL). The default extension is .PCD.

[outfile] An optional output file name for the FB parameter cross-


reference list. The default extension is .FBR.

If a file name ends with a '.', no extension is used.


File names may have drive and path specifications.

[switches] Optional switches. Either a '/' or '-' character begins


a switch. Switches can appear in any position in the
command line, and can be separated by any number of
spaces or tabs, including none.

/L Create FB parameter cross-reference list file.


/NL Default. Don't create an FB parameter cross-
reference list (even if outfile or /P is
specified). This allows the program to be
checked without generating a listing.
/P Send the FB parameter cross-reference list to
the printer, ignored if /NL is in effect.
/NP Don't send the list to the printer.

Default switches: /NL /NP

Invocation Examples:

Check Bloctec and Graftec in program FRED without generating an


FB parameter cross-reference list.

C:\>SFBREF FRED

Print the FB parameter cross-reference list for file TTACO.PCD:

C:\>SFBREF TTACO /P

or

C:>SFBREF /P TTACO

Create the FB parameter cross-reference list for TTACO.UPL in file


TEMP (the '.' after file name TEMP indicates that no file name
extension is to be used):

C:\>SFBREF TTACO.UPL TEMP. /L


SFBREF - Page 6

3. FB PARAMETER CROSS-REFERENCE LISTING FORMAT


═══════════════════════════════════════════════

The standard title lines are present, indicating the input file name
and creation date, the creation date of the listing, and the reg-
istered users identification.

If any errors or warnings are found, these are listed at the beginning
of the listing.

The cross-reference list is grouped by Function Block number (000-999)


and parameter number (1-255).

For each parameter, there is a list of all its values, and the program
line number where each value is assigned. Parameters are given values
in the Function Block parameter lists that follow "Call Function Block"
(CFB) instructions.

For each parameter there is also a list of parameter references. These


are the instructions which actually use that parameter. For example,
the instruction "STH = 1" references parameter number 1.

FB parameter cross-reference list example:

*** SAIA PCD FB PARAMETER LIST V1.7 *** MODULE: FBR10.UPL (27-04-88 13:41 ) PRODUCED: 27-04-88 13:41
PAGE 3
GOBI DESERT YACHT CLUB, GOBI DESERT

FB PARAM ADDR VALUE/REF ADDR VALUE/REF ADDR VALUE/REF ADDR VALUE/REF

000 1 00306 I|O 0 00326 I|O 8191 00350 I|O 0 00370 I|O 8191
00394 I|O 0 00414 I|O 8191 00438 I|O 0 00458 I|O 8191

00001 STH 00004 STL 00007 ORH 00010 ORL


00013 XOR 00016 ANH 00019 ANL 00022 OUT
00024 COM 00027 SET 00029 RES 00044 BITI
00054 BITO 00062 BITIR 00072 BITOR 00080 DIGI
00277 STXM

000 2 00307 F 0 00327 F 8191 00351 F 0 00371 F 8191


00395 F 0 00415 F 8191 00439 F 0 00459 F 8191

00002 STH 00005 STL 00008 ORH 00011 ORL


00014 XOR 00017 ANH 00020 ANL 00023 OUT
00280 STXM 00281 STXM

000 3 00308 T|C 0 00328 T|C 1599 00352 T|C 0 00372 T|C 1599
00396 T|C 0 00416 T|C 1599 00440 T|C 0 00460 T|C 1599

00003 STH 00006 STL 00009 ORH 00012 ORL


00015 XOR 00018 ANH 00021 ANL 00032 INC
00289 STXM

000 4 00309 R 0 00329 R 4095 00353 R 0 00373 R 4095


00397 R 0 00417 R 4095 00441 R 0 00461 R 4095

00031 INC 00033 DEC 00035 SEI 00037 INI


00039 DEI 00041 RSI 00042 STI 00045 BITI
SFBREF - Page 7

FB parameter cross-reference listing format continued


─────────────────────────────────────────────────────

There are several situations when the parameter values or parameter


references (or both) will be empty. A message appears instead,
indicating the reason:

NO FUNCTION BLOCKS

The program does not contain any Function Blocks. Of course,


there can be no FB parameter cross-reference list!

NO PARAMETERS

The Function Block does not use any parameters.

NO VALUES: FB NOT CALLED

If the FB is not called, no parameter values are present.


The value lists for all the parameters used by this Function
Block will be empty. This also generates a warning, see
Section 5.

NO VALUES: MISSING PARAMETER ERROR

Not enough parameters have been supplied following the


"Call Function Block" (CFB) instruction. Because of this,
this parameter has no values. This also generates an
error, see Section 6.

PARAMETER NOT REFERENCED

This parameter is never used in the Function Block. The list


of instructions referencing the parameter is empty. This
also generates a warning, see Section 5.
SFBREF - Page 8

4. FATAL ERRORS
════════════════

All fatal errors cause SFBREF to abort, returning to DOS or the


parent process (main menu):

Fatal Error 1: PCDSETUP.DAT not found or invalid

Missing or invalid PCDSETUP.DAT file. This file must be


either in the current directory, or the PCD directory
containing the other PCD Programming Utilities programs.

Fatal Error 2: No input file name

An input file name must be provided on the command line.

Fatal Error 3: Invalid file name: <file name>

The input or output file name is not a valid DOS file name,
or is a device name.

Fatal Error 4: Invalid switch: <switch>

Unrecognized switch, see invocation above.

Fatal Error 5: Printer not ready

The printer is disconnected, powered off or off-line.

Fatal Error 6: Can't open file: <file name>

If <file name> is the input file, this means that it doesn't


exist. If <file name> is the output file, the destination
file is read-only or is a directory, or the destination disk
is not ready or full.

Fatal Error 7: Read error on file: <file name>

Error when reading the input file. The file is probably


corrupted, or the diskette has been removed.

Fatal Error 8: Write error on file: <file name>

Error when writing the output file. Usually this means that
the destination disk is full.

Fatal Error 9: Invalid absolute object file: <file name>

The input file is not a valid .PCD or .UPL format file.

Fatal Error 10: Out of memory

There is not enough memory to process the file and create


the FB parameter cross-reference list. If you have any
memory-resident programs such as Norton Commander or a RAM
disk, remove these from memory and try again.
SFBREF - Page 9

5. WARNINGS
════════════

Warnings indicate non-fatal programming errors, executing the program


in a PCD will not cause any problems.

Warning 1: Addr <n>: Parameter not referenced: CFB <n> Param <n>

The indicated parameter is not referenced by the Function


Block.

Warning 2: Addr <n>: Function Block not called: FB <n>

The Function Block exists, but is never called. Its parameters


have no values.

Warning 3: Addr <n>: SB <n> has no Initial Step (IST)

The Initial Step is the entry point of the SB.

Warning 4: Addr <n>: More than one Initial Step (IST) in SB <n>

Each Sequential Block should contain only one Initial Step.


SFBREF - Page 10

6. RECOVERABLE ERRORS
══════════════════════

These are listed to the display and also at the start of the FB
parameter cross-reference list. They do not cause SFBREF to abort,
but are all fatal programming errors. Executing a program containing
errors in the PCD will produce unexpected results.

All of these errors (except errors 30, 41 and 42) are also detected
by the Assembler (SASM) and the Linker (SLINK). They can, however,
be introduced by editing the program using the debugger (SBUG) or
doenloading individual Steps and Trsnaitions, and then uploading the
altered program.

Errors 30, 41 and 42 are not detected by the Assembler or Linker,


these are the errors which this program is primarily designed to
detect.

"Addr <n>" indicates the absolute address (program line number) where
the error occured.

Error 20: Addr <n>: Invalid opcode

The instruction cannot be recognized, it is ignored. The


input file is an invalid or out-of-date PCD file.

Error 21: Addr <n>: Invalid operand

The instruction has an invalid operand, it is ignored.

Error 22: Addr <n>: Missing operand

The instruction is a multi-line instruction, and one or


more of its operands are missing.
SFBREF - Page 11

Error 23: Addr <n>: Unexpected operand

An operand has been encountered which does not relate to


the preceding instruction.

Error 24: Addr <n>: Multi-defined FB

The Function Block has already been defined, it occurs


more than once in the program. It is ignored.

Error 25: Addr <n>: Invalid FB parameter number

Function Blocks can reference up to 255 parameters. This


error should never occur.

Error 26: Addr <n>: Wrong end of block

The end of block statement does not match the opening


statement, for example PB...EFB, COB...EXOB.

Error 27: Addr <n>: Missing end of block

An new block opening instruction has been encountered


before an end of block statement.

Error 28: Addr <n>: Missing parameter(s): CFB <n> from Param <n>

The Call Function Block (CFB) instruction does not provide


enough parameters for the Function Block.

Error 29: Addr <n>: FB <n> doesn't exist

A CFB instruction calls a Function Block which is not


defined.

Error 30: Addr <n>: Bad parameter: CFB <n> Param <p> (val): <adr>
<mnemo>

The indicated parameter is invalid. The instruction which


references the parameter is shown. This is the most common
error. The indicated parameter <p> has a value of "(val)".
It's referenced at program line <adr> by the instruction
<mnemo>.

Error 31: Addr <n>: Illegal parameter reference

A reference to a parameter has been encountered outside a


Function Block. It is ignored.

Error 32: Addr <n>: Invalid SB number


Error 33: Addr <n>: Invalid ST number
Error 34: Addr <n>: Invalid TR number

The Sequential Block, Step or Transition number is invalid.


The program should be re-assembled and linked.
SFBREF - Page 12

Error 35: Addr <n>: Step ST <st> not defined

A Transition or the RSB instruction references Step <st>


which is not defined.

Error 36: Addr <n>: Transition TR <tr> not defined

A Step references Transition <tr> which is not defined.

Error 37: Addr <n>: Multi-defined step: ST <st>

Step <st> is defined more than once. Every ST must have a


unique number, even if it's in another SB.

Error 38: Addr <n>: Multi-defined transition: TR <tr>

Transition <tr> is defined more than once. Every TR must


have a unique number, even if it's in another SB.

Error 39: Addr <n>: Step ST <st> outside SB


Error 40: Addr <n>: Transition <tr> outside SB

The Step or Transition is not inside a Sequential Block.


Normally STs and TRs cannot be created outside an SB using
the Assembler and Linker. Ths can only occur on uploaded
.UPL files where an individual ST or TR was downloaded
and appended to the end of the file.

Error 41: Addr <n>: Step ST <st> not in SB <sb>


Error 42: Addr <n>: Transition TR <tr> not in SB <sb>

The Step or Transition is not in the correct SB. The


program will not run correctly.
SFBREF - Page 13

7. LIMITATIONS
═══════════════

Due to the nature of certain PCD instructions there are some rare
programming errors which cannot be detected. These occur only with
instructions where the maximum value (or type) of the third or fourth
operand is dependent on the value (or type) of the first or second
operand.

Instruction operands may be either absolute values "I 0" or may be


FB parameter references "= 1". Absolute values of operands are ignored
by this program, only the parameter references are processed. Because
of this, not enough information is available to detect these depend-
ency errors.

This affects the following instructions:

BITI The maximum I/O/F address is dependent on the


BITIX number of bits being input or output.
BITO
BITOX
BITIR
BITIRX
BITOR
BITORX

DIGI The maximum I/O/F address is dependent on the


DIGIX number of digits being input or output.
DIGO
DIGOX
DIGIR
DIGIRX
DIGOR
DIGORX

MOV The data type of the source and destination


MOVX must be the same.

SRXM The source and destination data types must


STXM be compatible (e.g. R -> T or I -> F etc.),
TFR and the maximum no. of elements that can be
transferred is dependent on the element types.

NOTE: SFBREF does not know what value will be in the Index Register
at run time, and so CANNOT detect indexing errors on FB parameters.

*** END SFBREF.DOC ***


*********************************************************************
* *
* SAIA FILE HANDLING UTILITY FOR PCD8.P3 *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME sfile.doc *
* AUTHOR Matt Harvey, SAIA Murten *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1 No changes

21-Jun-96 V2.0

27-Feb-96 $19D
1) SWMR 602: Filename validity check now checks for 8+3
characters.

24-Apr-95 V1.9

09-Jun-93 V1.7
1) Whenever the cursor is in a filename entry field, pressing
function key F5 displays the pop-up directory window, from
which a file name can be chosen.
2) "File display" command improved, can now display any sized
file.

06-Dec-81 $154
1) Now has F1=Help.
2) Add errors 11 and 12.

12-Sep-91 $152
1) Sort option and all entry field data now stored in
PCDMENU.DAT file.

06-Nov-90 V1.4
1) Gives "invalid file name" error if '*' not followed by
'.' or end of name, e.g. "FIL*NAM.*RC" is invalid.
2) Allows wildcard chars * and ? in "erase" command.
4) Now allows wildcard chars in "rename" command.
4) Added "ERROR 10: FILE NOT FOUND: <filename>".

22-Nov-89 V1.3
1) Allows Copy xxx*.SRC to yyy*.SRC.
2) More than one '.' allowed in a file name during entry.
Added ERROR 9: INVALID FILE NAME to handle this.
3) "Copy" assumes current directory if no "To" filename entered.
4) Now works in colour as defined in PCDCOLOR.DAT.
5) Tab characters expanded to spaces by "Print" command.
6) New "Sort Directory" command so that the directory can be
sorted by file name or by file extension.
7) Erase command now prompts "Are you sure (Y or N)?".
8) Corrected bug where "Rename" actually copied a file if the
the drive/directory name was given.
05-Dec-88 V1.2
1) Drive and directory names are now allowed in all file names.
File name entry fields increased to 42 characters.
2) Prompt line and menu texts corrected.
3) Format operation can now format either diskettes A or B
(user selectable) on a two diskette system.
4) File names now checked for validity. New error message
9, invalid file name.
5) Faster "Display" option, now shows "Memory free" which
indicates the maximum size of file which can be displayed,
the entire file is read into memory.

25-Jan-88 V1.1
1) Blinking up and down pointers now indicate if the directory
occupies more than one window full (2.0).
2) Change use of keys in Display File (6.0).
3) Add off-screen indicators in Display File (6.0).

02-Nov-87 V1.0
1) Section 9. Format diskette now formats drive A if the
system has one floppy disk, or drive B if the system has 2
floppy disks. The user cannot select which drive is to be
formatted.
2) Section 10.0. Corrected error messages 2-5 and 8.

04-Mar-87 Preliminary.
SFILE - File Handling Page 1

CONTENTS
========

PAGE

1. OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . 2

2. MAIN FILE HANDLING MENU . . . . . . . . . . . . . . . 3

3. COPY FILES . . . . . . . . . . . . . . . . . . . . . . 5

4. ERASE FILES . . . . . . . . . . . . . . . . . . . . . 7

5. RENAME FILES . . . . . . . . . . . . . . . . . . . . . 8

6. DISPLAY FILE . . . . . . . . . . . . . . . . . . . . . 9

7. PRINT FILE . . . . . . . . . . . . . . . . . . . . . . 12

8. COMPARE FILES . . . . . . . . . . . . . . . . . . . . 13

9. FORMAT DISKETTE . . . . . . . . . . . . . . . . . . . 14

10. ERROR MESSAGES . . . . . . . . . . . . . . . . . . . . 16


SFILE - File Handling Page 2

1. OVERVIEW
============

File handling utilities is a stand-alone program called SFILE.EXE,


which can be run either directly from DOS or as the PCD Programming
Utilities "File handling" menu.

This program provides many of the standard operating system functions,


prompting the user for any required information. By the use of this
utility, the user is protected from the DOS operating system, and
can remain in the PCD Programming Utilities menus without having to
learn the un-intuitive DOS commands.

These functions are provided:

Copy files Copies one or more files from one disk or


directory to another, or from one file name
to another.
Erase files Deletes one or more files.
Rename files Changes the name of an existing file.
Display file Fast file display utility.
Print file Lists a text file on the printer, uses the
page formatting from the configuration file
if .SRC type files are printed.
coMpare files Does a character-by-character compare of
two files. Can be used to check that .PCD
or .UPL files are the same.
Sort directory Sorts the directory display either by file
name (the default) or by file type.
Format diskette Formats the diskette in either drive A or
drive B.
Quit (or ESCape) exits the file handling menu.

On all screens (except when "Copy" or "Format" are actually executing)


the depression of any invalid key is indicated by a short beep, and
any error messages are displayed on line 23. As usual, data entry
fields are displayed in bold video, the selected field is displayed
in reversed video.

Filename entry fields allow full editing facilities, using the


INS, DEL, <- (backspace), HOME and END keys. Pressing the SPACE bar
clears from the current cursor position to the end of the field,
moving the cursor to the start of the next field. Characters which
are invalid in DOS file names can't be entered in filename entry
fields.

During the entry of file names and other information, the directory
display can still be viewed using the PGUP and PGDN keys, as shown
by the second prompt line, see the screen examples.
SFILE - File Handling Page 2

Overview continued
------------------

Whenever the cursor is in a filename entry field, pressing function


key F5 displays a pop-up directory window containing all the file
names which match a default mask, or match the "wildcard" filename
entered in the field. Wildcard file names are drive or directory
names without a file name, or filenames which contain the "*" and
"?" wildcard characters ("*" matches any file name, "?" matches any
character). For example, if "*.SRC" is entered in the field, pressing
F5 displays a window containing all the ".SRC" files in the current
directory. If "C:\WORK" is entered, F5 displays all the files in
directory "C:\WORK".

The directory is displayed in a pop-up window, with the files sorted


by name. Subdirectories are displayed at the end, ended by a back-
slash "\". The last entry is the parent directory "..\". The names
can be viewed with the arrow, PgUp, PgDn, Home and End keys. If the
cursor is on a directory name, pressing Enter displays the contents
of that directory. A file name is selected by moving the cursor onto
the desired name then pressing Enter, the filename is then copied to
the filename entry field on the menu and the directory window is
closed. Pressing ESCape closes the window without chosing a file
name.

*** NOTE ***

SFILE uses the DOS format program, and FORMAT.COM (or FORMAT.EXE)
must be accessible for the "Format Diskette" operation to work.
FORMAT does not need to be in the current directory, providing the
correct search path has been specified using the PATH command,
usually executed from batch file AUTOEXEC.BAT.
SFILE - File Handling Page 3

2. MAIN FILE HANDLING MENU


===========================

This is the first screen displayed, from it the user can select any
operation.

The current drive and directory name, number of files in the current
directory, and the remaining space on the disk are shown on line 3.
The directory itself is shown in a directory window, which holds up
to 22 directory entries. This can be paged up and down using the
PGUP and PGDN keys. Blinking up and/or down arrows show that there
are more files to be seen by paging the window.

Directory entries are shown sorted into alphabetical order either by


file name or by file type. This data is displayed for each file:

File name, File extension, File size, Creation date and time

The format of the creation date and time is dependent on the country,
see the DOS command "COUNTRY".

The directory display also shows entries for the parent directory
(file ".."), the current directory (file ".") and any sub-directories.
For a directory, the word "<DIR>" is displayed in the file size
column, indicating this is a directory not a file. See the screen
examples.

If the directory is empty, "*** NO FILES ***" is displayed.

Selectable functions are listed below the directory window, on lines


17 to 21. These can be selected in the standard way, using the
SPACE or ARROW keys, and executed by pressing ENTER or the single
capital letter in the function name. The selected operation is high-
lighted in reverse video.

When a function is executed, lines 17 to 21 are used to display the


function's prompts for information. The user can still view the
directory while entering the information.
SFILE - File Handling Page 4

Main file handling menu continued


---------------------------------

File handler main menu with directory example:

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA FILE HANDLING UTILITIES V2.1 │
├────────────────────────────────────────────────────────────────────────────────┤
│ Sorted by: File name Files: 34 Bytes free: 520192 │
│ ┌────────────────────────────────────────────────────────────────────────────┐ │
│ │ . <DIR> 2─20─87 10:49 L946 10406 3─04─87 11:33 │ │
│ │ .. <DIR> 2─20─87 10:49 LISTINGS <DIR> 3─04─87 18:45 │ │
│ │ BACKUP BAT 287 2─27─87 15:13 MK C 272 3─04─87 11:33 │ │
│ │ C BAT 169 3─04─87 9:29 MK EXE 7076 3─04─87 11:34 │ │
│ │ DATA 54989 3─04─87 8:26 MK OBJ 458 3─04─87 11:33 │ │
│ │ DATA1 5071 3─04─87 11:23 PE PRO 2352 1─12─87 12:10 │ │
│ │ DIR 1620 3─05─87 7:56 S 64 3─04─87 9:15 │ │
│ │ L461 5071 3─04─87 11:32 SFCMD C 19673 3─04─87 9:58 │ │
│ │ L462 5082 3─04─87 11:31 SFCMD OBJ 7220 3─04─87 10:00 │ │
│ │ L463 5093 3─04─87 11:32 SFDSP C 14290 3─04─87 14:22 │ │
│ │ L484 5324 3─04─87 11:31 SFDSP OBJ 3393 3─04─87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────┐ │
17 │ │ Copy files │ Display file Format diskette │
│ └────────────┘ │
19 │ Erase files Print file Sort directory │
│ │
21 │ Rename files coMpare files Quit │
│ │
23 │ error message line.... │
├────────────────────────────────────────────────────────────────────────────────┤
│ ARROW, SPACE or TAB selects, ENTER or Command letter executes. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘
SFILE - File Handling Page 5

3. COPY FILES
==============

When "Copy files" is selected, the following prompts are displayed


on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ COPY FILES: │
│ ┌────────────────────────────────────────────┐ │
19 │ From │ __________________________________________ │ │
│ └────────────────────────────────────────────┘ │
21 │ To __________________________________________ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (F5=dir), ENTER/TAB/ARROW for next field, ESC returns to menu. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The "From" field is selected first. The "To" field is selected by


pressing ENTER, DOWN ARROW or UP ARROW. When both file names are
entered, and the cursor is in the "To" field, pressing ENTER executes
the copy operation.

The "From" and "To" file names can contain the global file name
characters "*" and "?". "*" matches all characters in the file name
or extension, the "?" matches any single character. Disk drive names
and full path names are allowed.

If "To" is left blank, the current drive and directory is assumed.

For example, this will copy all files from the current directory to
drive A:

From *.*_______________________________________

To A:________________________________________

This will copy all ".SRC" type files from directory SOURCE on drive
C: into the current directory:

From C:\SOURCE\*.SRC___________________________

To __________________________________________
SFILE - File Handling Page 6

Copy files continued


--------------------

When "Copy files" is executed, the screen is cleared, except for


the title line, the cursor is placed on line 3 and the following is
displayed:

Copying from <filename> to <filename> ...

The resident DOS "COPY" program is then invoked to do the copy. It


will display the copy status, indicating which files have been copied,
and any errors that have occurred. The display will scroll up if more
than one screen full of information is displayed. Standard DOS disk
error handling is done, see section 10. Pressing CTRL+C aborts the
copy operation.

Once the copy is completed, the title line is restored (if it has
scrolled off the screen) and the user is prompted to press any key to
continue. When a key is pressed, a return is made to the main menu.

If the current directory has been updated by the copy, this will be
shown in the new directory display on the main menu.

For example:

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA FILE HANDLING UTILITIES V2.1 │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Copying from *.* to A: │
│ │
│ SFILE.OBJ │
│ ABCD.UPL │
│ SFILE.SRC │
│ SFCMD.SRC │
│ SFINP.SRC │
│ SFTXE.SRC │
│ SLOAD.EXE │
│ 7 file(s) copied │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ COPY ENDED: Press any key to continue _ │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘
SFILE - File Handling Page 7

4. ERASE FILES
===============

When "Erase files" is selected, the following prompts are displayed


on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ ERASE FILES: │
│ ┌────────────────────────────────────────────┐ │
19 │ Name of file to erase │ __________________________________________ │ │
│ └────────────────────────────────────────────┘ │
21 │ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (F5=dir), ENTER executes, ESC returns to menu. │
│ View directory with PGUP and PGDN. Help │
└────────────────────────────────────────────────────────────────────────────────┘

The user can now enter a file name for the file to be erased. The
wildcard file name characters "*" and "?" are accepted.

Once the file name has been entered, when ENTER is pressed to start
the erase, this prompt is displayed:

├────────────────────────────────────────────────────────────────────────────────┤
│ ERASE FILES: Are your sure (Y or N) ? _ │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

This gives the user the opportunity to abort the operation. Pressing
'Y' will erase the file(s), pressing 'N'or ESC will abort.

After the erase, the directory display is then updated, and menu is
re-displayed on lines 17 to 21.

If the file to be erased does not exist or cannot be erased (it's a


read only file or the disk is write protected), an error message is
displayed, see section 10.
SFILE - File Handling Page 8

5. RENAME FILES
================

When "Rename files" is selected, the following prompts are displayed


on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ RENAME FILES: │
│ ┌────────────────────────────────────────────┐ │
19 │ Name of file to rename │ __________________________________________ │ │
│ └────────────────────────────────────────────┘ │
21 │ New name ____________ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (F5=dir), ENTER/TAB/ARROW for next field, ESC returns to menu. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The user can enter the present and new file names, the pressing
ENTER when both filenames have been entered will do the rename.
When the rename is complete, the directory display is then updated,
and the selectable function list is re-displayed on lines 17 to 21.

If the file to rename does not exist, a file with the new name
already exists, or the rename fails (file to rename is read only
or the disk write protected), an error message is displayed, see
section 10.
SFILE - File Handling Page 9

6. DISPLAY FILE
================

When "Display file" is selected, the following prompts are displayed


on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ DISPLAY FILE: │
│ ┌────────────────────────────────────────────┐ │
19 │ Name of file to display │ __________________________________________ │ │
│ └────────────────────────────────────────────┘ │
21 │ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (F5=directory), ENTER executes, ESC returns to menu. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The user can enter the name of the file to be displayed, pressing
ENTER will display the file.

If the file does not exist, an error message is displayed, see


section 10.

If the file exists, a "WAIT" prompt is displayed, and part of the


file is read into memory. The first page of the file is displayed,
along with the prompt line. The file can then be viewed using the
following keys, the screen behaving like a movable window onto the
file:

PGUP Next screen

PGDN Previous screen

up arrow Up one line

down arrow Down one line

right arrow Right 8 columns

left arrow Left 8 columns

HOME Start of file

END End of file

CTRL+left arrow First column

CTRL+right arrow Last column


SFILE - File Handling Page 10

Display file continued


----------------------

Left and right scrolling is supported since listing (.LST) files and
source files may be up to 152 characters wide (132 + right hand
margin).

The file name, the line number of the first line on the screen, and
the column number of the first column on the screen are displayed
in bold video on line 25.

If the text is wider than the screen, bold flashing '<<' or '>>'
characters will appear on the left or right of line 25, indicating
that more text can be seen by using the <left arrow> and <right
arrow> keys.

Tab characters are expanded to spaces for the display. Other special
characters such as form-feeds are displayed as standard IBM graphics
characters, see the IBM manuals for the character set.

*** NOTE ***

Only text files should be displayed, displaying any other files such
as object files (.OBJ) or absolute files (.PCD, .UPL, .EXE etc.)
will produce erroneous displays, containing truncated lines and lost
characters.

If a file containing lines longer than 300 characters is displayed,


lines will be truncated and characters will be lost.
SFILE - File Handling Page 11

Display file screen example, the last page of a source file is shown:

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA FILE HANDLING UTILITIES V2.1 │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│ fb strget ; read a string from serial port buffer │
│ sti strix ; | save Index Register │
│ set = strerr ; | set error flag │
│ sei k 0 ; | pointer to first character │
│ ; | │
│loop1: ; | repeat │
│ sth = portne ; | | exit loop │
│ jr l getend ; | | if buffer empty │
│ srxdx = port ; | | read a char from the given port │
│ = string ; | | into the indexed register │
│ ini = strexp ; | | next character │
│ jr h loop1 ; | until expected number reached │
│ ; | │
│ acc h ; | if normal termination │
│ res = strerr ; | reset error flag │
│ ; | │
│getend: rsi strix ; | recover Index Register │
│ efb │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Use PGUP, PGDN, HOME, END and ARROW keys to view file, ESC exits. │
├────────────────────────────────────────────────────────────────────────────────┤
│ Line: 123 Col: 1 F1=Help >> │
└────────────────────────────────────────────────────────────────────────────────┘
SFILE - File Handling Page 12

7. PRINT FILE
==============

When "Print file" is selected, the following prompts are displayed


on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ PRINT FILE: │
│ ┌────────────────────────────────────────────┐ │
19 │ Name of file to print │ __________________________________________ │ │
│ └────────────────────────────────────────────┘ │
21 │ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (F5=directory), ENTER executes, ESC returns to menu. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The user can now enter the name of the file to be printed, this
must be an ASCII text file (.SRC, .LST etc.).

If the file does not exist, or the printer is not ready, an error
message is displayed, and the file name can be re-entered or the
printer made ready before re-trying the operation.

When printing, the following prompt is displayed, the remainder of


the screen is unchanged:

│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ PRINTING FILE: Press ESC to abort print. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing ESC aborts the print, a form-feed is sent to the printer,


and " *** PRINT ABORTED *** " is displayed on the error message line
in bold video. Printing must then be re-started from the beginning.

If the printer goes not ready during the print, an error message is
displayed, and printing is stopped. The print must then be restarted
from the beginning.

If the file type is .SRC, the printer configuration set up by the


configuration program (SCONFIG.EXE) is used to format the data for
printing. Other file types are printed exactly as they are on the
disk. In both cases, the printer initialisation and deinitialisation
strings are sent and tab characters are expanded to spaces. Note
that LST and DOC type files will already be formatted according to
the printer configuration (page size etc).
SFILE - File Handling Page 13

8. COMPARE FILES
=================

When "Compare files" is selected, the following prompts are displayed


on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ COMPARE FILES: │
│ ┌────────────────────────────────────────────┐ │
19 │ Name of first file │ __________________________________________ │ │
│ └────────────────────────────────────────────┘ │
21 │ Name of second file __________________________________________ │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (f5=dir), ENTER/TAB/ARROW for next field, ESC returns to menu. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The "Name of first file" field is selected first. The "Name of second
file" field is selected by pressing ENTER, DOWN ARROW or UP ARROW.
When both file names are entered, and the cursor is on the "Name of
second file" field, pressing ENTER begins the compare operation.

If either of the files does not exist, an error message is displayed


and the file names can be re-entered.

If both files exist, the screen is cleared except for the title line,
the "WAIT" prompt is displayed, the cursor is placed on line 3 and
the following message is displayed:

Comparing <filename> and <filename> ...

The files are the compared, byte by byte. On completion, or if an


error occurs, one of the following messages is displayed on line 5,
accompanied by a beep if it's an error:

Files compare ok
Compare error: Files are different lengths
Compare error: Files are not the same

And the prompt changes to:


│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ COMPARE ENDED: Press any key to continue _ │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

When a key is pressed, a return is made to the file handling menu.

*** NOTE ***

The header in PCD and UPL type files containing identical code and
text segments will be different. Therefore, if either of the files
has a PCD or UPL extension, the header is not compared (the first 40
bytes of the file are skipped during the compare operation).
SFILE - File Handling Page 14

9. FORMAT DISKETTE
===================

When "Format diskette" is selected, the following prompts are


displayed on lines 17 to 21:

│ │ L463 5093 3-04-87 11:32 SFDSP C 14290 3-04-87 14:22 │ │


│ │ L484 5324 3-04-87 11:31 SFDSP OBJ 3393 3-04-87 14:23 │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
│ │
17 │ FORMAT DISKETTE: │
│ ┌────┐ │
19 │ Format diskette in drive │ A: │ │
│ └────┘ │
21 │ Copy system files ? No │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Press SPACE to select drive, ENTER or ARROW for next field, ESC for menu. │
│ View directory with PGUP and PGDN. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

On a system with two floppy diskette drives, either drive A or drive


B can be formatted. On a single diskette system, only drive A can be
formatted. Other drives CANNOT be formatted. The diskette drive is
selected by pressing SPACE.

The "Copy system files" field is a "Yes/No" toggle field, toggled


using <SPACE>. If this option is "Yes", the DOS system files (e.g.
IBMIO.COM, IBMDOS.COM and COMMAND.COM) are copied to the disk after
the format. The user may be prompted by the FORMAT program to enter
a diskette containing the system files, if they are not present on
the current disk.

The diskette in the indicated drive is formatted with the default


format for that drive (high density, double density, single sided or
double sided) depending on the drive type. On machines with high
density drives, double density diskettes CANNOT be formatted from
this menu (instead, use "FORMAT /4" from DOS).

When ENTER is pressed after selecting the drive name and system
files copy option, the screen is cleared except for the title line,
and the following is displayed (the warning message is in bold
video):

FORMATTING DISKETTE IN DRIVE d:

*** WARNING: THIS WILL DELETE ALL THE FILES ON THE DISKETTE ***
Press <CTRL+C> to abort the format.

and the transient program FORMAT is invoked. Program FORMAT.COM or


FORMAT.EXE must be available for the format to continue. The FORMAT
program is then given control, prompting the user to put a diskette
in the selected drive then to press ENTER. At this point the format
can be aborted by pressing CTRL+C. Pressing CTRL+C during the
format will also abort it.
SFILE - File Handling Page 15

Format Diskette Continued


-------------------------

During the format, the user is prompted to enter a volume label for
the diskette. If no volume label is required, press ENTER without
entering a label.

Once the format is complete, the user is prompted "Format another


(Y/N) ?". Answering "N" returns to the main file handling menu,
answering "Y" repeats the format operation.

Example:

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA FILE HANDLING UTILITIES V2.1 │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│ FORMATTING DISKETTE IN DRIVE A: │
│ │
│ *** WARNING: THIS WILL DELETE ALL THE FILES ON THE DISKETTE *** │
│ Press <CTRL+C> to abort the format. │
│ │
│ Insert new diskette for drive A: │
│ and strike ENTER when ready │
│ │
│ Formatting...Format complete │
│ │
│ Volume label (11 characters, ENTER for none) ? FRED │
│ │
│ │
│ 1213952 bytes total disk space │
│ 1213952 bytes available on disk │
│ │
│ Format another (Y/N) ? _ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────┘

Note that the FORMAT program's prompts may vary slightly according
to the machine, different IBM compatible computers may have slightly
different FORMAT programs.
SFILE - File Handling Page 16

10. ERROR MESSAGES


===================

DOS disk error handling is disabled, except when the COPY and FORMAT
programs are running. For these, the standard "Abort, Retry, Ignore ?"
prompts will follow the disk error message. In all other cases, on a
disk or other error, an error message is displayed in bold video on
line 23 accompanied by a long beep.

The following errors can occur:

ERROR 0: PCDSETUP.DAT NOT FOUND OR INVALID

The configuration data file PCDSETUP.DAT cannot be found.


This file should be either in the current directory or in
the PCD Programming Utilities directory. See installation
instructions.

ERROR 1: MISSING FILE NAME

If the user attempts to execute an operation without having


entered a file name in a file name entry field this error
occurs. The function cannot be executed until all file names
have been correctly entered.

ERROR 2: CAN'T OPEN FILE: <filename>

The file is either not present, no diskette is inserted,


or the program cannot be located.

ERROR 3: FILE ALREADY EXISTS: <filename>

When renaming a file, a file with the new name already


exists, the file cannot be renamed with this name.

ERROR 4: CAN'T RENAME FILE: <filename>

The file to be renamed is a write protected file, or the


disk containing the file is write protected, or renaming
a file will create duplicate file names.

ERROR 5: CAN'T ERASE FILE: <filename>

The file to be erased is a write protected file, or the


disk containing the file is write protected.

ERROR 6: PRINTER NOT READY

The printer is or has gone not ready. It could be powered


off, out of paper, disconnected or the on-line/off-line
switch on the printer is set to off-line.

ERROR 7: OUT OF MEMORY

Not enough free memory to execute the operation. May occur


if attempting to display a file which is larger than
available memory.
SFILE - File Handling Page 17

Error messages continued


------------------------

ERROR 8: READ ERROR ON FILE: <filename>

An error has occurred during the reading of the file. Either


the drive is not ready or the disk file is corrupted.

ERROR 9: INVALID FILE NAME: <filename>

The file name is not a valid DOS file name, or is a device


name (PRN, COM1 etc). File and directory names can be max.
8 characters. File types can be max. 3 characters.

ERROR 10: FILE NOT FOUND: <filename>

The file doesn't exist.

ERROR 11: WRONG HELP FILE VERSION: SFILE.HLP


ERROR 12: INVALID HELP FILE FORMAT: SFILE.HLP

The help file is an old version, or is corrupted. Copy the


latest help file SLOAD.HLP from the distribution diskettes
into the PCD Programming Utilities directory.

*** END SFILE.DOC ***


*********************************************************************
* *
* SHELP - SAIA PCD POP-UP HELP UTILITY *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME SHELP.DOC *
* AUTHOR Matt Harvey *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1

24-Apr-95 V1.9

09-Jun-93 V1.7
1) Help texts updated.
2) Now works with DOS 5.

06-Dec-91 $154
Texts and error messages updated.

14-Mar-90 $001
Preliminary, SWMR 106.
SHELP - Page 1

1. INTRODUCTION
================

SHELP is a memory resident utility (TSR, terminate and stay resident


program) which displays help on the SAIA PCD assembly language and
instruction set. Help screens can be displayed at any time from any
application (unless a DOS function is being executed) by pressing
the "hot" key combination: Alt+Shift+H.

SHELP is designed to be used while editing programs using a text


editor such as IBM's Personal Editor (PE).

SHELP remains resident and monitors key depressions until Alt+Shift+H


is pressed. It then takes control and displays help screens read from
file SHELP.HLP. When ESCape is pressed, SHELP restores the display
and returns to the application which was running when Alt+Shift+H was
pressed.

If the beeper is sounded when Alt+Shift+H is pressed, this means that


a DOS function is executing (write to disk etc.). DOS functions are
not re-entrant, and SHELP cannot take control until the DOS function
is complete. Press Alt+Shift+H again after a few moments.

*** NOTE ***

SHELP uses about 36K of memory when resident. If memory space is a


problem, remove other resident utilities such as disk caches or DOS
shells etc. The PCD menus also occupy memory, using SHELP at the same
time as the menus reduces the available memory and an "out of memory"
error may occur when editing or assembling a very large file.

SHELP should co-exist happily in memory with all other well-behaved


TSR programs. It observes all the usual TSR formalities.
SHELP - Page 2

2. LOADING AND UNLOADING SHELP


===============================

The files SHELP.EXE and SHELP.HLP should be copied into the same
directory as the other PCD Programming Utilities. The environment
string "PCD" must be set to point to this directory (so that SHELP
can find SHELP.HLP), for example:

SET PCD=C:\PCD

This is normally executed from the AUTOEXEC.BAT file.

To load the resident section of SHELP into memory, execute the


command "SHELP" from DOS, for example:

C:>SHELP

SAIA POPUP HELP V2.1


Installed, use Alt+Shift+H to display help

C:>_

To unload SHELP from memory, execute the SHELP command again, for
example:

C:>SHELP

SAIA POPUP HELP V2.1


Removed from memory

C:>_

To display the help, press Alt+Shift+H. To return to the previous


application, press ESCape.
SHELP - Page 3

3. THE HELP DISPLAY


====================

The display uses the entire screen, and has the traditional title
and prompt lines. This is the main index page (example only):

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA POPUP HELP V2.1 │
├────────────────────────────────────────────────────────────────────────────────┤
│ INDEX │
│────────────────────────────────────────────────────────────────────────────────│
│ Accumulator LAN2 command texts INSTRUCTION SET: │
│ Assembler directives LAN2 diagnostic flags Bit │
│ Comments Macros Integer │
│ Condition codes Medium control codes Floating point │
│ Conditional assembly Operator precedence Bloctec │
│ Constants SASI texts Graftec │
│ Data types Status flags Communications │
│ Declarations Texts LAN2 │
│ Diagnostic flags Data Blocks Control │
│ Diagnostic register Extension memory Special │
│ Exception Org'n Blocks Definition │
│ Expressions Index register │
│ Help on help │
│ Include files │
│ Instruction index │
│ Jump labels │
│ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ HELP: Select a highlighted help topic using the arrow keys, then press ENTER. │
│ Use PGUP and PGDN to view pages, ESCape exits. F1=Index F9=Back F10=Forward │
└────────────────────────────────────────────────────────────────────────────────┘

Other help topics, for which there is another help screen, are shown
highlighted on the display. For the index page, all the topics are
highlighted. Highlighted topics are selected by moving the reverse
video cursor with the arrow keys. Press ENTER to display the help
screen of the selected topic.

The PGUP and PGDN keys can also be used to view the help screens.
Some help displays have more than one screen of information. This
is indicated by --PgDn-> in the bottom right-hand corner of the
display. Press the PGDN key to view the other pages.

The F9 and F10 keys can be used to display the help screens which
have already been displayed. A circular buffer containing the last
20 help screens displayed is maintained, F9 moves back in this buffer,
F10 moves forward.

The F1 key displays the main help index, and ESCape restores the
display and returns control to the application which was running
before Alt+Shift+H was pressed.
SHELP - Page 4

4. ERROR MESSAGES
=================

During loading of SHELP into memory these errors can occur:

Error: Hotkey Alt+Shift+H already used

The hot key used to invoke SHELP is already being used as a


hot key by another application. Remove this application from
memory before executing SHELP. At present, SHELP's hot key
cannot be changed.

Error: Initialization failed

SHELP was unable to load itself into memory, probably because


not enough memory is available.

Error: Help file SHELP.HLP not found

The help file SHELP.HLP must be either in the current directory,


or in the directory indicated by the "SET PCD=path" environment

Error: Invalid SHELP.HLP file

The SHELP.HLP file is an old version, its version is not the


same as the version of SHELP.EXE.

Once loaded, SHELP detects these errors. They are all fatal, and
the user is prompted "CAN'T CONTINUE: Press any key to exit".

ERROR: WRONG HELP FILE VERSION: SHELP.HLP


ERROR: INVALID HELP FILE FORMAT: SHELP.HLP

One of these errors will occur if the SHELP.HLP file is not the
correct version (SHELP.EXE and SHELP.HLP are different versions).

ERROR: OUT OF MEMORY

Not enough memory to load a page from the help file. Should
never occur, if it does then notify SAIA Technical Support
immediately.

ERROR: CAN'T OPEN HELP FILE: SHELP.HLP

Since SHELP was loaded, the environment has been changed, and
SHELP can't find the help file SHELP.HLP.

ERROR: READ ERROR ON HELP FILE: SHELP.HLP

There was a problem reading the SHELP.HLP file. This can occur if
the diskette containing SHELP has been removed, or if SHELP.HLP
is corrupted.

*** END SHELP.DOC ***


***********************************************************************
* *
* SLOAD - LOADER MENU *
* SUPLD - UPLOADER *
* SDNLD - DOWNLOADER *
* *
* FUNCTIONAL SPECIFICATIONS *
* FILENAME SLOAD.DOC *
* AUTHOR Matt Harvey, SAIA, Murten *
* *
***********************************************************************

REVISION HISTORY
05-Jan-98 V2.1
1) Add downloader errors 42..44:
Error 42: Code segment not downloaded
Error 43: Text segment not downloaded
Error 44: Extension memory segment not downloaded

20-Jun-97 $209
1) Add downloader SDNLD errors 37 to 41.

24-Mar-97 $208
1) Add Flash EPROM suppport.
2) Added loader SLOAD menu error messages:
ERROR 25: GATEWAY NOT SUPPORTED BY PCD1
ERROR 28: MEMORY MAP CORRUPTED OR INVALID

21-Jun-96 V2.0

20-Mar-96 $19G
1) SWMR 680 & 815: Added handling for $CPU, $STATION and $PCDVER
assembler directives. Added section 4.3 Downloader Warnings.

14-Mar-96 $19F
1) Added "UPLOAD PCD SETUP" and "DOWNLOAD PCD SETUP" commands.
See sections 2.2.8 and 2.2.9.
2) Added description of function keys to section 2.2.1.
3) Added section 2.4 Changing PCD RAM Backup Batteries.

12-Feb-96 $19D-$19E
1) Added "Run all CPUs on completion" and "Clear all outputs"
switches. The main screen's layout has been changed. See 2.2.
2) S-BUS can now be configured via an S-BUS connection. SLOAD
automatically re-connects to the original PCD using the
new S-BUS configuration. This works for the station number,
baud rate and signalling mode. See 2.2.4.
3) Add ERROR 27, remove ERROR 25.
4) The uploader SUPLD.EXE now has /NX switch (No eXtension)
which prevents extension memory being uploaded.
5) Some uploader SUPLD.EXE error messages re-numbered.
6) The downloader SDNLD.EXE now displays the states of all
CPUs (Run/Stop/Halt etc.) on completion of an operation,
so we know which CPUs were put into run etc. by the /R
and /RA switches.
7) Changed SDNLD Error 28 to "Error 28: The PCD4.M4 cannot
use port 2 or 3 as a PGU port", old error 28 removed.
See 4.3.

16-Oct-95 $198
1) PGU mode support.
24-Apr-95 V1.9

06-Feb-95 $18A
1) The "CONFIGURE S-BUS" command now writes the gateway
configuration to the PCD. This is defined on the
"Configure/Gateway master port" screen, now displayed by
pressing function key F6.
2) New downloader error messages:
Error 31: Not enough space for header, delete CPU 0's
code or reallocate memory
Error 32: PCD <fw version> only supports the "Factory
Default" modem
Error 33: PCD <fw version> doesn't support the S-BUS
gateway
Error 34: PCD <fw version> doesn't support selectable
Break/Parity signalling

18-Aug-94 $188
1) SDNLD now downloads the PCDReset and PCDInit strings defined
on the new "Configure/Modem for SAIA PCD" menu.
2) Added error messages:
Error 30: Modem type <modem type> not found in <filename>
Error 31: Firmware <version> only supports the "Factory Default"
modem
Error 32: Not enough space for header, memory must be
reallocated

18-Jul-94 $187
1) Function keys are now used as short-cut keys to display
configuration screens: F2=Hardware and memory, F3=S-BUS,
F4=PCD modem.
2) The "Verify during download" switch position is now saved in
the PCDMENU.DAT file.

09-Jun-93 V1.7
1) "Data segment" now called "Extension Memory".
2) Switches /X /NX (eXtension, No eXtension).
3) SDNLD now configures S-BUS, using the new /S and /NS
switches.
4) SLOAD menu has three new commands:
CONFIGURE S-BUS
COMPARE FILE AND CPU CONTENTS
DOWNLOAD EXTENSION MEMORY
5) Function key F5 displays the pop-up directory window.
6) Now supports S-BUS and modem communications.
7) The number of SUPLD.EXE and SDNLD.EXE return values has
been reduced (3.4 and 4.4).
8) New loader menu errors 20 to 26 (2.3).
9) New SUPLD.EXE and SDNLD.EXE errors, and all errors have
been renumbered.
28-May-92
1) Shows new data segment if present.
2) Modified loader menu: separate verify Yes/No switch; new
"DOWNLOAD DATA SEGMENT ONLY" operation; segment sizes
increased to 4 digits, and 7 digits for used/free sizes.
3) SUPLD and SDNLD now upload/download the new data segment.
4) SDNLD has new /D (Data) /ND (NoData) switches.
5) SUPLD and SDNLD now show the percent complete when the
upload or download is in progress.
6) New error messages for data segment.
7) SDNLD now automatically verifies the first 4 bytes of every
1K bytes downloaded, to ensure that memory is not write
protected and the memory chips are present.
8) SDNLD now displays "Stopping all CPUs" when it sends the
initial "restart cold all CPUs" telegram.

05-May-92 V1.6
1) Add SDNLD error:
Error 21: Wrong CPU type selected in configuration.

06-Dec-91 $154
1) New /R (Run), /RA (RunAll) and /NR (NoRun) switches for
SDNLD.
2) SLOAD menu now has F1=hyperhelp.
3) Add SLOAD errors 16 to 19.

08-Oct-91 $153
1) Now supports 1MB R600 memory, for up to 256K code lines or
999K text characters.
2) SDNLD now doesn't verify file's checksum before download,
it does this DURING the download (saves time, especially
if the file is 1MB!).

12-Sep-91 $152
1) SDNLD now downloads S-BUS header if /M option given.
2) "Improper installation" error changed to "PCDSETUP.DAT
not found or invalid".

12-Nov-90 V1.4

22-Nov-89 V1.3
1) More than one '.' allowed in a file name during entry (SWMR 7).
2) Different memory map for PCD4/PCD6. PCD4 has max 2 CPUs,
PCD6 has max 7 (SWMR 16).
3) Verifies enough to detect missing memory chip or write
protected memory (verifies every mod 256 bytes). (SWMR 23).
4) Rellocate memory clears security code in mail box (SWMR 27).
5) Now called "PCD LOADER" not "PCD6 LOADER" (SWMR 37).
6) Now works in colour as defined in PCDCOLOR.DAT.
7) New signon texts for SUPLD and SDNLD. These both now show
the line number being uploaded/downloaded.
8) SUPLD & SDNLD now give help if invoked with an incorrect
command line from DOS.
9) Memory map display now shows "Free Memory".
10) Now supports COM1, COM2, COM3 and COM4.
11) Added "Error 17: No program name in PCD" for SUPLD.
01-Dec-88 V1.2
1) Added loader menu ERROR 14 (2.3).
2) Install data file now called PCDSETUP.DAT

30-May-88 V1.1
1) File name entry field extended to 42 characters, to
allow a drive and/or path specification (2.2).
2) Add Error 16: CPU not programmed. Return value 3 is
returned to DOS. If an upload was attempted from a
CPU with no code, and empty UPL file was produced.
If an upload was done from unprogrammed EPROM, the
code length was read as FFFFFFFFH, and it attempted
to upload 4294967295 program lines! (3.3, 3.4).
3) Text segment size can be up to 256K, which requires
3 digits on the memory map display (2.2).

25-Jan-88 V1.0
1) Now does P8-PCD interface test before and after up/down
load. Added error 13 (2.3), error 15 (3.3), error 19
(4.3).
2) Improve entry field texts on loader menu (2.2).
3) Missing or invalid INSTALL.DAT file is a fatal "Improper
installation" error (2.3, 4.3).

14-Oct-86 Initial edit.


LOADER - Page 1

CONTENTS
========
PAGE

1. INTRODUCTION . . . . . . . . . . . . . . . . . . 2

2. SLOAD - LOADER MENU . . . . . . . . . . . . . . . 2

2.1 Invoking the Loader Menu . . . . . . . . . . . . 2

2.2 The Loader Menu . . . . . . . . . . . . . . . . . 3


2.2.1 Entry fields and function keys . . . . . . . . 4
2.2.2 Download from file to CPU . . . . . . . . . . 8
2.2.3 Upload from CPU to file . . . . . . . . . . . 9
2.2.4 Allocate memory . . . . . . . . . . . . . . . 10
2.2.5 Configure S-BUS . . . . . . . . . . . . . . . 11
2.2.6 Compare file and CPU contents . . . . . . . . 12
2.2.7 Download extension memory . . . . . . . . . . 13
2.2.8 Upload PCD setup . . . . . . . . . . . . . . . 14
2.2.9 Download PCD setup . . . . . . . . . . . . . . 14

2.3 Loader Menu Error Messages . . . . . . . . . . . 15

2.4 Changing PCD RAM Backup Batteries . . . . . . . . 19

3. SUPLD - UPLOADER . . . . . . . . . . . . . . . . 20

3.1 Uploader Invocation . . . . . . . . . . . . . . . 20


3.2 Uploader Operation . . . . . . . . . . . . . . . 21
3.3 Uploader Error Handling . . . . . . . . . . . . . 22
3.4 Uploader Return Values . . . . . . . . . . . . . 25

4. SDNLD - DOWNLOADER . . . . . . . . . . . . . . . 26

4.1 Downloader Invocation . . . . . . . . . . . . . . 26


4.2 Downloader Operation . . . . . . . . . . . . . . 27
4.3 Downloader Warnings . . . . . . . . . . . . . . . 29
4.4 Downloader Error Handling . . . . . . . . . . . . 30
4.5 Downloader Return Values . . . . . . . . . . . . 35
LOADER - Page 2

1. INTRODUCTION
================

This document describes the operation and use of the uploader


SUPLD.EXE, the downloader SDNLD.EXE, and their menu program
SLOAD.EXE.

SLOAD provides a user-friendly menu for the DOS command-line based


up and download programs (SUPLD.EXE and SDNLD.EXE). It reads and
displays the memory map, and checks for common errors before
executing SUPLD or SDNLD.

The downloader SDNLD can download code, text and/or extension memory
data to any CPU in the connected PCD. It can also write the memory,
S-BUS, modem and gateway configurations into the PCD. Configuration
data is defined by using the offline configurator SCONFIG, which can
be accessed from the main menu's "Configure" command, or by using
the function keys: F2=PCD type+memory, F3=S-BUS, F4=PCD modem, F6=
Gateway.

The uploader SUPLD can upload the code, text or extension memory
from any CPU in the connected PCD, and can also upload the PCD
configuration into file PCDSETUP.DAT.

*** NOTE ***

The data displayed by the offline configurator is data from the


PCDSETUP.DAT file, NOT from the PCD itself, the data is NOT ALWAYS
THE SAME as the data in the PCD unless an UPLOAD PCD SETUP command
is done first to copy the configuration data to the PCDSETUP.DAT
file.

2. SLOAD - LOADER MENU


=======================

This program (SLOAD.EXE) provides a user-friendly menu for the DOS


command-line based up and download programs (SUPLD.EXE and SDNLD.EXE).
It reads and displays the memory map, and checks for common errors
before executing SUPLD or SDNLD.

2.1 Invoking the Loader Menu


-----------------------------

The loader menu can itself be called from the main PCD menu with the
"Up/download" option, or can be invoked directly from DOS with the
following command:

SLOAD <CR>

No command line parameters are required.


LOADER - Page 3

2.2 The Loader Menu


--------------------

If connected to a powered up CPU, the following screen is displayed,


which shows the memory map and status of each CPU. The number of CPUs
shown depends on the connected PCD type: the PCD6 shows seven CPUs
(0-6), the PCD4 shows two CPUs (0-1), and the PCD1, PCD2 or PCD6.M5
show one CPU.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD LOADER V2.1 CPU: 0 Type: D6M2D$6m Memory: RAM │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│╓───┬──────────┬──────────────────────┬──────────────────────┬─────────────────┐│
│║ │ PROGRAM │ CODE SIZE (Lines) │ TEXT SIZE (Bytes) │ ││
│║ C │ NAME │ SEG USED FREE │ SEG USED FREE │ CPU STATUS ││
│╟───┼──────────┼──────────────────────┼──────────────────────┼─────────────────┤│
│║ 0 │ BATMAN-2 │ 56K 5743 51501 │ 32K 0 32768 │ STOP ││
│║ 1 │ │ 0K 0 0 │ 0K 0 0 │ DISCONNECTED ││
│║ 2 │ │ 0K 0 0 │ 0K 0 0 │ DISCONNECTED ││
│║ 3 │ │ 0K 0 0 │ 0K 0 0 │ DISCONNECTED ││
│║ 4 │ │ 0K 0 0 │ 0K 0 0 │ DISCONNECTED ││
│║ 5 │ │ 0K 0 0 │ 0K 0 0 │ DISCONNECTED ││
│║ 6 │ │ 0K 0 0 │ 0K 0 0 │ DISCONNECTED ││
│╚═══╧══════════╧══════════════════════╧══════════════════════╧═════════════════╛│
│ │
│ Operation, SPACE selects DOWNLOAD FROM FILE TO CPU │
│ File name TEST.UPL__________________________________ │
│ CPU number 0 │
│ Verify memory writes No │
│ Clear all outputs Yes │
│ Run all CPUs on completion No │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ SPACE selects operation, ARROW moves cursor, ENTER executes, ESC exits. │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Text memory contains Texts or Data Blocks 0..3999, which can be in


either EPROM or RAM. Extension memory, if present, contains additional
Texts or Data Blocks 4000..7999, which are always in RAM. If extension
memory is present, the memory map box shows the extension memory
allocation. Due to the extra space needed, the CPU STATUS column is
reduced to a single character: R=Run, S=Stop, H=Halt, C=Conditional
run, D=Disconnected.
LOADER - Page 4

Memory map with extension memory:


┌─┬────────┬─────────────────────┬─────────────────────┬─────────────────────┬─┐
│ │PROGRAM │ CODE SIZE (Lines) │ TEXT SIZE (Bytes) │ EXTN SIZE (Bytes) │ │
│C│ NAME │ SEG USED FREE│ SEG USED FREE│ SEG USED FREE│S│
├─┼────────┼─────────────────────┼─────────────────────┼─────────────────────┼─┤
│0│BATMAN-1│ 56K 25 57219│ 32K 84 32684│ 768K 0 786432│R│
│1│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│D│
│2│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│D│
│3│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│D│
│4│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│D│
│5│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│D│
│6│ │ 0K 0 0│ 0K 0 0│ 0K 0 0│D│
╘═╧════════╧═════════════════════╧═════════════════════╧═════════════════════╧═╛

If a new memory card has been installed, or the PCD's memory has
been corrupted, then the message "HEADER NOT INITIALIZED" may be shown
for one or more CPUs. Memory must be reallocated before continuing.
RAM memory can be corrupted if the backup battery fails.

If not connected, or the CPU is powered off, the title line (which
normally shows the connected S-BUS station, CPU number, type and memory
type) is left blank, the memory map box remains empty, an error message
is displayed and the user is prompted to press any key to abort. The
same thing happens if the PCDSETUP.DAT configuration data file cannot
be read. No loader operations can be done if not connected to a CPU.

Initially, the "Operation" field is selected, the selected field being


highlighted in reverse video, other fields are displayed in bold video.
The cursor is moved from one field to another using the ARROW or TAB
keys.

Pressing ESCape at any time (except when an operation is in progress)


exits the loader menu. Pressing ENTER executes the selected operation.

If any invalid key is pressed, the beeper is sounded.

2.2.1 Entry fields and function keys


-------------------------------------

Operation:

The "Operation" field is a six-way switch which selects what will


be done when ENTER (CR) is pressed. The operation is selected by
pressing SPACE when the cursor is on this field. These operations
are described in the following sections:

DOWNLOAD FROM FILE TO CPU


UPLOAD FROM CPU TO FILE
ALLOCATE MEMORY
CONFIGURE S-BUS
COMPARE FILE AND CPU CONTENTS
DOWNLOAD EXTENSION MEMORY
UPLOAD PCD SETUP
DOWNLOAD PCD SETUP
LOADER - Page 5

File name:

This is the name of the .PCD or .UPL file for a DOWNLOAD, UPLOAD or
COMPARE operation. When the cursor is in this field, press function
key F5 will show the directory window, which allows a file name to
be chosen. '<' or '>' characters are shown if the file name is too
long for the field, to indicate the field can be scrolled.

CPU number:

This is the number of the destination CPU for a DOWNLOAD operation,


or the source CPU for an UPLOAD or COMPARE.

Verify memory writes:

If this is "Yes", then all the data is read back and compared. This
makes the download take twice as long. Note that even if verify is
"No", the first 4 bytes of every 1K bytes downloaded are still
verified to ensure that the memory chips are not write protected,
missing or faulty. S-BUS and memory allocation are ALWAYS verified.

Clear all outputs:

If this is "Yes", then all PCD Outputs are cleared at the start of
a DOWNLOAD or CONFIGURE S-BUS operation. If "No", then the Outputs
are not cleared, and retain their current states. If the PCD firmware
does not support this feature, a warning message is displayed, and
the action will depend upon the PCD's "Reset Outputs" jumper (if the
PCD has one): If the jumper is in, then outputs are cleared at the
start of a download; if it's out, they are only cleared when the
download is complete.

NOTE: All PCD Outputs are ALWAYS cleared by the ALLOCATE MEMORY
operation.

Run all CPUs on completion:

If "Yes", then all CPUs containing programs are put into Run after
a successful DOWNLOAD or CONFIGURE S-BUS operation. If "No", all
CPUs will remain in Stop. CPUs which don't contain programs will
always remain in Halt, regardless off the setting of this switch.

Use this switch to minimize the amount of time that outputs are
cleared or are not under PCD control.

*** WARNING ***

Only set this switch to "Yes" if the downloaded program(s) have been
tested and you know they will run correctly without damaging any
controlled hardware.
LOADER - Page 6

The prompt line changes according to which entry field the cursor is
on.

On "Operation" field:
├────────────────────────────────────────────────────────────────────────────────┤
│ SPACE selects operation, ARROW moves cursor, ENTER executes, ESC exits. │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

On "File name" field:


├────────────────────────────────────────────────────────────────────────────────┤
│ Enter file name (F5=dir), ARROW moves cursor, ENTER executes, ESC exits. │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

On "CPU number" field:


├────────────────────────────────────────────────────────────────────────────────┤
│ Enter CPU number, ARROW moves cursor, ENTER executes, ESC exits. │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

On Yes/No switch fields:


├────────────────────────────────────────────────────────────────────────────────┤
│ SPACE selects (Yes/No), ARROW moves cursor, ENTER executes, ESC exits. │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

When ENTER is pressed to begin a loader operation, a few operation-


specific checks are made, and the user may be prompted with a
"Continue (Y or N) ?" message. If 'Y' is pressed, the screen is
cleared (except for the title and prompt lines), the cursor is placed
on line 2, and the up or download program (SUPLD.EXE or SDNLD.EXE) is
invoked (depending on the operation), supplying the entered file name,
CPU number and switches. The "WAIT..." message is displayed on the
prompt line. The operation then continues under the control of the
SUPLD or SDNLD program, see sections 3 and 4.

Once the operation is completed, control is returned to the loader


menu, which displays the following prompt:
├────────────────────────────────────────────────────────────────────────────────┤
│ OPERATION ENDED: Press any key to continue _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The remainder of the screen is unchanged, displaying the messages


output by the up or downloader programs. These indicate success or
failure of the operation. When any key is pressed, the loader menu
is re-displayed, showing the new memory map, which is updated if an
download or reallocate memory operation has been done. The entry
fields are unchanged. At this point, another loader operation can
be done or ESC can be pressed to exit.
LOADER - Page 7

Function keys
-------------

Function keys F2, F3, F4 and F6 allow direct access to the "Configure"
program's menus. This allows the PCD configuration to be entered OFF
LINE, before writing it into the PCD with the CONFIGURE S-BUS,
ALLOCATE MEMORY, or DOWNLOAD PCD SETUP commands.

The data shown on these menus is read from the PCDSETUP.DAT file, it
is NOT necessarily the same as the data in the connected PCD. The
UPLOAD PCD SETUP command can be used to read the current data from
the connected PCD.

F2=PCD type+memory Written to the PCD by the ALLOCATE MEMORY command.


F3=S-SBUS Written to the PCD by the CONFIGURE S-BUS command.
F3=PCD modem ''
F6=Gateway ''

The DOWNLOAD PCD SETUP command writes ALL the above data to the PCD
in one go, but this deletes ALL code, text and extension memory in
the PCD. To configure only S-BUS, the PCD modem and the gateway,
without deleting memory, use the CONFIGURE S-BUS command.
LOADER - Page 8

2.2.2 Download from file to CPU


--------------------------------

Invokes the SDNLD program. It reads a PCD absolute object file (type
.PCD or .UPL) and writes it into the PCD's memory. The code, text and
extension memory segments (if present) are downloaded.

The memory allocation, as displayed in the loader's menu, must have


enough space for the code, text and extension memory in the PCD file.
If not, reconfigure the memory from the "Configure/Hardware and
memory" menu (or press function key F2), and do an ALLOCATE MEMORY
operation before downloading the file.

If "Verify memory writes" is "Yes", then every byte written into the
PCD's memory is read back and compared. This makes the download take
twice as long. If verify is not selected, a verify is still done for
the first 4 bytes of every 1K bytes downloaded, to ensure that the
memory chips are not write protected, missing or faulty.

The "Clear all outputs" switch defines whether outputs are cleared
during the download or retain their original states. If the switch
is "Yes", then all outputs are cleared at the start of the download.
If "No", the action depends upon the PCD firmware version or the
position of the PCD's "Reset outputs" jumper (if present): For new
PCD firmware which has the "Don't clear outputs" feature, outputs
are not cleared. For old firmware, outputs are always cleared, but
when they are cleared is defined by the position of the PCD's "Reset
Outputs" jumper (if present) - if set to "Reset", then all outputs
are cleared at the START of the download, otherwise all outputs are
cleared at the END of the download.

The "Run all CPUs" switch puts all CPUs back into Run mode as soon
as the program has been successfully downloaded if it is "Yes". If
"No" then all CPUs remain in Stop.

The download can be aborted by pressing ESCape. If aborted, the CPU's


memory remains empty.

Before the download commences, this prompt is displayed:


├────────────────────────────────────────────────────────────────────────────────┤
│ DOWNLOAD: Resets all CPUs!! Continue (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' continues, 'N' or ESCape aborts.

If the "Clear all outputs" switch is "No", and the connected PCD's
firmware does not support this feature, then this prompt is
displayed:
├────────────────────────────────────────────────────────────────────────────────┤
│ WARNING: Old PCD firmware, outputs will be cleared!! Continue (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' continues, 'N' or ESCape aborts.


LOADER - Page 9

2.2.3 Upload from CPU to file


------------------------------

Invokes SUPLD program. It reads the PCD's code, text and extension
memory segments (if present), and writes them to an absolute object
file (.UPL).

An upload can be done regardless of the CPU's status (Run, Stop etc.),
but uploading while the CPU is in Run may slightly affect he connected
CPU's program execution time.

If the code or text has been modified since it was downloaded (the
checksum is invalid), the uploader displays "Warning 1: Code or text
has been modified".

The upload can be aborted by pressing ESCape. If aborted, the uploaded


file is deleted.

If the destination file exists, this prompt is displayed:


├────────────────────────────────────────────────────────────────────────────────┤
│ DESTINATION FILE EXISTS: Overwrite it (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' starts the upload and the file is overwritten, 'N' or
ESCape aborts.
LOADER - Page 10

2.2.4 Allocate memory


----------------------

Invokes the SDNLD program with the /M (Map) switch. This dynamically
partitions the PCD's memory into code, text and extension memory
segments for each CPU. The partitioning must first be defined on the
"Configure/Hardware and memory" menu (press function key F2).

Memory must be partitioned according to the program's requirements.


The minimum required code, text and extension memory segment sizes
of a program are displayed by the linker, and written to the .MAP
file, when the program is linked.

Before memory is allocated, this prompt is displayed:


├────────────────────────────────────────────────────────────────────────────────┤
│ ALLOCATE MEMORY: Clears ALL memory, resets all CPUs!! Continue (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' continues and does the memory allocation, 'N' or ESCape
aborts.

*** WARNING ***

This command deletes ALL the code, text and extension memory for
all the CPUs in the PCD. All CPUs are reset and will stay in Halt,
all Outputs are cleared.
LOADER - Page 11

2.2.5 Configure S-BUS


----------------------

Invokes the SDNLD program with the /S switch. This configures the
PCD's S-BUS station number, PGU port, S-BUS timing, master gateway
port and the PCD's modem if the PGU port uses a dial-up modem.

S-BUS data is defined via the "Configure/s-Bus communications" menu


(or press function key F3). Gateway settings are entered on the
"Configure/Gateway master port" menu (or press F6), the PCD's modem
is selected from the "Configure/Modem for SAIA PCD" menu (or press
F4).

The S-BUS configuration *can* be done via an S-BUS connection. If


the station number, baud rate or mode (break/parity) is changed,
SLOAD automatically switches to the new settings and will remain
connected to the PCD. However, if the S-BUS PGU port number or
modem setting is changed, the PCD will go OFF LINE. A warning is
is issued if this is going to happen.

Before S-BUS is configured, this prompt is displayed:


├────────────────────────────────────────────────────────────────────────────────┤
│ CONFIGURE S-BUS: Resets all CPUs!! Continue (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' continues, 'N' or ESCape aborts.

If configuring S-BUS via an S-BUS connection, changing the PCD's PGU


port number or public line modem setting will cause the PCD to go
off line when S-BUS is configured. If this will happen, this prompt
is displayed:
├────────────────────────────────────────────────────────────────────────────────┤
│ WARNING: This will cause the PCD to go off line!! Continue (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' continues, 'N' or ESCape aborts. If S-BUS is configured,


the S-BUS connection to the PCD will be broken, and SDNLD and SLOAD
will issue "no response from PCD" errors.

*** WARNING ***

All CPUs are reset, and will go into Stop unless the "Run all CPUs"
switch is "Yes". All Outputs are cleared unless the "Clear all
outputs" switch is "No". The S-BUS station number alone can be
changed using the Debug program's "Write s-bUs station" command,
which does NOT reset the PCD or affect the outputs.
LOADER - Page 12

2.2.6 Compare file and CPU contents


------------------------------------

This command compares the contents of a file with the contents of a


CPU's memory. This checks that the code and text in a CPU are the
same as the code and text in a file, and checks that the extension
memory segments are the same size. The actual contents of the
extension memory segments, and the name of the program in memory are
NOT compared.

The compare is very fast because it does not actually compare each
byte, but only compares the segment sizes and their checksums.

If the CPU's memory and the PCD file match, this text is displayed
on line 24:

COMPARE OK: FILE <filename> and CPU n CONTENTS ARE THE SAME

If they don't match, this text is displayed:

COMPARE FAILED: FILE <filename> AND CPU n CONTENTS ARE DIFFERENT

*** NOTE ***

If the program in the PCD's memory has been edited on-line using
a programming unit (SBUG or PG1), then the checksum of the program
has been invalidated, and "File Compare" will always fail, even if
compared with an uploaded (saved) copy of the new program.
LOADER - Page 13

2.2.7 Download extension memory


--------------------------------

Invokes the SDNLD program to download only the extension memory


segment.

This operation is available only if the PCD has extension memory,


and the memory has been correctly allocated. The extension memory
segment should be shown in the loader menu's memory map window.
If the code and text segments have been programmed into EPROMs on
this card, then extension memory must be downloaded separately into
RAM before running the program.

If "Verify memory writes" is "Yes", then every byte written is read


back and compared. This makes the download take twice as long. If
verify is not selected, a verify is still done for the first 4 bytes
of every 1K bytes downloaded, to ensure that the memory chips are
not write protected, missing or faulty.

This prompt is displayed before starting the download:


├────────────────────────────────────────────────────────────────────────────────┤
│ DOWNLOAD EXTENSION MEMORY: Resets all CPUs!! Continue (Y or N) ? _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Pressing 'Y' starts the download, 'N' or ESCape aborts.

*** WARNING ***

All CPUs are reset, and will stay in Stop unless the "Run all CPUs"
switch is "Yes". All Outputs are cleared unless the "Clear all
outputs" switch is "No".
LOADER - Page 14

2.2.8 Upload PCD setup


-----------------------

Invokes the SUPLD program with the /SETUP switch.

This command reads the memory allocation, S-BUS setup, gateway and
modem configuration from the connected PCD and saves it in the
PCDSETUP.DAT file in the current directory. The existing config-
uration in PCDSETUP.DAT is overwritten.

After uploading the setup, it can be viewed and edited using the
F2=PCD type+memory, F3=S-BUS, F4=PCD modem and F6=Gateway keys.
The "Configure" program (SCONFIG.EXE) can also be used, select the
"SAIA PCD CONFIGURATION" menus.

The setup can be written back to the PCD using the DOWNLOAD PCD SETUP
command.

Upload and download PCD setup commands are useful when changing the
PCD's RAM backup batteries.

2.2.9 Download PCD setup


-------------------------

Invokes the SDNLD program with the /M and /S switches.

This command writes the memory configuration, S-BUS setup, gateway


and modem configuration from the PCDSETUP.DAT file in the current
directory into the connected PCD. It is the equivalent of the
ALLOCATE MEMORY and CONFIGURE S-BUS commands, but both are done at
the same time.

This command can be used to download the data saved by the UPLOAD
PCD SETUP command.

Upload and download PCD setup commands are particularly useful when
changing the PCD's RAM backup batteries.

*** WARNING ***

This command deletes ALL the code, text and extension memory for
all the CPUs in the PCD. All CPUs are reset and will stay in Halt,
all Outputs are cleared.
LOADER - Page 15

2.3 Loader Menu Error Messages


-------------------------------

When ENTER is pressed to execute the selected operation, the input


data is checked. Any error causes an error message to be displayed on
line 23 in bold video, and the beeper is sounded. The cursor is placed
over the field containing the error.

Errors 1, 2, 3, 4, 5, 12 and 13 are fatal errors, which will normally


occur when the menu is invoked. If one of these occurs, the following
prompt is displayed, pressing any key causes and exit to DOS or a
return to the main PCD Programming Utilities menu (the help key F1,
and configuration keys F2..F6 still work):
├────────────────────────────────────────────────────────────────────────────────┤
│ CAN'T CONTINUE: Press any key to exit _ │
│ Configuration: F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Error messages are:

ERROR 1: SERIAL PORT COMn NOT PRESENT OR FAULTY

The serial port (COM1 to COM4), selected from the "Configure/


Serial ports" menu cannot be used.

ERROR 2: COMMAND NOT ACCEPTED BY PCD (NAK RESPONSE)

Usually caused by old firmware in the PCD.

ERROR 3: NO RESPONSE FROM PCD

Check the PCD is powered on, connected to the correct serial


port and the baud rate is correct. Try to connect to the PCD
using PGU mode from the "coNnect" screen on the main menu.
If using S-BUS protocol, the PCD's S-BUS configuration may
be wrong. The error also occurs after configuring S-BUS if
the PGU port number, RS232/485 type or modem setting is
changed.

ERROR 4: INVALID RESPONSE FROM PCD

Usually caused by an incorrect baud rate or protocol.

ERROR 5: PCD NOT CONNECTED TO COMn OR POWERED OFF

The PCD is not correctly connected to the indicated serial


port, or is not switched on.

ERROR 6: CAN'T OPEN FILE: <filename>

The file to be downloaded does not exist, or the drive is not


ready.
LOADER - Page 16

Loader menu error messages continued:

ERROR 7: CAN'T WRITE TO EPROM MEMORY

The PCD contains read-only memory. The DOWNLOAD FROM FILE TO


CPU, ALLOCATE MEMORY and CONFIGURE S-BUS operations cannot be
done.

ERROR 8: CPU n HEADER NOT INITIALIZED

An upload or download operation cannot be done unless the


CPU's header has been correctly initialised. The header
provides the information displayed in the memory map box on
the menu. The header is initialised by the ALLOCATE MEMORY
operation.

ERROR 9: PROGRAM LOAD FAILURE ON: <program name>

The given program can't be found, or there's not enough


memory to load it. The program should be present in the same
directory as the menu program SLOAD.EXE, or the DOS "PATH"
setting should indicate where it can be found. Try running
SLOAD from the DOS prompt, or invoke PCD.EXE with the /X
switch so it uses expanded or extended memory.

ERROR 10: NO FILENAME SPECIFIED

If an upload, download or compare operation is selected, a


file name is required.

ERROR 11: INVALID CPU NUMBER

Valid CPU numbers are 0-6 for a PCD6, 0-1 for a PCD4, or 0
for the PCD1, PCD2 and PCD6.M5.

ERROR 13: PCDSETUP.DAT NOT FOUND OR INVALID

The configuration data file PCDSETUP.DAT cannot be found or


is an old version. The up/downloader can't be run without it.

ERROR 14: P8-CPU INTERFACE FAILURE

The connection between the P800 and the PCD6 CPU is bad.
Power off the PCD6, remove, clean and re-connect the P800.

ERROR 15: INVALID FILE NAME: <filename>

The file name is not a valid file name, or is a device name


(COM1, PRN etc).

ERROR 16: READ ERROR ON FILE: <filename>

An irrecoverable data error occurred while reading the file.


LOADER - Page 17

Loader menu error messages continued:

ERROR 17: WRONG HELP FILE VERSION: SLOAD.HLP


ERROR 18: INVALID HELP FILE FORMAT: SLOAD.HLP

The help file is an old version, or is corrupted. Copy the


latest help file SLOAD.HLP from the distribution diskettes
into the PCD Programming Utilities directory.

ERROR 19: OUT OF MEMORY

There is not enough memory to execute the operation. Try


running PCD.EXE with the /X switch so that extended or
expanded memory can be used. Or run SLOAD from the DOS
prompt.

ERROR 20: NO RESPONSE FROM S-BUS STATION n

Is the station powered on and connected, and is the station


number correct? Is the S-BUS configuration OK? See ERROR 3.

ERROR 21: COMMUNICATIONS ERROR (PARITY, FRAMING OR OVERRUN)

Usually caused by an incorrect baud rate or comms protocol.

ERROR 22: PROGRAM NOT LICENSED

The configuration file does not support this program. Ensure


the correct PCDSETUP.DAT file from the distribution diskette
is used.

ERROR 23: INVALID ABSOLUTE OBJECT FILE: <filename>

The file is not a valid .PCD or .UPL format file.

ERROR 24: CPU n NOT PROGRAMMED

The CPU's memory is empty, and the file cannot be compared.

ERROR 25: GATEWAY NOT SUPPORTED BY PCD1

The PCD1 cannot have a gateway. Correct the PCD type from
the "Hardware and memory" menu.

ERROR 26: CPU HAS NO EXTENSION MEMORY

The DOWNLOAD EXTENSION MEMORY operation cannot be done if


that CPU does not have any extension memory configured.

ERROR 27: WRONG PCD TYPE SELECTED IN HARDWARE CONFIGURATION

The connected PCD type does not match the PCD type selected
in the "Configure/Hardware and memory" menu. Press function
key F2 and correct it. Make sure the memory map is also
correct.
LOADER - Page 18

ERROR 28: MEMORY MAP CORRUPTED OR INVALID

The memory allocation in the connected PCD is incorrect.


Re-allocate memory with the ALLOCATE MEMORY or DOWNLOAD
PCD SETUP command. Press F2 to view and define the memory
allocation.

FATAL INTERNAL ERROR: <reference>

SLOAD detected a software error. Report the <reference> and


exact circumstances to SAIA Technical Support immediately.
LOADER - Page 19

2.4 Changing PCD RAM Backup Batteries


--------------------------------------

PCDs have one or two RAM memory backup batteries, which need to be
replaced every few years (see the "Battery Change" labels).

There is a battery on the main CPU board, which backs up the memory
containing the Registers, Flags, Timers and Counters data. On the
PCD1 and PCD2 this battery also backs up the memory allocation,
S-BUS, gateway and modem configuration, and the user program, texts
and extension memory, if RAM is being used.

On the PCD4, the PCD6.M5 and PCD6, memory allocation, S-BUS, gateway
and modem configuration, and the user program, texts and extension
memory are backed up by the battery on the public memory module, if
RAM is being used. Texts and Data Blocks 4000..7999 in extension
memory are also backed up by this battery.

To replace the batteries without losing any data, use this procedure:

1) If user program memory or extension memory is RAM, and you are


changing the battery on a PCD1, PCD2 or the public memory module
on a PCD4 or PCD6:
Upload the programs in each CPU with the UPLOAD FROM CPU TO FILE
command. If you already have the programs on your hard disk, you
can skip this step. Note that this also saves extension memory
(Texts/DBs 4000..7999) which is always in battery-backed RAM.

2) Use the UPLOAD PCD SETUP command to upload the memory allocation,
S-BUS, gateway and modem configuration into the PCDSETUP.DAT file.
This can be skipped if the user program is in EPROM memory.

3) If changing the battery on the CPU card, you may want to save the
current values of Registers, Counters, Timers and/or Flags. If
the PCD has RAM extension memory containing Texts and Data Blocks
4000..7999, these may also need to be saved. Use the "Transfer
data" program (SDAT.EXE), upload the data you want to save into a
file.

4) SWITCH OFF THE PCD, then replace the batteries. Ensure the +ve and
-ve polarity is correct!

Now re-load the data back into the PCD's memory:

5) If the setup was saved in step 2, use the DOWNLOAD PCD SETUP
command to write it back into the PCD.

6) Download the programs and/or extension memory back into each CPU
using the DOWNLOAD FROM FILE TO CPU or DOWNLOAD EXTENSION MEMORY
commands.

7) If Register, Counter, Timer, Flag, Text or DB data was saved in


step 3, use the "Transfer data" program to write it back to the
PCD.

8) The real time clock in the PCD (if fitted) may also need to be
reset using SBUG's "Write clocK" command.
LOADER - Page 20

3. SUPLD - UPLOADER
====================

The uploader SUPLD.EXE reads the code, text and extension memory
(if present) from any CPU and stores it in an absolute object file
(.UPL) with the same format as a ".PCD" file. The uploaded file can
be downloaded using SDNLD or disassembled using SDISASM. An upload
can be done regardless of the CPU's status (Run, Stop etc.), but
uploading while the CPU is in Run may slightly affect the CPU's
program execution time.

3.1 Uploader Invocation


------------------------

SUPLD is invoked from DOS with the following command line:

SUPLD [cpu_number] [filename] [/NX]

Where: cpu_number Optional source CPU number. If not given, the


program in the connected CPU is uploaded.

filename Optional name of destination file. A drive,


path and file type can be given. The default
file type is ".UPL". If "filename" is not
given, the name of the file is the name of the
program in the CPU's memory, with file type
".UPL".

/NX Optional "No eXtension" switch, don't upload


extension memory.

/SETUP Upload PCDSETUP.DAT only, other parameters are


ignored.",

Each command line parameter must be separated by one or more spaces.

Uploader invocation examples:

SUPLD 0 A:FRED.PCD Uploads everything from CPU 0 to file


A:FRED.PCD.

SUPLD FRED Uploads everything from the connected CPU


to file FRED.UPL in the current directory.

SUPLD Uploads everything from the connected CPU


to file "program_name.UPL" in the current
directory. Where "program_name" is the
name in the header of the connected CPU.

SUPLD 1 TEST /NX Uploads the code and text only from CPU 1
and stores it in file TEST.UPL. Extension
memory is not uploaded.
LOADER - Page 21

3.2 Uploader Operation


-----------------------

Once the uploader is invoked, the signon message is displayed and


the user is notified of the function being performed. The program's
code, text and extension memory sizes are displayed. During the
upload, the line or byte number being read is displayed, and the
percentage complete is shown. When the upload is done, the "Complete"
message is displayed.

Example:

C:\>SUPLD 0 A:FRED.PCD

SAIA PCD UPLOADER V2.1


Uploading from: CPU 0
To file: A:FRED.PCD

Code size: 3654 lines (14616 bytes)


Text/DB size: 473 bytes
Exten mem size: 0 bytes

Uploading code
Uploading texts/DBs

Upload complete

*** NOTES ***

If the destination file already exists, it will be overwritten by


the new file WITHOUT any indication to the user.

If no CPU number is specified, then the destination file name must


NOT be all digits, otherwise the command line interpretor will
interpret it as a CPU number.

Aborting the upload


-------------------

The upload operation may be aborted using ESCape. If aborted, the


uploaded file is deleted.
LOADER - Page 22

3.3 Uploader Error Handling


----------------------------

When an error occurs, the upload procedure is stopped, an error


message is displayed and the program returns to DOS or the parent
process (SLOAD menu), with a non-zero return status.

If SUPLD is invoked from DOS, disk read and write errors will be
preceded by a standard DOS disk error prompt, for example:

Not ready error reading drive C


Abort, Retry, Ignore ? _

Pressing 'A' causes a return to DOS or the parent process (menu),


closing the output file, perhaps leaving the partly written output
file on the disk. Pressing 'R' will retry the disk operation,
allowing recovery. Pressing 'I' causes a return to the SUPLD program,
which will display it's error message, close and delete the output
file and exit to DOS or the menu.

If SUPLD is invoked from the menu, no DOS disk error handling is


done. In this case, the upload program's error message is displayed
directly and control is returned to the menu. If an error occurs
during the upload, the destination file will, if possible, be deleted
from the disk.

One warning message can occur:

Warning 0: Code or text has been modified

This occurs when the checksum of the CPU's code and text
does not match the checksum stored in the CPU's header.
This normally occurs only if the code or text has been
modified using the debugger or the hand-help programming
unit. It can also occur if the CPU's header or memory has
been corrupted (low RAM backup battery etc).

The following errors can occur:

Error 1: Incorrect number of parameters

The command line has too many parameters.

Error 2: Invalid filename: <filename>

The filename is an invalid DOS filename, or is a device


name (PRN, LPT1 etc).

Error 3: Invalid CPU number: <n>

The CPU number must be 0-6 for a PCD6, 0-1 for a PCD4 or
0 for a PCD1, PCD2 or PCD6.M5. If no CPU number is given,
then the file name must not be all digits, otherwise it is
interpreted as a CPU number.
LOADER - Page 23

Uploader error messages continued:

Error 4: Invalid switch: <switch>

Only the /NX switch is supported by SUPLD.

Error 5: PCDSETUP.DAT not found or invalid

The configuration data file PCDSETUP.DAT should be in the


PCD Programming Utilities or current directory, and must be
the correct version. Refer to the installation instructions.

Error 6: Program not licensed

The configuration file does not support this program. Ensure


the correct PCDSETUP.DAT file from the distribution diskette
is used.

Error 7: Can't connect to S-BUS station <n>

Is the station powered on and connected, and is the station


number correct? Has it been correctly configured for S-BUS?

Error 8: Can't open file: <filename>

The output file cannot be opened for writing. Either the


destination disk is not ready or write protected, its
directory is full, or the specified drive or directory
does not exist.

Error 9: Write error on file: <filename>

An error has occurred during the writing of the destination


file. Usually caused by a full or write-protected disk.

Error 10: CPU's header not initialized, can't upload

The requested CPU does not exit, has never been programmed,
or does not contain a program name (if default file name is
to be used).

Error 11: CPU not programmed

The upload operation can't be done because the CPU has no


code to upload.

Error 12: No program name for CPU <n> in PCD

The upload operation cannot be done because the PCD does


not contain a program name, and no program name was
supplied on the command line. SUPLD has no file name in
which to save the program.
LOADER - Page 24

Uploader error messages continued:

Error 13: Command not accepted by PCD (NAK response)

The PCD did not allow a command. This is usually caused by


uninitialized user memory. Restart the PCD by powering it
off and on, or with "Debug/rEstart Cold All-cpus", and try
again. May also be caused by old firmware.

Error 14: No response from PCD

Is the PCD powered on, correctly connected and is the baud


rate ok? See SLOAD's ERROR 3.

Error 15: Invalid response from PCD


Error 16: Communications error (parity, framing or overrun)

These are usually caused by an incorrect baud rate or


protocol.

Error 17: PCD not connected to COMn or powered off


Error 18: Serial port COMn not present

Is the COM port correct and is the PCD's PGU port connected
to it? The port number is defined on the "Configure/Serial
ports" menu.

Error 19: Bad connection between P800 and PCD6

Re-connect the PCD8.P800 and try again. NOTE: Do not connect


or disconnect it while on-line with "Debug" etc. Power off
the PCD6 first, or exit the Programming Utilities.

Error 20: Out of memory

There is not enough memory to run SUPLD. Try running


PCD.EXE with the /X switch so that extended or expanded
memory can be used, or run SUPLD from the DOS prompt.
Remove any memory resident programs.

Error 21: Internal error: <reference>

A fatal internal soft error has occurred. Notify SAIA


Technical Support immediately, supplying the <reference>,
and details of how to reproduce the error.

Error 22: Invalid memory allocation

The memory allocation in the PCD is invalid and the


upload cannot be done. The PCD must be re-configured.
LOADER - Page 25

3.4 Uploader Return Values


---------------------------

SUPLD returns the following status values to DOS or the parent


process. A non-zero value meana that the upload failed, and the
destination file is not present on the disk. SUPLD will have
displayed an error message before exiting. The return values can be
checked using ERRORLEVEL in a batch file.

0 Upload successful
1 Invalid command line parameter
2 Upload failed, communications or other error
3 Upload aborted with Ctrl+C or ESC
LOADER - Page 26

4. SDNLD - DOWNLOADER
======================

The downloader can download code, text and/or extension memory to


any CPU. It is also used to allocate memory by downloading the
memory map, and to configure the S-BUS PGU port. Configuration
information is taken from the "Configure/Hardware and memory",
"Configure/s-Bus communications", "Configure/Modem for SAIA PCD"
and "Configure/Gateway master port" menus.

4.1 Downloader Invocation


--------------------------

SDNLD is invoked from DOS with the following command line:

SDNLD filename[.ext] [cpu_number] [#switches#]

Where: filename Name of file to be downloaded.

.ext Optional file type, ".PCD" is the default.

cpu_number Optional CPU number (PCD6=0..6, PCD4=0..1).


The default is the connected CPU.

switches /M /NM Map, NoMap. Allocates memory.


/S /NS Sbus, NoSbus. Configures S-BUS
(default if /M).
/C /NC Code, NoCode. Downloads code segment.
/T /NT Text, NoText. Downloads text and DB
segment.
/X /NX Download eXtension memory, No
eXtension memory.
/V /NV Verify, No Verify.
/R /NR Run, No Run: If downloaded OK, puts
the CPU into Run mode. ALL OTHERS
REMAIN STOPPED.
/RA Run All: As /R, but puts *all* CPUs
into Run.
/NCO Don't clear outputs. Not allowed with
/M.

Default switches: /NM /NS /C /T /X /NV /NR

To allocate memory only, use "SDNLD /M".


To configure S-BUS only, use "SDNLD /S".

*** NOTES ***

Reallocating memory using the /M switch WILL DELETE ALL EXISTING


CODE AND TEXT IN ALL CPUs before downloading the file.

S-BUS can be configured via an S-BUS connection. SDNLD will try to


connect to the original PCD using the new settings. A "no response"
error will occur if the S-BUS connection is broken by the new
configuration.
LOADER - Page 27

Downloader invocation examples:

SDNLD FRED 0/V Downloads file FRED.PCD to CPU 0 with verify.


SDNLD FRED.UPL Downloads file FRED.UPL to the connected CPU,
without verifying every byte written.
SDNLD FRED 0 /m Reallocates memory, deleting all code, text and
data in *all* CPUs, then downloads the code, text
and data (if present) from file FRED.PCD to CPU 0
without verifying every byte.
SDNLD /M/V Reallocates memory and loads the S-BUS station
number. All code and text in *all* CPUs is deleted.
SDNLD FRED 3 /R Download FRED.PCD to CPU 3 and put CPU 3 only into
Run (ALL OTHER CPUs WILL REMAIN IN STOP).
SDNLD FRED 3 /RA Download FRED.PCD to CPU 3 and put *all* CPUs into
Run.
SDNLD FRED /X Downloads only the extension memory segment from
file FRED.
SDNLD /NM No operation.

4.2 Downloader Operation


-------------------------

Once the downloader is invoked, a signon message is displayed and


the user is notified of the function being performed. The file is
first verified to ensure it is a valid .PCD or .UPL file, then the
file's code, text and extension memory sizes are displayed. As each
program line, text character or extension memory byte is downloaded,
the line number, character or byte number is displayed, along with
the percent compete. When the download is done, the status of all
CPUs is shown (Run, Stop etc.), followed by the "Complete" message.

If configuring S-BUS (/S) or re-allocating memory (/M) the S-BUS


configuration and memory map are displayed.

Examples:

C:\>SDNLD FRED 0 /R

SAIA PCD DOWNLOADER V2.1


Downloading: FRED.PCD
To: CPU 0

Code size: 3654 lines (14616 bytes)


Text/DB size: 473 bytes
Exten mem size: 12886 bytes

Downloading code
Downloading texts/DBs
Downloading extension memory

CPU 0 running

Complete
LOADER - Page 28

Downloader operation continued:

C:\>SDNLD FRED /M

SAIA PCD DOWNLOADER V2.1


Downloading: FRED.PCD
To: CPU 0

Code size: 3654 lines (14616 bytes)


Text/DB size: 473 bytes
Exten mem size: 0 bytes

Allocating memory
Downloading code
Downloading texts/DBs

CPU 0 halted
CPU 1 halted

Complete

C:\>SDNLD /M

SAIA PCD DOWNLOADER V2.1

Allocating memory
CPU: 0 1
Code: 14 0 K lines
Text: 8 0 K bytes
Extn: 0 0 K bytes

Complete

C:\>_

Aborting the download


---------------------

The download operation may be aborted by pressing ESCape. If aborted,


"Download aborted" is displayed, and the CPU's memory remains empty.
LOADER - Page 29

4.3 Downloader Warnings


------------------------

The following warnings are shown if the program should NOT be


downloaded into the connected PCD. They occur when data defined by
the $PCDVER, $CPU and $STATION assembler directives does not match
the destination PCD. An "Abort download (Y or N)?" prompt is
displayed, and the download should normally be aborted.

WARNING: Program requires <PCD type> firmware version <version> or


above

The PCD does not have the required firmware version. There
are instructions in the .PCD file which WILL NOT RUN on
this PCD.

WARNING: Program is not for PCD type <PCD type>

The PCD is the wrong type. There are instructions in the


.PCD file which WILL NOT RUN on this PCD.

WARNING: Program is for CPU <n> only

The .PCD file was designed to run on CPU <n> only, it will
probably not run correctly on the connected CPU.

WARNING: Program is for S-BUS station <n> only

The .PCD file was designed to run on S-BUS station <n> only,
it will probably not run correctly on the connected station.
LOADER - Page 30

4.4 Downloader Error Handling


------------------------------

When an error occurs, the download procedure is stopped, an error


message is displayed and the program returns to DOS or the parent
process (menu), with a non-zero return status.

If SDNLD is invoked from DOS, disk read and write errors will be
preceded by a standard DOS disk error prompt, for example:

Not ready error reading drive C


Abort, Retry, Ignore ? _

Pressing 'A' causes a return to DOS or the parent process (menu


program), closing in input file. Pressing 'R' will retry the disk
operation. Pressing 'I' causes a return to the SDNLD program, which
will display it's error message, close the input file and exit to
DOS or the menu.

If SDNLD is invoked from the menu, no DOS disk error handling


occurs. In this case, the download programs error message is
displayed directly, and control is returned to the menu program.

The following errors can occur:

Error 1: Incorrect number of parameters

The command line has too many parameters.

Error 2: Invalid filename: <filename>

The filename is not a valid DOS filename, or is a device


name (PRN, COM1 etc).

Error 3: Invalid CPU number: <n>

The CPU number must be 0-6 for a PCD6 or 0-1 for a PCD4 or
0 for a PCD1, PCD2 or PCD6,M5. If no CPU number is given,
the destination filename must not be all digits, otherwise
it is interpreted as a CPU number.

Error 4: Invalid switch: <switch>

See section 4.1.

Error 5: PCDSETUP.DAT not found or invalid

Usually caused by running an old version of the utilities


with PCDSETUP.DAT file created by a more recent version.
LOADER - Page 31

Downloader errors continued:

Error 6: Program not licensed

The licence number in the PCDSETUP.DAT file does not support


this operation. Ensure you are using the correct PCDSETUP.DAT
file.

Error 7: Can't connect to S-BUS Station <station>

Check that the station is correctly configured, for baud


rate, port and station number. Ensure that the CONFIGURE
S-BUS operation has been done correctly.

Error 8: Can't open file: <filename>

The file to be downloaded can't be opened for reading,


usually because the file doesn't exist.

Error 9: Read error on file: <filename>

An error has occurred during the reading of the file.


Usually caused by a corrupted diskette.

Error 10: CPU's header not initialized, can't download

The requested CPU does not exit, has never been programmed,
or memory has never been allocated. Doesn't occur if the
"/M" switch is given.

Error 11: PCD contains EPROM, can't download

Occurs if the PCD contains EPROM memory instead of RAM.

Error 12: Invalid absolute object file: <filename>

The file to be downloaded is not a valid absolute object


file, or its checksum is incorrect.

Error 13: Not enough space for code: Has nnK, needs nnK
Error 14: Not enough space for text: Has nnK, needs nnK
Error 15: Not enough extension memory: Has nnK, needs nnK

The size of the code, text or extension memory in the file


to be downloaded is too big. The actual and required segment
sizes are shown. The segment sizes must be changed from
the "Configure/Hardware and memory" menu, and the PCD's
memory allocated.

Error 16: Command not accepted by PCD (NAK response)

A message sent to the PCD was not accepted. May occur if


the wrong baud rate or protocol is selected.
LOADER - Page 32

Downloader errors continued:

Error 17: No response from PCD

The PCD is not responding after three retries. May occur if


the wrong baud rate, protocol or serial port is selected.
Also occurs after configuring S-BUS via an S-BUS connection,
if the PGU port number, RS232/485 type or modem setting is
changed.

Error 18: Invalid response from PCD


Error 19: Communications error (parity, framing or overrun)

These may occur if the wrong baud rate or protocol is


selected.

Error 20: PCD not connected to COMn or powered off


Error 21: Serial port COMn not present

Is the COM port correct? The port is defined on the


"Configure/Serial ports for PC" menu.

Error 22: User memory write error

A memory write failed, usually caused by write protected


RAM, a missing memory chip or an invalid memory size.

Error 23: Bad connection between P800 and PCD6

Ensure the contacts are clean and undamaged, re-connect


the P800 and try again. NOTE: Never connect or disconnect
the P800 while the PCD6 is powered up.

Error 24: Wrong PCD type selected in hardware configuration

An attempt has been made to allocate memory when connected


to the wrong PCD type. Correct the PCD type from the
"Configure/Hardware and memory" menu and try again.

Error 25: Nothing to do!

Conflicting switches have been given and nothing can be done.

Error 26: Out of memory

There is not enough memory to run SDNLD. Try running


PCD.EXE with the /X switch so that extended or expanded
memory can be used, or run SDNLD from the DOS prompt.
Remove any memory resident programs.

Error 27: Internal error: <reference>

A fatal internal software error has occurred. Notify SAIA


Technical Support immediately, supplying the <reference>,
and details of how to reproduce the error.
LOADER - Page 33

Downloader errors continued:

Error 28: The PCD4.M4 cannot use port 2 or 3 as a PGU port


Use port 0 or 1 for the S-BUS PGU port on a PCD4.M4.

Error 29: Memory MAP in EPROM, can't change size of extension memory

When trying to download extension memory only, it is not


possible to change the amount of extension memory used if
the program is in EPROM memory, because the memory map is
also stored in EPROM, and this cannot be changed.

Error 30: Modem type <modem name> not found in <filename>

A modem type has been configured from the "Configure/Modem


for SAIA PCD" menu, and this type does not appear in the
MODEM.DAT file. This may be because the wrong file is being
accessed, first the current directory is checked for the
MODEM.DAT file, then the PCD Programming Utilities directory.
This error can also be caused is the modem type has been
deleted from the MODEM.DAT file.

Error 31: Not enough space for header, memory must be reallocated

The new feature which allows modem control strings for the
PCD to be defined from the "Configure/Modem for SAIA PCD"
menu cannot be used because CPU 0's contains a program, and
there is no space to extend the configuration header.
Reallocate the memory, then configure S-BUS and download
all the programs.

Error 32: PCD <version> only supports the "Factory Default" modem

The new feature which allows modem control strings for the
PCD to be defined from the "Configure/Modem for SAIA PCD"
menu is not supported by the version of the firmware in the
PCD. The firmware must be upgraded.

Error 33: PCD <version> doesn't support the S-BUS gateway

The new "Configure/Gateway master port" feature is not


supported by the version of the firmware in the PCD, the
gateway configuration was not loaded. Either upgrade the
PCD's firmware, or set the "Gateway port" to "None".

Error 34: PCD <version> doesn't support selectable Break/Parity


signalling

The "Configure/s-bUs communications" menu's "S-BUS mode"


is not supported by the firmware. If "Public line modem"
is set to "Yes", then only "Break" signalling can be used,
otherwise only "Parity" signalling can be used.
LOADER - Page 34

Downloader errors continued:

Error 35: Invalid station number: <n>

Valid S-BUS station numbers are 0..254.

Error 36: Can't use /NCO switch (NoClearOutputs) with /M (Map)

When the PCD's memory is re-allocated, outputs are always


cleared. These switches cannot be used together.

Error 37: PCDx.xx firmware does not support S-BUS Data Mode

Upgrade your PCD's firmware to use this communications


mode.

Error 38: Only the PCD6.M3 supports serial channel 4 (PGU port)

The connected PCD only supports serial channels 0..3.

Error 39: Incorrect memory allocation, the PCD does not contain
Flash EPROM

Flash EPROM memory has been selected, press F2 and select


the correct memory size/type.

Error 40: Incorrect memory allocation, the PCD contains Flash EPROM

Flash EPROM memory must be selected, press F2 and select


FLASH EPROM.

Error 41: PCD's memory not allocated

Allocate the PCD's memory with the ALLOCATE MEMORY or


DOWNLOAD PCD SETUP command. Press F2 to view and define
the memory allocation.

Error 42: Code segment not downloaded

If downloading the text and/or extension memory segemnts


separately, without the code, the code segment must already
have been downloaded.

Error 43: Text segment not downloaded


Error 44: Extension memory segment not downloaded

If downloading only the code segment, the text or extension


memory segments must already have been downloaded, if used
by the program.
LOADER - Page 35

4.5 Downloader Return Values


-----------------------------

SDNLD returns the following status values to DOS or the parent process.
All non-zero values mean that the download or memory reallocation
failed, and PCD memory may be empty or corrupted. SDNLD will have
displayed an error message on the screen before exiting. The return
value can be checked by using ERRORLEVEL in a batch file.

0 Download successful
1 Invalid command line parameter
2 Failed, communications or other error
3 Download aborted with Ctrl+C or ESC

*** END SLOAD.DOC ***


*********************************************************************
* *
* SPROM - PCD EPROM PROGRAMMING UTILITIES *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME SPROM.DOC *
* AUTHOR MATT HARVEY *
* *
*********************************************************************

REVISION HISTORY
05-Jan-98 V2.1
1) Can generate HEX files for PCD2's 4MBit EPROM.
2) New error messages 33..35.

21-Jun-96 V2.0

03-Jun-96 B2.0d
1) Add ERROR 33: INVALID PCDn MEMORY SIZE, PRESS F2 AND SELECT
64 OR 128KB. The PCD1 and PCD2 accept 64 or 128KB EPROMs
only. Remove 32KB EPROM from EPROM TYPES box in section 5.
2) Show PCD1 RAM/EPROM jumper in 5.6.

16-Oct-95 $198
1) Support for PCD1.

24-Apr-94 V1.9

06-Feb-95 $18A
1) Now programs the gateway configuration into EPROM or
hex files. This is defined on the "Configure/Gateway
master port" screen, displayed by pressing F6.
2) Added "F6=Gateway" so that the gateway master port
configuratiuon can be viewed and edited.
3) Added "F7=Password" to allow a password and timeout to
be defined and programmed into the EPROM.
4) New error messages:
ERROR 31: INVALID TIMEOUT, RANGE IS 1..60 MINUTES
ERROR 32: MISSING PASSWORD

16-Aug-94 $188
1) Now programs the "extended header" into EPROM. This
programs the "Modem for SAIA PCD" reset and init strings
defined on the new "Configure/Modem for SAIA PCD" screen.
2) Now has a new "verify configuration" prompt to give
the user the opportunity to verify and change the config-
uration before programming the EPROMs:
VERIFY CONFIGURATION: Press F2, F3 then F4, ENTER
accepts, ESC aborts
The "check configuration" screen has been removed.
3) New error messages:
ERROR 29: CAN'T RUN PROGRAM: SCONFIG.EXE
ERROR 30: MODEM TYPE <modem name> NOT FOUND IN MODEM.DAT

18-Jul-94 $187
1) Add function keys for configuration (calls SCONFIG):
F2=Hardware and memory, F3=S-BUS, F4=PCD modem. Remove
section 2.4 "Check configuration".
02-Apr-94 $184
1) SWMR 601: Starter Package checks.
Add ERROR 27 and 28.
2) <S> now skips the programming of an EPROM, was SPACE which
was too easy to press by mistake.

25-Sep-93 $174
1) SWMR 530: Display "Check configuration" screen to allow
the configuration to be checked before programming it into
EPROMs. See section 2.4.

31-Jul-93 $173
1) Now creates "extension memory initialization segment".
New /NX /CX command line switches to control generation
of this segment (7).

19-Jul-93 $171
1) Removed ERROR 17, changed text of ERROR 20.
2) Now programs "extension memory initialization segment"
into text memory.

09-Jun-93 V1.7
1) Now programs the extension memory mam and the S-BUS PGU
port configuration into EPROMs.
2) Supports the PCD2 which has only one EPROM.
3) Supports new EPROM types, if the ERTEC PGS53 is being used.
4) The "Hex file name" and "Hex format" fields or now only
displayed if the "Create HEX files from PCD files" operation
is selected.
5) Function key F5 displays the pop-up directory window when
the cursor is in a filename entry field.
6) New error messages 24 to 27.
7) Add sections on PCD7.R1/R3 and PCD2 memories.

31-Jan-92 $155A
1) Change ERROR 1 text.

06-Dec-91 $154
1) Now has F1=hyperhelp.
2) Added error messages 22 and 23.

09-Oct-91 $153
1) Add description of new PCD6.R600 memory module (5.2).
2) Re-write to work with up to 1MB of EPROMs to support new
PCD6.R600 memory module. Previously SPROM create the image
for up to 8 EPROMS (256K bytes) in the IBM PC's memory, but
this method was not possible for larger memories.
3) "Processing file" box not shown anymore. Files are now read
during programming.
4) "Verifying EPROM" box not shown anymore. This pass was
removed to speed up the process, since the EPROM data is
verified by the EPROM programmer during programming, and is
again checked by the PCD when it verifies the EPROM checksum
during it's power-up sequence.
5) New error messages:
ERROR 15: MEMORY ALLOCATION TOO BIG FOR THIS EPROM TYPE
ERROR 21 CHECKSUM ERROR ON FILE: <filename>
6) Can now create extended Tektronix hex files > 64K.
12-Sep-91 $152
1) Stores menu data in PCDMENU.DAT, file SPROM.DAT not used.

10-May-91 $151
1) Now handles "ERTEC PGS53" programmer type.
2) "PCD6.R500" can now be selected as the EPROM type.
3) New error messages 16..20, plus messages from ERTEC PGS53.
Error 6 and 10 message texts changed.
4) Failed and aborted status boxes now blink to make them more
noticeable.
5) "Blankcheck" now displays "EPROM IS BLANK" on line 23.
6) Hex files now have the extension ".HEX" (was ".1" to ".8").
The last character of the hex file name is now "1" to "8"
to indicate the EPROM number.
7) New status box "LOADING FIRMWARE INTO PGS53".
8) A fancy beep is now issued when the programming of an EPROM
is complete.
9) A command-line switch "/19" has been added, this sets the
baud rate for communication with the EPROM programmer to
19200 baud. The default is 9600 baud.
10) Added EPROM/memory card table to section 5.

04-Dec-90 V1.4
1) SWER 2: Added error message 15, PCD4 can have only 2 eproms.

20-Jun-90 $13x
1) If the processor type is PCD4, the menu shows only two CPUs
(0 and 1). The PCD4 always has two EPROMs, so instead of the
"required eproms" box, a "number of eproms" box is shown.
2) The EPROM type (27C256, 27C512 or 27C1001) can now be selected.
This is for use with the new PCD7.Rxx module, or the PCD4.R110
modified for 27C512. (SWMR 121 and 122).
3) Added "ERROR 14: MODIFIED PCA2.P16 CAN ONLY PROGRAM 27C256
EPROMS".
4) Hex files can now contain more than 64K (except Tektronix).
5) Now has F1=Help. Help text in SPROM.HLP.
6) Added details of memory card types to section 5.

22-Nov-89 V1.3
1) More than one '.' allowed in a file name during entry (SWMR 7).
2) Allows disk drive in file name (SWMR 28).
3) Now works in colour as defined in PCDCOLOR.DAT.
4) Saves menu data in SPROM.DAT.
5) Now supports COM1, COM2, COM3 and COM4.

22-Mar-88 V1.0
Update after final code test. Added EPROM verify after
programming.

11-Mar-88 Preliminary.
CONTENTS
════════

Page

1. OVERVIEW . . . . . . . . . . . . . . . . . 1

2. USING SPROM . . . . . . . . . . . . . . . 2
2.1 Program EPROMs from PCD files . . . . 4
2.2 Blankcheck EPROMs . . . . . . . . . . 7
2.3 Create HEX files from PCD files . . . 8
2.4 Using a password . . . . . . . . . . . 9

3. ERROR HANDLING . . . . . . . . . . . . . . 10
3.1 Error messages . . . . . . . . . . . . 10
3.2 Messages from ERTEC PGS53 . . . . . . 14

4. HEX FILE FORMATS . . . . . . . . . . . . . 15


4.1 Intel hex format . . . . . . . . . . . 16
4.2 Motorola hex format . . . . . . . . . 17
4.3 Tektronix hex format . . . . . . . . . 18

5. EPROM MEMORY CARDS AND EPROM TYPES . . . . 20


5.1 PCD6.R500 for PCD6.M1/M2 . . . . . . . 20
5.2 PCD6.R600 for PCD6.M1/M2 . . . . . . . 21
5.3 PCD4.R1 for PCD4 and PCD6.M5 . . . . . 21
5.4 PCD7.R1 for PCD4 and PCD6.M5 . . . . . 21
5.5 PCD7.R300 for PCD4 and PCD6.M5 . . . . 22
5.6 PCD1 Memory . . . . . . . . . . . . . 22
5.7 PCD2 Memory . . . . . . . . . . . . . 22
5.8 EPROM Types . . . . . . . . . . . . . 23

6. EPROM PROGRAMMERS . . . . . . . . . . . . 26
6.1 ERTEC PGS49 . . . . . . . . . . . . . 26
6.2 ERTEC PGS53 . . . . . . . . . . . . . 27
6.3 PCA2.P16 . . . . . . . . . . . . . . . 27

7. EXTENSION MEMORY INITIALIZATION SEGMENT . 29


SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 1

1. OVERVIEW
════════════

SPROM provides all the functions needed to program EPROMs for the
SAIA PCD range of processors:

* Blankchecks EPROMs. EPROMs to be programmed must first be erased


using a UV eraser, this operation checks that all locations in
the EPROM are set to FF hex.

* Programs absolute object files (.PCD or .UPL files) for one or


more CPUs into EPROMs. In a multiprocessor system, all CPUs can
be programmed at the same time, or each CPU can be individually
programmed.

* Creates hex files in Intel, Motorola or Tektronix formats. Hex


files can be used by an EPROM programmer which is not supported
by SPROM.

* Drivers for three different EPROM programmers are provided, the


user can select the EPROM programmer type. (New drivers can be
easily added if required).

* EPROMs fitted to the EPROM memory card PCD6.R500 can be programmed


by using the PCD8.P71 switch box to select individual EPROMs on
the card, without removing the EPROMs from the card.

* The EPROM type can be selected (27C256, 27C512, 27C1001 or


PCD6.R500 module). The EPROM type for PCD4 memory cards is
selected using jumpers on the card.

* These files are required:

SPROM.EXE Executable program


SPROM.HLP Help texts
SPROM.TYP EPROM type configuration data (PGS53 only)
PCDMENU.DAT Stores recent entry field data
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 2

2. USING SPROM
═══════════════

SPROM is invoked either from the PCD Programming Utilities main


menu via the "Program eproms" option, or from the DOS prompt with
the command:

C:>SPROM [switch]

[switch] is an optional switch (/NX or /CX) which controls the


generation of the "extension memory initialization segment", see
section 7.

SPROM can communicate with the EPROM programmer at 9600 or 19'200


baud. The baud rate is defined on the "Configure/Serial ports"
menu, and is shown on line 23 when SPROM's menu is displayed:

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD EPROM PROGRAMMING UTILITIES V2.1 PCD Type: PCD6.M1/M2 │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Operation, press SPACE to select: Program EPROMs from PCD files │
│ │
│ Hex file name (*1.HEX to *8.HEX): __________ Hex format: Intel │
│ │
│ EPROM programmer type: ERTEC PGS49 EPROM type: I27256 (32KB) │
│ │
│ CPU 0: __________________________________________ │
│ │
│ CPU 1: __________________________________________ │
│ │
│ CPU 2: __________________________________________ │ ┐
│ │ │
│ CPU 3: __________________________________________ │ │
│ │ │ PCD6
│ CPU 4: __________________________________________ │ ├──── ONLY
│ │ │
│ CPU 5: __________________________________________ │ │
│ │ │
│ CPU 6: __________________________________________ │ │
│ │ ┘
23 │ BAUD RATE: 19200 │
├────────────────────────────────────────────────────────────────────────────────┤
24 │ SPACE selects operation, ARROW or TAB moves cursor, ESC exits. │
│ F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F7=Password F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The menu contains two types of entry fields, select fields and file
name entry fields. Entry fields are shown in bold video.

Select fields allow the selection of one choice from a list of two or
more choices, using the SPACE bar.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 3

Using SPROM continued


─────────────────────

File name entry fields are indicated by a dotted line, and accept
valid DOS file names. If on a file name entry field, pressing the
SPACE bar clears to the end of the field, and moves the cursor to
the next field. Pressing function key F5 displays a pop-up window
containing showing all the ".PCD" files, from which a file name can
be chosen.
If the PCD4 processor type has been selected during the configuration,
then only two CPUs can be present (0 and 1), and only two file name
fields are displayed.
Movement from one field to another is by the use of the ARROW, TAB,
BACKTAB or SPACE keys.
The blank area to the left of the CPU file name fields is for the
pop-up status window display, described in the following sections.
Line 23 is for error and status messages. Error messages are displayed
in bold video, accompanied by a "beep".
Line 24 is the prompt line. This indicates which keys can be used,
or in certain cases will ask a question requiring a Yes or No (Y or N
key) response.
On the menu, the first select field, "Operation", allows the selection
of the operation to be performed. This can be:

Program EPROMs from PCD files


Blankcheck EPROMs
Create HEX files from PCD files

Pressing ENTER begins the selected operation. When ENTER is pressed,


the user must verify before continuing. The following prompt is
displayed:
├────────────────────────────────────────────────────────────────────────────────┤
│ Begin selected operation (Y or N) ? _ │
│ F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F7=Password F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Answering 'Y' (or 'y') begins the operation, 'N' (or 'n') aborts,
returning the cursor to the menu.

Before a "Program EPROMs" or "Create HEX files" operation is executed,


the "VERIFY CONFIGURATION" prompt is displayed:
├────────────────────────────────────────────────────────────────────────────────┤
│ VERIFY CONFIGURATION: Use F2, F3, F4, F6 and F7, ENTER accepts, ESC aborts. │
│ F2=PCD type+memory F3=S-BUS F4=PCD modem F6=Gateway F7=Password F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

If required, the configuration can be verified before continuing


by pressing F2, F3, F4, F6 and F7. This displays the associated
configuration screens from the Configurator (SCONFIG), and the
configuration can be changed if necessary. Press ENTER to continue
or ESCape to abort.

When not executing an operation, the ESCape key will exit SPROM,
returning the the main PCD Programming Utilities menu or to DOS,
depending on from where SPROM was invoked.

Each operation is described in the following sections.

The "Hex file name" and the "Hex format" fields are used only when
the "Create HEX files from PCD files" operation is selected. See
section 2.3.

Pressing F1 displays the help file "SPROM.HLP".


SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 4

2.1 Program EPROMs from PCD files


──────────────────────────────────

This operation requires the file names of each PCD file for each CPU
to be entered, and the "EPROM programmer type" and "EPROM type" to be
selected. The correct configuration must also have been defined from
the "Configure/Hardware and memory" (F2), "Configure/s-Bus
communications" (F3) and "Modem for SAIA PCD" (F3), "Configure/
Gateway master port" (F6) screens. To define a password to be
programmed into EPROM, press F7, see section 2.4.

The EPROM programmer should be connected to the personal computer via


the serial port selected on the "Configure/Serial ports". This must
be done before the operation is begun.

Before programming EPROMs, it is a good idea to ensure that they are


all blank, using the "Blankcheck" operation, see section 2.2.
Programming areas of EPROMs which are not blank will fail, unless
they are being programmed with exactly the same data.

CPU file names are the names of each absolute object file (executable
program) to be programmed for each CPU. The default file type is
".PCD", this is automatically appended to the file name, and need not
be entered. ".UPL" (uploaded programs) can also be programmed, but
the ".UPL" file type must be entered.

If the PCD type is a PCD6, then a status window is is displayed


which shows the EPROMs needed on the PCD6.R500 or PCD6.R600 card.
This is a representation of the card, and shows how the EPROMs are
numbered. The required EPROMs are highlighted in bold video.

┌──────────────────────────┐
│ ╔═══ PCD6.R5xx/R6xx ═══╗ │
│ ║ ┌──┬───┬───┬───┬───┐ ║ │
│ ║ │┌┐│ 2 │ 4 │ 6 │ 8 │ ║ │
│ ║ │││├───┼───┼───┼───┤ ║ │
│ ║ │└┘│ 1 │ 3 │ 5 │ 7 │ ║ │
│ ╚ └──┴───┴───┴───┴───┘ ╝ │
└──────────────────────────┘

For other PCD types, the number of EPROMs required is displayed.

The user is prompted to select the first EPROM:


│ ┌──────────────────────────┐ │
│ │ ╔══════════════════════╗ │ │
│ │ ║ ║ │ │
│ │ ║ SELECT/INSERT ║ │ │
│ │ ║ EPROM 1 ║ │ │
│ │ ║ ║ │ │
│ │ ╚══════════════════════╝ │ │
│ └──────────────────────────┘ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Select/insert correct EPROM, ENTER executes, <S> skips, ESC aborts. │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 5

Program EPROMs from PCD files continued


───────────────────────────────────────

At this stage, if the PCD8.P71 switch box is being used to program


EPROMs on a PCD6.R500 memory card, the switch on the P71 should be
set to the indicated position to select the correct EPROM. The
switch positions select the EPROMs corresponding to the numbers in
the "PCD6.R5xx EPROMS" window.

Alternatively, individual EPROMs can be programmed without the use


of the switch box. The correct EPROM should be inserted into the
programmer at this stage. The EPROM number should be written on it,
so that it can be inserted into the correct socket on the memory
card after programming.

When the correct EPROM is selected, pressing ENTER begins programming.


It is possible to skip the programming of any EPROM by pressing the
SPACE bar.

During programming, the status window indicates the EPROM and the
hexadecimal address of the byte being programmed. Addresses are from
0 to 1FFFF hex according to EPROM type, but usually not all bytes
in an EPROM require programming. During programming, each individual
byte is verified automaticlly by the EPROM programmer.

┌──────────────────────────┐
│ ╔══════════════════════╗ │
│ ║ PROGRAMMING ║ │
│ ║ EPROM 1 ║ │
│ ║ ║ │
│ ║ ADDRESS 001234 ║ │
│ ╚══════════════════════╝ │
└──────────────────────────┘

Successful programming of all the required EPROMs is indicated by


the "Operation complete" status window:

┌──────────────────────────┐
│ ╔══════════════════════╗ │
│ ║ ║ │
│ ║ OPERATION ║ │
│ ║ COMPLETE ║ │
│ ║ ║ │
│ ╚══════════════════════╝ │
└──────────────────────────┘
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 6

Program EPROMs from PCD files continued


───────────────────────────────────────

Programming can be aborted at any time using the ESCape key, or


will be aborted if any programming errors are detected. If failed,
an error message is displayed. This is indicated by one of these
blinking status windows:

┌──────────────────────────┐ ┌──────────────────────────┐
│ ╔══════════════════════╗ │ │ ╔══════════════════════╗ │
│ ║ ║ │ │ ║ ║ │
│ ║ OPERATION ║ │ │ ║ OPERATION ║ │
│ ║ ABORTED ║ │ │ ║ FAILED ║ │
│ ║ ║ │ │ ║ ║ │
│ ╚══════════════════════╝ │ │ ╚══════════════════════╝ │
└──────────────────────────┘ └──────────────────────────┘

*** NOTES ***

Never power the EPROM programmer off or on with an EPROM inserted,


damage to EPROMs may occur. EPROMs should only be inserted when
prompted to do so by SPROM, and should be removed as soon as the
operation is complete.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 7

2.2 Blankcheck EPROMs


──────────────────────

This checks that the entire EPROM has been erased (all data bytes
are 0FFH).

For this operation, the correct "EPROM programmer type" and "EPROM
type" must be selected, the file names are not required.

The user is prompted to select the EPROM to be blank checked, then


to press ENTER to begin. Press ESC to end blankchecking.
│ │
│ ┌──────────────────────────┐ │
│ │ ╔══════════════════════╗ │ │
│ │ ║ ║ │ │
│ │ ║ SELECT/INSERT NEXT ║ │ │
│ │ ║ EPROM TO BLANKCHECK ║ │ │
│ │ ║ ║ │ │
│ │ ╚══════════════════════╝ │ │
│ └──────────────────────────┘ │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Select/insert next EPROM, ENTER to blankcheck, ESC to end blankchecking. │
│ F1 = Help │
└────────────────────────────────────────────────────────────────────────────────┘

During the blankcheck operation, a status window indicates that the


EPROM is being checked:

┌──────────────────────────┐
│ ╔══════════════════════╗ │
│ ║ ║ │
│ ║ CHECKING EPROM ║ │
│ ║ IS BLANK ║ │
│ ║ ║ │
│ ╚══════════════════════╝ │
└──────────────────────────┘

If the EPROM is blank, "EPROM BLANK" is displayed on the message line.


If it's not blank, an error message is displayed, and the next EPROM
can be checked or ESC pressed to end the blankcheck operation.

Blankchecking can take up to 25 seconds for a 27C1001.


SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 8

2.3 Create HEX files from PCD files


────────────────────────────────────

For this operation, the CPU file names must be entered, the correct
"Hex format" and "EPROM type" must be selected, and the "Hex file
name" must be entered. The correct memory allocation and S-BUS
configuration must also have been defined from the "Configure/
Hardware and memory" (F2) and "Configure/s-Bus communications" (F3)
and "Modem for SAIA PCD" (F3) menus.

All hex files have the extension ".HEX". The last digit of the file
name indicates which EPROM each file is for. For example, if the
hex file name is "DEMO", and 2 EPROMs are required, then 2 hex files
are produced: "DEMO1.HEX" and "DEMO2.HEX", which should be programmed
into EPROMs 1 and 2. If the entered hex file name is 8 characters
long, then the last character is lost.

If the hex files already exist, a warning prompt is displayed:

WARNING: File <filename> already exists, overwrite it (Y or N) ?

The "Required EPROMs" window is displayed as described in section 2.1.

A status window indicates which hex file is being written:

┌──────────────────────────┐
│ ╔══════════════════════╗ │
│ ║ ║ │
│ ║ CREATING HEX FILE ║ │
│ ║ DEMO1.HEX ║ │
│ ║ ║ │
│ ╚══════════════════════╝ │
└──────────────────────────┘

The operation can be aborted at any time by pressing ESCape.

The completion of the operation is indicated as described in section


2.1.

*** NOTE ***

At the start of the operation, all files with names matching those
that will be created are deleted.

The size of each hex file depends on the selected "EPROM type".
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 9

2.4 Using a password


─────────────────────

PCDs with the latest firmware (PCD2 V003, PCD4 V005, PCD4.M4 V001,
PCD6.M5 V004, PCD6 V007) now have a password protection mechanism.

When protected by the password only reduced protocol communications


can be used. This allows access only to Registers, Timers, Counters,
Inputs and Outputs and the clock. The user program and all other
data cannot be accessed unless a valid password is entered.

Password protection is restored either by entering an invalid


password with SBUG's "Write passWord" command, or by the PCD's
"inactivity timeout". The inactivity timeout can be set to between
1 and 60 minutes. This automatically restores the password protection
if no telegrams are received by the PCD within this period.

Whenever one of the SAIA PCD Programming Utilities online programs


is run, a pop-up window is displayed if the PCD is password protected.
This prompts for entry of the password, so that password protection
can be removed. To skip password entry, press ESCape, this causes
a reduced protocol connection to be made and all protected online
commands will produce a "command not accepted by PCD" error.

The password is defined for programming into EPROM by pressing


function key F7. This displays a pop-up window allowing a password
and inactivity timeout to be entered:

╔═════════════════════════════════════════╗
║ CONFIGURE ONLINE PASSWORD ║
║ ║
║ Password: RUMPLESTILTSKIN__________ ║
║ Timeout: 0_ (1..60 minutes ║
║ ║
║ ENTER accepts, ESCape removes password. ║
╚═════════════════════════════════════════╝

To enable password protection, enter a password in the "Password"


field, define the inactivity timeout (1 to 60 minutes), and press
ENTER. To remove password protection, press ESCape. The default is
no password protection.

Once the password has been programmed into EPROM, it can be changed
only by re-programming all the EPROMs.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 10

3. ERROR HANDLING
══════════════════

The following classes of errors are detected:

* Disk file read and write faults.

* Absolute object files (.PCD or .UPL) are verified for valid


headers and correct checksums.

* Communications errors between the personal computer and the


EPROM programmer - parity, overrun, framing and block check
code (BCC) errors.

* EPROM programming errors. Each byte programmed into the EPROMs


is verified twice.

Recovery is possible from all errors by correcting the fault and re-
starting the operation. See the notes accompaying the error message
descriptions below.

3.1 Error messages


───────────────────

ERROR 1: PCDSETUP.DAT NOT FOUND OR INVALID

The configuration data file PCDSETUP.DAT should be in the


PCD or current directory, and must be the correct version.

ERROR 2: <programmer> NOT CONNECTED OR NOT READY

Check the EPROM programmer is connected to the correct serial


port (selected in the configuration program), and that it's
powered on.
NOTE: The ERTEC PGS53 needs 15 seconds to calibrate itself
after switching on before it can be used.

ERROR 3: NO FILE NAME ENTERED

A file name is required for the selected operation. To program


EPROMs, CPU 0 must have a file name. To create hex files, a
hex file name must be entered.

ERROR 4: CAN'T OPEN FILE: <file name>

When reading files, this means the file cannot be found.


When writing files, this usually means that the disk is full
or write protected, or an attempt has been made to overwrite
a write protected file.

ERROR 5: READ ERROR ON FILE: <file name>

The file cannot be successfully read, probably due to a


damaged disk.

ERROR 6: INVALID PCD FILE: <file name>

The file has an invalid format or checksum.


SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 11

Error messages continued


────────────────────────

ERROR 7: CODE SEGMENT TOO SMALL: CPU n: FILE name: HAS nnK: NEEDS nnK
ERROR 8: TEXT SEGMENT TOO SMALL: CPU n: FILE name: HAS nnK: NEEDS nnK

The code or text segment sizes allocated by the configuration


program ("Configure" from the main menu, or program "SCONFIG")
are too small to allow the file to be programmed. The actual
segment sizes and the sizes needed by the program are shown.
Correct the memory allocation and retry.

ERROR 9: EPROM IS NOT BLANK

The selected EPROM has failed the blankcheck operation, not


all bytes are FFH. It must be erased using a UV eraser. All
bytes must be FFH before the EPROM can be programmed.

ERROR 10: PROGRAMMING FAILURE AT ADDRESS nnnnnnH

The EPROM was incorrectly programmed at the displayed address


(hex). This is usually caused because an EPROM was not erased.
It could also be because the wrong EPROM type was selected,
or because the EPROM has been incorrectly inserted. The prog-
ramming operation can be restarted by inserting a fresh blank
EPROM, and skipping to the correct EPROM number by pressing
the <S> key.

ERROR 11: WRITE ERROR ON FILE: <file name>

May occur when writing hex files. This is usually caused by a


full disk. This may also be caused by a write-protected disk,
or by trying to write over a read-only file.

ERROR 12: INVALID FILE NAME: <file name>

The file name is not a valid DOS file name, or it is a device


name.

ERROR 13: OUT OF MEMORY

There is not enough available memory to run SPROM. Since


SPROM doesn't use much memory, this should never occur.
If it does, remove any memory resident programs (Norton
Utilities, RAM disk etc.) and try again. If this still fails,
run SPROM directly from the DOS prompt.

ERROR 14: <programmer type> CAN'T PROGRAM THIS EPROM TYPE

The selected EPROM type is not supported by the programmer.

ERROR 15: MEMORY ALLOCATION INVALID FOR THIS EPROM TYPE

More than 1 (PCD2), 2 (PCD4/PCD5) or 8 (PCD6) EPROMs of the


selected type would be needed to hold the program. You must
either select a larger EPROM type, or select a smaller memory
size from the "Configure/Hardware and memory" menu.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 12

Error messages continued


────────────────────────

ERROR 16: COMn NOT PRESENT

Select another serial port from the "Configure/Serial ports"


menu.

ERROR 17: NO RESPONSE FROM <programmer type>

Check that the correct EPROM programmer type is selected, and


that it's connected to the correct serial port. If unsuitable
messages have been sent to the programmer, e.g. the wrong
EPROM programmer type was selected, or messages for the PCD
were sent, then the EPROM programmer may need a power-up
reset.
Turn the programmer off and on to reset it.

ERROR 18: INVALID RESPONSE FROM <programmer type>

Check that the correct EPROM programmer type is selected, and


that it's connected to the correct serial port. The EPROM
programmer may also need a power-up reset, see the description
of ERROR 17 above.

ERROR 19: COMMUNICATIONS FAILURE

A parity, framing, overrun or block check code (BCC) error


occurred. Give the programmer a power-up reset, then try the
operation again. NOTE: Don't use 19200 baud if running SPROM
on a slow Personal Computer (e.g. 4.77MHz) or using the
PCA2.P16.

ERROR 20: INVALID EPROM TYPE FOR PCDn

The selected EPROM type cannot be used with the PCD type
selected on the "Configure/Hardware and memory" menu.

ERROR 21: CHECKSUM ERROR ON FILE: <filename>

The checksum on the .PCD or .UPL file was invalid. This can
be caused by trying to process the wrong file type, or by a
corrupted file, or by a rare personal computer memory read
error. Retry the operation, or re-generate the file and try
again.

ERROR 22: WRONG HELP FILE VERSION: SPROM.HLP


ERROR 23: INVALID HELP FILE FORMAT: SPROM.HLP

The help file "SPROM.HLP" is for an old version of SPROM.


Delete it and copy the latest version from the distribution
diskette.

ERROR 24: EXTENSION MEMORY TOO SMALL: CPU n: FILE x: HAS nK: NEEDS nK

The extension memory segment is too small for the configured


extension memory size. Increase the extension memory if
possible, see the "Configure/Hardware and memory" menu.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 13

Error messages continued


────────────────────────

ERROR 25: PROGRAM NOT LICENSED

This program cannot be used unless purchased as part of the


complete SAIA PCD Programming Utilities package.

ERROR 26: EPROM TYPE NOT FOUND IN FILE: SPROM.TYP

The ERTEC PGS53 requires EPROM configuration data from file


SPROM.TYP. The file found is probably an old version, which
doesn't contain the new EPROM types. Ensure the correct
SPROM.TYP file is in the PCD Utilities directory.

ERROR 27: STARTER PACKAGE SUPPORTS CPU 0 ONLY

The "Starter Package" allows only one CPU to be used.

ERROR 28: PROGRAM TOO BIG FOR n/n STARTER PACKAGE

The "Starter Package" has a restricted PCD memory size


and does not allow use of extension memory (TEXTs/DBs
4000..7999). This error occurs if the code or text in
the module is too large, or extension memory has been
used. "n/n" shows the max. code size in lines/text size
in bytes, e.g. 128/64 = max. 128 code lines + max. 64
text characters.

ERROR 29: CAN'T RUN PROGRAM: SCONFIG

Pressing F2, F3 or F4 should load and execute the config-


urator program SCONFIG. This error occurs if SCONFIG.EXE
can't be found, or there's not enough memory to load it.
Try running SPROM from the main menus, having invoked
PCD.EXE with the /X switch, so it uses expanded or extended ]
memory.

ERROR 30: MODEM TYPE <modem name> NOT FOUND IN MODEM.DAT

The PCD modem type which has been selected from the
"Configure/Modem for SAIA PCD" screen (press F4) cannot be
found in the MODEM.DAT file. Perhaps the wrong MODEM.DAT
file is being read: SPROM first looks for MODEM.DAT in the
current directory, then in the PCD Programming Utilities
directory.

ERROR 31: INVALID TIMEOUT, RANGE IS 1..60 MINUTES

The inactivity timeout for password protection is invalid.

ERROR 32: MISSING PASSWORD

ENTER was pressed when showing the password definition


window, and no password was entered. To clear the password
press ESCape.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 14

Error messages continued


────────────────────────

ERROR 33: INVALID PCD1 MEMORY SIZE, PRESS F2 AND SELECT 64 OR 128KB
ERROR 33: INVALID PCD2 MEMORY SIZE, PRESS F2 AND SELECT 64/128/512KB

The PCD1 accepts 64 or 128KB EPROMs only, and the PCD2


accepts 64, 128 or 512KB EPROMs. Press F2 and correct the
memory size and memory allocation.

ERROR 34: CANNOT PROGRAM 4MBIT (512KBYTE) EPROMS, CAN ONLY CREATE
HEX FILES
SPROM does not support 4 megabit EPROMs, but if the 4MBit
(512KB) EPROM type is selected, SPROM can be used to
create HEX files.

ERROR 35: FLASH EPROM MEMORY IS SELECTED, PRESS F2 AND DEFINE EPROM
MEMORY
SPROM cannot program Flash EPROM memory, Flash EPROM is
programmed by the downloader.

FATAL INTERNAL ERROR: <location>

SPROM has detected an internal software error. Report this


message and the <location> to your SAIA representative,
indicating how it occurred, and how to reproduce the error.

3.2 Messages from the ERTEC PGS53


──────────────────────────────────

The ERTEC PGS53 returns its own detailed error message texts, which
do not have error message numbers:

LEFT DEVICE NOT ERASED ADR: nnnnnnH ACT: ..ddH

During the blankcheck, location "nnnnnn" contained value "dd"


instead of FFH. Erase the EPROM with a UV eraser.

PROGRAMMING ERROR: (LEFT SOCKET) ADR: nnnnnnH REQU: ddH ACT: aaH

Address "nnnnnn" contained value "dd" instead of "aa" after


programming. This usually occurs because the EPROM was not
fully erased before it was programmed.

NO EPROM IN LEFT SOCKET OR EPROM NOT WORKING

Self explanatory.

OVER CURRENT (IPP/CNT: nn) / EPROM NOT PROPERLY INSERTED

The programming pulse current was too high.


SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 15

4. HEX FILE FORMATS


════════════════════

Hex files can be created for programming using software supplied


with an EPROM programmer which is not supported by SPROM. It is NOT
necessary to create hex files if using a supported EPROM programmer.

One file is produced for each EPROM, the last character of each file
is the EPROM number (1 to 8). All hex files have the extension
".HEX".

If the EPROM type is 271001 por 27010, which contains more than 64K
bytes, then the extended hex file formats are used, which contain
addresses greater than 16 bits.

All hex files consist of upper case ASCII Hexadecimal records,


terminated by carriage return/line feed characters. Each record
contains the EPROM data address and up to 16 data bytes, each byte
is represented by two ASCII characters.

The most common is the "Intel" hex format, which will be accepted by
almost all EPROM programming software.

Intel: Standard Intellec 8, MDS-80 format for EPROMs up to 64K


bytes (16-bit addresses), or MCS-86 format for 128K byte
EPROMs (28-bit addresses).

Motorola: Exorciser format for EPROMs up to 64K bytes (S1 records with
16-bit addresses), or Exormax format for 128K byte EPROMs
(S2 records with 24-bit addresses).

Tektronix: "/" records for EPROMs up to 64K bytes 16-bit addresses, or


extended Tektronix "%" records for 128K byte EPROMs.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 16

4.1 Intel hex format (Intellec / MDS, or MCS-86)


─────────────────────────────────────────────────

Each record begins with a colon, followed by a 2 character byte count.


The byte count must equal the number of data bytes in the record. The
four digits following the byte count are the address of the first data
byte. The next two digits are the record type (always "00" for data
records). Each data byte is represented by two hex digits. After the
data bytes is the checksum, this is the 2's complement of the modulo
256 sum of the all the preceding bytes (excluding the start character)
before conversion to ASCII.

The end-of-file record consists of the colon start character, the byte
count (always "00"), the execution address (always "0000"), the record
type (always "01"), and the usual record checksum.

Each record is terminated by carriage return/line feed characters.

Examples:

:100000000102030405060708090A0B0C0D0E0F0045<CR><LF>
:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0<CR><LF>
:00000001FF<CR><LF> eof record │ │
││ │ │ │ │ │
││ │ │ │ │ └─── Terminator
││ │ │ │ └────── Checksum (2 digits)
││ │ │ └──── Data characters (2 per byte), or checksum if eof record
││ │ └────── Record type ("00" for data record, "01" if eof record)
││ └────────── Address (4 digits, "0000" if eof record)
│└──────────── Byte count (2 digits, "00" if eof record)
└───────────── Start character

Intel MCS-86 hex format (24-bit addresses)


──────────────────────────────────────────

Data records are as above, but additional extended address records


define the upper 4 bits for all further data records:

:02000002aaaaCC<CR><LF>
│ │ │ │ │
│ │ │ │ └─── Checksum
│ │ │ └─────── Offset address (segment, multiplied by 16)
│ │ └───────── Record type "02" = extended address record
│ └───────────── Always "0000"
└─────────────── Always "02" for 2 bytes of data
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 17

4.2 Motorola hex format (Exorciser/Exormax)


────────────────────────────────────────────

Motorola Exorciser/Exormax data files may begin with an optional


sign-on record, this is not included in files generated by this
program.

Each data record begins with two start characters, either "S1" or
"S2". The third and fourth characters are the number of data bytes
in the record+3. For "S1" records, the next four characters are the
ROM address of the first data byte in the record. For "S2" records,
the next six characters are the address. The data bytes follow, each
byte represented by two hex digits (the number of data bytes is three
less than the byte count). Next is the checksum, which is the 1's
complement of the sum of the byte count, address and data bytes
before conversion to ASCII.

The end-of-file record begins with start characters "S9", the byte
count (always "03"), the address (always "0000") and the eof record
checksum.

Each record is terminated by carriage return/line feed characters.

Examples:

Up to 64K, Exorcisor "S1" records:

S1130000102030405060708090A0B0C0D0E0F0045<CR><LF>
S1130010FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0<CR><LF>
S1030000FC<CR><LF> eof record │ │
│ │ │ │ │ │
│ │ │ │ │ └─── Terminator cr/lf
│ │ │ │ └────── Checksum (2 digits)
│ │ │ └─── Data characters (2 per byte), or checksum if eof record
│ │ └─────── Address (4 digits, "0000" if eof record)
│ └───────── Byte count + 3 (2 digits, "00" if eof record)
└─────────── Start characters ("S1" if data record, "S9" if eof record)

Up to 16 megabytes, Exormax "S2" records:

S214000000102030405060708090A0B0C0D0E0F0045<CR><LF>
S214000010FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0<CR><LF>
│ │ │ │ │ │
│ │ │ │ │ └─── Terminator cr/lf
│ │ │ │ └────── Checksum (2 digits)
│ │ │ └─── Data characters (2 per byte)
│ │ └─────── Address (6 digits)
│ └───────── Byte count + 4 (2 digits)
└─────────── Start characters "S2"
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 18

4.3 Tektronix hex format


─────────────────────────

16-bit addresses
────────────────

Each record begins with a slash start character '/', followed by the
four digit address of the first data byte. Next is a 2-digit byte
count,
representing the number of data bytes in the record. The next 2 digits
are the checksum of the address and byte count. Data bytes follow, rep-
resented by pairs of hex digits. Following the data bytes is a checksum
of the data bytes only.

Checksums are the modulo-256 sum of the 4-bit binary values of each hex
digit to be checksummed.

The end-of-file record has an address and data byte count of 0.

Each record is terminated by carriage return/line feed characters.

Example:

/000010010102030405060708090A0B0C0D0E0F0045<CR><LF>
/00101002FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27<CR><LF>
/00000000<CR><LF> eof record │ │
││ │ │ │ │ │
││ │ │ │ │ └── Terminator cr/lf
││ │ │ │ └───── Data checksum (2
digits)
││ │ │ └───- Data characters (2 per byte)
││ │ └───────- Checksum of address and byte count
││ └─────────- Byte count (2 digits, "00" if eof record)
│└───────────- Address (4 digits, "0000" if eof record)
└───────────── Start character
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 19

Extended Tektronix format (any length address)


──────────────────────────────────────────────

Each record begins with a '%' start character, followed by a 2 digit


number of nibbles in the entire record (excluding the start character
only). Next is the record type (6 = data record), followed by a 2 digit
checksum of the entire record. The next digit is the length of the
address in nibbles (e.g. 3 if the address is 123), followed by the
address without leading zeros. The data bytes are next, represented by
pairs of hex digits.

The checksum is the modulo-256 sum of all the hex ASCII nibbles in the
record, excluding the '%' (and the checksum itself).

%3B6F7101234567812345678123456781234567812345678123456781224<CR><LF>
││ ││ │││
││ ││ ││└──── Data characters
││ ││ │└───── Address (1 nibble in this example)
││ ││ └────── Number of nibbles in address (1 nibble in this example)
││ │└──────── Checksum (2 digits)
││ └───────── Record type (6 = data record, 8 = end record)
│└─────────── Number of nibbles in record
└──────────── Start character '%'

%3E6274FFC01234567812345678123456781234567812345678123456781234<CR><LF>
││ │
│└──┴───── 4-digit address
└───────── Number of nibbles in address

The end-of-file record is type 8, with the same address as the FIRST
record in the file, and no data bytes:

%0A8404FFC0<CR><LF>
│ ││ ││
│ ││ │└────── Address - must be same as first record's address
│ ││ └─────── Number of nibbles in address
│ │└───────── Checksum (2 digits)
│ └────────── Record type (8 = end-of-file record)
└──────────── Number of nibbles in record
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 20

5. EPROM MEMORY CARDS AND EPROM TYPES


══════════════════════════════════════

These combinations of memory module and EPROM are valid:

┌───────────────┬───────────────┬──────────────────┬───────────────┬───────────┐
│ MEMORY SIZE │ EPROMs │ MEMORY MODULE │ PUBLIC MEMORY │ PCD TYPE │
╞═══════════════╪═══════════════╪══════════════════╪═══════════════╪═══════════╡
│ 64KB │ 2 x 27256 │ PCD6.R500 │ PCD6.R100 │ PCD6 │
│ (16K lines) │ 2 x 27256 │ PCD4/PCD7.R1xx │ - │ PCD4/6.M5 │
│ * = only half │ 2 x 27512 │ PCD7.R1xx │ - │ PCD4/6.M5 │
│ of 271001 is │ 2 x 271001 * │ PCD7.R1xx │ - │ PCD4/6.M5 │
│ accessible │ 1 x 271001 │ - │ - │ PCD1/PCD2 │
├───────────────┼───────────────┼──────────────────┼───────────────┼───────────┤
│ 128KB │ 4 x 27256 │ PCD6.R500 │ PCD6.R100 │ PCD6 │
│ (32K lines) │ 2 x 27512 │ PCD7.R1xx/.R300 │ - │ PCD4/6.M5 │
│ │ 2 x 271001 * │ PCD7.R1xx │ - │ PCD4/6.M5 │
│ │ 1 x 271001 │ - │ - │ PCD1 │
├───────────────┼───────────────┼──────────────────┼───────────────┼───────────┤
│ 256KB │ 8 x 27256 │ PCD6.R500 │ PCD6.R100 │ PCD6 │
│ (64K lines) │ 2 x 271001 │ PCD7.R1xx/.R300 │ - │ PCD4/6.M5 │
├───────────────┼───────────────┼──────────────────┼───────────────┼───────────┤
│ Up to 1MB │ 2, 4, 6 or 8 │ PCD6.R600 │ PCD6.R200 │ PCD6 │
│ (256K lines) │ x 271001 │ (mixed RAM/EPROM)│ │ │
└───────────────┴───────────────┴──────────────────┴───────────────┴───────────┘

NOTE: 271001 = 27010


* = Only half of 271001 is accessible.

5.1 PCD6.R500 for PCD6.M1/M2


─────────────────────────────

This memory card is only for PCD6 systems, it is plugged into the
PCD6.R1 public memory module. Either 2, 4 or 8 x 27256 EPROMs (max.
200nS, 12.5Vpp) can be used.

PCD6.R500 64K Bytes - 16K Code/64K Text - 2 x 27256 EPROMs


or 128K Bytes - 32K Code/128K Text - 4 x 27256 EPROMs
or 256K Bytes - 64K Code/256K Text - 8 x 27256 EPROMs

The EPROMs can be removed from the card and programmed individually,
or can be programmed while mounted on the R500 card by using the
PCD8.P71 switch box to select each EPROM (use EPROM type PCD6.R500).

*** NOTES ***

To program EPROMs mounted on the R500 card, select EPROM type


PCD6.R500. However, programming is much faster if the EPROMs are
removed from the R500 card, and are programmed individually.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 21

5.2 PCD6.R600 for PCD6.M1/M2


─────────────────────────────

This memory card plugs into the PCD6.R200 public memory module (it
won't work on the R100). Only 271001 pr 27010 (128K byte) EPROMs can
be used. It is also possible to have RAM on this card for extension
memory, containing writable Texts and Data Blocks, with read-only
Texts and Data Blocks being stored in EPROM.

256K bytes - 64K Code/256K Text - 2 x 271001 EPROMs


or 512K bytes - 128K Code/512K Text - 4 x 271001 EPROMs
or 768K bytes - 192K Code/768K Text - 6 x 271001 EPROMs
or 1024K bytes - 256K Code/1024K Text - 8 x 271001 EPROMs
(271001==27010)

*** NOTE ***

Remaining sockets can be filled with RAM chips to provide "extension


memory" containing Texts and Data Blocks 4000..7999. Data for
extension memory must be separately downloaded into the RAMs, using
the "Up/downloader" DOWNLOAD EXTENSION MEMORY operation, or "SDNLD
filename /X" from the DOS prompt. The extension memory segment itself
CANNOT be programmed into EPROM.

5.3 PCD4.R1xx for PCD4 and PCD6.M5


───────────────────────────────────

Holds 2 x 27256 EPROMs (max. 200nS, 12.5Vpp).

PCD4.R1 64K Bytes - 16K Code/64K Text - 2 x 27256 EPROMs

EPROMs must be removed from the card for programming.

5.4 PCD7.R1xx for PCD4


───────────────────────

Either 27256, 27512 or 271001 EPROMs can be used.

64K bytes - 16K Code/64K Text - 2 x 27256 EPROMs


or 128K bytes - 32K Code/128K Text - 2 x 27512 EPROMs
or 128K bytes - 32K Code/128K Text - 2 x 271001 EPROMs

EPROMs must be removed from the card for programming.

*** NOTES ***

At present, the PCD4 can address only 128K bytes of a 271001 EPROM.
The remaining 128K bytes in the pair of 128KB EPROMS cannot be
accessed. If over 64K bytes (16K code lines) is addressed in a
single 128KB EPROM, if hex files are produced then these cannot be
programmed using an EPROM programmer which supports only 16-bit
addresses in hex files.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 22

5.5 PCD7.R300 for PCD4 and PCD6.M5


───────────────────────────────────

Holds 2 x 27512 or 2 x 271001 EPROMs.

128K bytes - 32K Code/128K Text - 2 x 27512 EPROMs


or 256K bytes - 64K Code/256K Text - 2 x 271001 EPROMs

EPROMs must be removed from the card for programming.

5.6 PCD1 Memory


────────────────

The PCD1 accepts only one EPROM. Either a 64K byte (28-pin 27512) or
a 128K byte (32-pin 271001/27010) EPROM can be used. A jumper on the
main board selects EPROM or RAM, both EPROM types are pin-compatible.
If the smaller 28-pin 64K byte EPROM is used, this should be inserted
in the lower 28 pins of the 32-pin socket.
┌── Set jumper to
│ position 'E' to use
┌───o───┐ ┌──┐ and EPROM
32-pin EPROM (271001/27010) 1│. .│32 │:║│
2│. .│31 │:║│
┌───o───┐ └──┘
28-pin EPROM (27512) │ │ RE R = RAM
│ │ E = EPROM
│ │
│ │
│ │
└───────┘

5.7 PCD2 Memory


────────────────

The PCD2 accepts only one EPROM. Either a 64K byte (28-pin 27512) or
a 128K byte (32-pin 271001/27010) EPROM can be used. A jumper on the
main board selects EPROM or RAM, both EPROM types are pin-compatible.
If the smaller 28-pin 64K byte EPROM is used, this should be inserted
in the lower 28 pins of the 32-pin socket.

┌───o───┐
1│. .│32 32-pin EPROM (271001/27010)
Set the jumper to 2│. .│31
position "E" to ┌───o───┐
use an EPROM ──────┐ │ │ 28-pin EPROM (27512)
│ │ │
┌──┐ │ │
R = RAM │:║│ │ │
E = EPROM │:║│ │ │
└──┘ └───────┘
RE

If EPROM memory is used, then the 24K bytes of built-in RAM can be
used as extension memory, to contain writable Texts and Data Blocks.
NOTE: PCD2 revision M hardware supports a 512KB (4MBit) EPROM.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 23

5.8 EPROM Types


────────────────

The EPROM types which can be programmed are limited by the EPROM
programmer:

Type Size (bytes) P16 PGS49 PGS53


────────────────────────────────────────────────────────
PCD6.R500 64/128/256K yes yes yes
I27256 32K yes * yes yes
Q27256 32K no no yes
F27256 32K (21Vpp) yes * yes yes
I27512 64K no yes yes
Q27512 64K no no yes
27C1001 128K no no yes
27C1001A 128K no no yes
27C1001D 128K no no yes
Q27010 128K no yes yes
T27C010 128K no no yes
TC571000 128K no no yes
NMC27010 128K no no yes
4MBit 512KB no no no

(*) The PCA2.P16 uses a 21V programming pulse (Vpp), and type F27256
should normally be selected. However, the P16 can be modified
to supply a 12.5V programming pulse, so I27256 types can be
programmed.

EPROMs must have an access time of max. 200nS. Slower devices


(> 200nS) will NOT work reliably, but faster devices can can be used
(e.g. 150nS). The access time is often shown on the EPROM, for example
200ns is shown as "-20" or "-2" e.g. MNC27C256Q-20.

*** NOTES ***

EPROM type F27256 uses a 21V programming pulse, which will DAMAGE
12.5V EPROMs. Some 128K byte EPROMs have the "mask ROM" pinout, and
are not compatible with the PCD hardware, e.g. TC571001, 27C1000.

Different EPROM types have different Vcc and Vpp voltages during
programming. If the wrong voltages are applied because the wrong EPROM
type is selected the EPROM could be damaged or unreliably programmed,
but generally a +/- 0.25V difference is acceptable, providing the byte
programming time is not too short, e.g. don't program 2ms/byte devices
with a 100uS/byte algorithm.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 24

EPROM Types Continued


─────────────────────

I27256 32K bytes P16 PGS49 PGS53


Intelligent Programming (TM/INTEL)
Vpp=12.50V, Vcc=6.00V, 4 ms/byte
INTEL (P,N)27256, (P,N)87C256, TM(S/X)27(P/PC)256,
TS27C256(Q/P), MBM27256(X/W), MBM27C256A(W), Sign27C256,
HN4827256, HN27256(G/HG/AG/P/FP), SGS M27256,
ST27(C)256(P,FN), ST27256P, AT27(H,HC)256(L),
SEEQ(L/D,M/E)27(C)256, Micro 27(C,HC)256, CAT27HC256(L),
TMM27256(AD/ADI/BD/BDI), TMM24256B(P/F), TMM24256A(P/F),
TC57(H)256(D,AD), TC54256a(P/F), M5L27256K(-I), Sign.87C256,
M5M27(C)256(K/AK/P/FP), uPD27C256(AD/M), AM27(C)256,
uPD27256AC, uPD27C256(AC/G/K)

Q27256 32K bytes PGS53


Quick Pulse Programming (TM/INTEL)
Vpp=12.75V, Vcc=6.25V, 100us/byte
INTEL (P/N)27(C)256, (P/N)87C256, 87C257,
NMC27C256B(Q,QE,QM,CQ,N),
SGS M27C256B, AM27X256, Micro 27C256, TC57(H)256AD,
TC54256(AP/AF), TMM27(4)256B(D/DI/P/F), CAT27HC256L,
Sign.27C256(-IND,UV,OTP), ICT27CX256

F27256 32K bytes P16 PGS49 PGS53


QUICK PRO programming (TM/FUJITSU)
Vpp=21.00V, Vcc=6.00V, 2 ms/byte
FUJITSU MBM27C256, uPD27(C)256D, TC57256D

*** WARNING ***


21V programming pulse will damage 12.5Vpp EPROMs
Do NOT use for uPD27C256AD

I27512 64K bytes PGS49 PGS53


Intelligent Programming (TM/INTEL)
Vpp=12.50V, Vcc=6.00V, 4 ms/byte
INTEL (P)27512, MBM27C512, NMC27C512, AM27(C/X)512,
uPD27C512(D/K/C/G), Micro27C512, AT27C512, HN27512(G/P),
TMS27(P)C512, TMM27512(D/DI/AD/ADI), M5L27512K-I,
TC57512(AD/AP/AF), TMM24512(AP/AF/P/F), SGS M27512,
M5M27(C)512(AK/AK-I/P/FP/AP/AFP)

Q27512 64K bytes PGS53


Fast Programming (National Semiconductor)
Vpp=12.75V, Vcc=6.25V, 100 us/byte
NMC27C512A(Q,QE,QM,N), Intel(P/N)27C512, M27C512,
M5M27C512AK, Sign.27C512(U.V./O.T.P.), WS27C512L,
Micro27C512, TMM27512(AD/ADI), TC57512AD, TMM24512(AP/AF),
TC54512(AP/AF)

27C1001 128K bytes PGS53


Byte Programming (FUJITSU)
Vpp=12.5V, Vcc=6.00V, typ. 500 us/Byte
MBM 27C1001
Do NOT use for 27C1001A or 27C1001D
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 25

EPROM Types Continued


─────────────────────

27C1001A 128K bytes PGS53


High speed byte programming (NEC)
Vpp=12.5V, Vcc=6.5V, typ. 100 us/byte
NEC uPD27C1001A
Do NOT use for 27C1001 or uPD27C1001D

27C1001D 128K bytes PGS53


High speed byte programming (NEC)
Vpp=12.5V, Vcc=6.0V, 500 us/byte
NEC uPD27C1001D
Do NOT use for 27C1001 or uPD27C1001A

Q27010 128K bytes PGS49 PGS53


Quick-Pulse Programming (TM/INTEL)
Vpp=12.75V, Vcc=6.25V, 100 us/byte
INTEL 27(C)010, TC57(H)1000(D/AD), TC54(H)1000(P/F/AP,AF),
(ST/M)27C1001, AM27(C/X)010, WS27C010L, ICT27CX010

T27C010 128K bytes PGS53


Fast Programming (Texas Instruments)
Vpp=12.5V, Vcc=6.5V, 500 us/byte
TMS27(P)C010

TC571000 128K bytes PGS53


High Speed Programming
Vpp=12.75V, Vcc=6.25V, 100 us/byte
TOSHIBA TC571000

NMC27010 128K bytes PGS53


Fast Programming (National Semiconductor)
Vpp=12.5V, Vcc=6.00V, 500 us/byte
NMC27C010(Q,QE,QM)

PCD6.R500 64K, 128K or 256K bytes P16 PGS49 PGS53

PCD6 memory module containing 2, 4 or 8 EPROMs of type


27C256 above. The PCD8.P71 switchbox must be used to
select each EPROM.

4MBit 512K bytes (512 x 8 bits) none


4 megabit EPROMs (27C4001 etc) are not supported by SPROM.
However, SPROM will create HEX files which can be used with
programmers which support 4MBit EPROMs.
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 26

6. EPROM PROGRAMMERS
═════════════════════

Three drivers are provided with the current version of SPROM.

Drivers for almost any type of EPROM programmer can be added, the only
requirement is that it has an RS232 serial interface, which can be used
to select the EPROM type, and to read, write and blankcheck the EPROMs.
New drivers may be added if there is enough customer support...

6.1 ERTEC PGS49


────────────────

This programmer can program the PCD6.R500, I27256, F27256 or Q27010


EPROM types. To program the new 27010 EPROMs, an additional adaptor
is required, and the PGS49 may also need recent firmware. Although the
voltages are not exact, type Q27010 can also be used to successfully
program 27C1001 types.

To program the PCD6.R500 card directly, PGS49 firmware version 4.1 or


above is required.

The ERTEC programmer can be connected directly to the serial port on


the personal computer. It does not use any handshaking (RTS/CTS), it
automatically detects which connections are the transmit and receive
lines (pins 2 and 3), and automatically adjusts to the baud rate. No
special cables are required.

ERTEC can be contacted at: Ertec GmbH


St.Johann 10
D-8250 Erlangen
Germany
Tel: 09131 77000
Fax: 09131 77010

The UK supplier is: Hitex (UK) Ltd.


Sir William Lyons Road
Science Park
Coventry
CV4 7EZ
United Kingdom
Tel: 0203 692066
Fax: 0203 692131
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 27

6.2 ERTEC PGS53


────────────────

This programmer can program the full range of EPROM types, and also
has a "copy" socket which enables very fast EPROM duplication using
ERTEC's "PGS.EXE" software (supplied with the PGS53). SPROM uses only
the left-hand socket for programming EPROMs.

To use the PGS53, file "SPROM.TYP" must be in the PCD Programming


Utilities directory. This contains firmware which is loaded into the
PGS53 to configure it for each EPROM type.

The ERTEC PGS53 returns its own detailed error message texts, which
do not have error message numbers. See section 3.2.

*** IMPORTANT NOTE ***

Always wait at least 15 seconds after power-up before using the PGS53
(calibration time).

6.3 PCA2.P16
─────────────

This old SAIA PCA2.P16 programmer can be used to program only 27256
EPROMs. SAIA does not recommend this because its very slow - but it
can be used if nothing else is available. SPROM uses only the right-
hand "COPY" socket.

An unmodified PCA2.P16 uses a 21V programming pulse (Vpp), and type


F27256 should normally be selected. However, the P16 can be modified
to supply a 12.5V programming pulse, so I27256 types can be programmed.
For details of this modification, refer to the PCA2.P16 User's Manual.

The baud rate of the P16 should also be set to 9600 by setting the DIL
switches inside the unit, and the EPROM Programmer baud rate set to
9600 on the "Configure/Serial ports" menu. The faster speed decreases
the programming time.

*** WARNING ***

If the P16 is not modified, the 21V programming pulse will PERMANENTLY
DAMAGE 12.5 Vpp EPROMS. Once modified, the P16 CANNOT be used to
program EPROMs which require 21 Vpp.

The fast programming algorithm used by the P16 does not raise the
supply voltage (Vcc) to 6V, as is required by the algorithm, therfore
programming may not be as reliable as that done by the ERTEC machines.
(Using the slow algorithm would take 50 minutes to program 32KB!).
SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 28

PCA2.P16 Continued
──────────────────

The modification for 12.5 Vpp operation can take two forms:

1) Change the bias resistor R3 (3K6) to 2K as described in the


P16 documentation, or solder a 4K5 resistor in parallel with
it. If the voltage is not 12.5V +/- 0.1V, then experiment with
different resistors. Better still, connect a 10K variable
resistor across R3 and adjust it to produce exactly 12.5V.

NOTE: If this permanent modification is made, EPROMs which


require the 21V programming pulse CANNOT be programmed.

2) Use the 27256 LED driver output from the 74LS273, pin 12,
buffered via two spare inverter gates on a 7406, to drive a
DIL reed relay which, when activated, connects a 10K variable
resistor across R3. When the 27256 LED is lit, the programming
voltage should be adjusted for 12.5V +/- 0.1V. When not lit
(another EPROM type is selected), the programming voltage
will be the original 21V.

Modification 2 is preferable, because the P16 can still be used to


program old 21Vpp EPROMs from the PCA - modification 1 prevents the
P16 from programming anything but 12.5Vpp EPROMs.

NOTE: 12.5Vpp EPROMS can also be used on the PCA.


SPROM - SAIA PCD EPROM PROGRAMMING UTILITIES - Page 29

7. EXTENSION MEMORY INITIALIZATION SEGMENT


═══════════════════════════════════════════

Extension memory is in battery-backed RAM. If the battery is


replaced or loses its charge, then all Texts and Data Blocks in
extension memory (and the data they contain) may be lost, and the
PCD will execute a "BAD TEXT TABLE" halt.

To solve this problem, a compact image of extension memory is


programmed into an unused part of the "Text" segment. If extension
memory data is lost (or has not been downloaded), the initialization
segment is used to reconfigure extension memory.

The extension memory initialization segment contains the text or DB


numbers, their sizes, and the initialization data values from the
source files (.SRC). Initialization data can take up a large amount
of space. To reduce the size of the segment, do not put initialization
data in the source file, or use the $NOXINIT assembler directive to
prevent initialization data being stored in the segment, see SASM.DOC.

SPROM's /CX command line switch can also be used. If initialization


data is not present in the init segment, then it must be loaded by
using the "Up/download" menu's DOWNLOAD EXTENSION MEMORY command (or
with "SDNLD <filename> /X") before the program is run. Uninitialized
texts contain spaces, uninitialized data blocks contain zeros.

The text memory segment may not be large enough to hold the extension
memory initialization segment, and a "TEXT SEGMENT TOO SMALL" error
might occur. This must be corrected by increasing the text memory size
from the "Configure/Hardware and memory" (F2) menu to the size shown.
If not enough memory is available, one of the SPROM command line
switches described below can be used.

The extension memory initialization segment is produced by default,


but can be disabled using the "/NX" (No eXtension) command line
switch. Initialization data from the .SRC file can be excluded using
the "/CX" (Compact eXtension) switch, in this case only the text and
DB numbers and sizes are programmed into EPROM, and less text segment
memory is used.

For example:

SPROM Create a full extension memory init segment.


SPROM /NX Don't create the initialization segment.
SPROM /CX Create a compact initialization segment without
initialization data (only the format).

*** NOTE ***

A binary image of the extension memory initialization segment is


first created in temporary files named SPROM.$$n, where 'n' is the
CPU number 0..6. These are created in the TEMP directory, and are
deleted after use. (A hidden command line switch /$$ can be used to
prevent these files from being deleted, for testing purposes).

*** END SPROM.DOC ***


***********************************************************************
* *
* SRES - RESOURCE TABLE GENERATOR *
* FUNCTIONAL SPECIFICATION *
* FILENAME SRES.DOC *
* AUTHOR MATT HARVEY, SAIA AG *
* *
***********************************************************************

REVISION HISTORY
05-Jan-97 V2.1 No changes

21-Jun-96 V2.0 No changes

24-Apr-95 V1.9 No changes

09-Jun-93 V1.7
1) Don't list unused I/Os after the last I/O address
(graphical format) rounded up to the next 100 boundary.
This saves paper because most PCDs don't have 8192 I/Os.
2) Now processes elements which are referenced inside
encoded binary LAN texts (defined in $LAN..$ENDLAN).
3) Handles new TFR and CPBI instructions.

06-Dec-91 $154
1) LAN text processing updated.
2) Now handles '@' in STXT texts correctly (SWER 225).

10-Sep-91 $152
1) ST / TR lists now show incoming and outgoing ST/TR numbers.
2) Change "Fatal error 0" text.

05-Oct-90 V1.4
1) Data Blocks now listed.
2) Added "Error 23: Data block <n> multi-defined" and "Error 24:
Invalid data block number: <n>".
3) If a constant is not a valid floating point number, the
floating point value is left blank (was ?.??????).
4) More detail shown for Graphical representation (3.2):
. = not referenced and not defined
X = referenced via Index register (might not be defined)
N = defined but not referenced
U = directly referenced but undefined
D = defined and directly referenced
5) Initial Steps are now listed with Steps.

22-Nov-89 V1.3
1) Corrected problem with tab characters (bug in V1.2).
2) Now lists resources referenced in texts (SWMR 34).
3) Gives help if invoked with an incorrect command line from DOS.
4) Correct the sort order of 32-bit constants (bug in V1.2).
5) Now works faster, better file buffering.
6) Changed switches /L & /NL to /N & /NN, for Numeric, NoNumeric.
7) Changed switch /N /NN to /D /ND for Definition instructions.
22-Mar-88 V1.2
1) Allow '/' or '-' characters as switch delimiters (2.0).
2) Missing or invalid install data file is now a fatal
error. Add "fatal error 0: Improper installation".
Remove section 4.1 and Warning 1. Section 4.2 becomes
4.1, 4.3 becomes 4.2.
3) Registered Users name now appears on each page of the
Resource Table (3.0 and 6.0).

16-Sep-87 V1.0
1) Name of output file displayed at start of processing
(2.0).
2) Decimal, hexadecimal and floating point representations
of 32-bit constants now listed in table (3.1, 6.0)
3) The length of each code block is now listed (3.1, 6.0)
4) The length of each text is now listed (3.1, 6.0)
4) Better error detection (4.0), but certain errors are NOT
detected if the relevant pass is skipped (4.0).
5) New error messages (4.3).
6) Add example section (6.0).

10-aug-87 Update after review:


1) New switches added to allow selection of individual
elements, code block and/or special instructions in
resource table (2.0).
2) New switches added to control numeric and/or graphical
representation of the resource table (2.0).
3) Semaphore element added (3.1).
4) Special instructions now listed in resource table (3.1).
5) Indexed elements are listed in a separate group,
following the directly referenced elements (3.1).
6) Add description of graphical resource table represent-
ation (1.0 and 3.2).
7) Add "Fatal internal error" (4.2).
8) Add errors 14 and 15 (4.3).
9) New method of multi-pass processing to handle selection
of individual elements and improve speed when processing
smaller files (5.0).
04-Aug-87 Preliminary.
SRES - RESOURCE TABLE GENERATOR - Page 1

CONTENTS
========

PAGE

1. OVERVIEW 2

2. INVOCATION FROM DOS 3


2.1 Return Values 4

3. RESOURCE TABLE FORMAT (.RES File) 5


3.1 Numerical Representation 5
3.2 Graphical Representation 7

4. ERROR DETECTION AND RECOVERY 8


4.1 Fatal Errors 8
4.2 Recoverable Errors 10

5. HOW IT WORKS 12
5.1 Performance and Limitations 12

6. RESOURCE TABLE EXAMPLE 13


SRES - RESOURCE TABLE GENERATOR - Page 2

1. OVERVIEW
============

The resource table generator processes an absolute object file (.PCD or


.UPL), producing a resource table in a file (.RES) or on the printer.
The resource table is formatted according to the printer configuration.

The resource table is a list of all elements (inputs, outputs etc.),


constants and code blocks (COBs, PBs etc.) used in the program for a
single CPU. The resource table can be represented as a numerical list,
and/or it can be repesented graphically.

Resources can be referenced either by the operands of an instruction


or from within certain texts used for communications. SRES processes
all the instructions and all texts in a file.

The numerical representation consists of a list where elements,


constants and blocks are grouped by their type and sorted by number.
The line number, the mnemonic of the referencing instruction and a
read/write indicator, condition code or FB parameter number are shown
for each reference or definition.

The graphical representation shows a matrix for each element and block
type, with one position representing each element or block. If the
postion shows a character, then the element or block is used, if "."
then it is not used.

Refer to sections 3 and 6 for details of the resource table formats.

Functional Diagram
------------------

+--------+
| .RES |
+---->| file |
| | |
| +--------+
+--------+ ************ |
|.PCD or | * *------+
| .UPL |--------->* SRES * OR
| file | * *------+
+--------+ ************ |
| +++++++++++
| + .RES +
+---->+ to +
+ printer +
+++++++++++
SRES - RESOURCE TABLE GENERATOR - Page 3

2. INVOCATION FROM DOS


=======================

The resource table generator is invoked from DOS with the command:

SRES inputfile [outputfile] [switches]

Where:

inputfile The name of the .PCD or .UPL file to be processed.


The default extension is ".PCD".

[outputfile] The optional output file name. If not present, the


default output file name is the name of the input
file with default extension ".RES". The default
directory is the directory containing the input
file.

[switches] These are optional resource generator controls,


which may be upper or lower case, not necessarily
separated by spaces. Either the '/' or '-' character
can be used as the switch delimiter.
/P /NP Print the resource list, don't create a .RES file,
or create a .RES file, don't print it.
/G /NG Create graphical representation of resource table,
or no graphical representation.
/N /NN Create numeric representation of the resource table,
or don't create a numeric resource table.

Contents control switches: These allow or prevent


certain element or code block types from appearing
in the table:

/I /NI Input/outputs or no inputs/outputs.


/F /NF Flags or no flags.
/R /NR Registers or no registers.
/T /NT Timers and counters or no timers and counters.
/X /NX Texts and data blocks or no texts and data blocks.
/S /NS Semaphores or no semaphores.
/K /NK Constants or no constants.
/B /NB Code blocks or no code blocks.
/D /ND Definition instructions or no def'n instructions.
| |
| +----- OFF
+----------- ON

Default switches are "/NP/G/N/I/F/R/T/X/S/K/B/D", which


generates a .RES file with everything in it.

If one or more of the contents control switches is ON, then all


others default to OFF. For example "/I/D" lists only the input/
outputs and the definition instructions. If a switch is OFF,
all others default to ON, "/NI/ND" lists everything but the
inputs/outputs and definition instructions.

NOTE: If the switches are "/NG/NN" or "/NI/NF/NR/NT/NX/NS/NK/NB/ND",


no resource table is generated, any existing .RES file is
unaffected.

File names may contain an optional drive and path specification, for
example "A:\SOURCE\".
SRES - RESOURCE TABLE GENERATOR - Page 4

Invocation continued
--------------------

If SRES is invoked with an incorrect command line, a help text is


displayed.

Command line examples:

SRES CONTROL ; Generate list and graphical table of


; all elements

SRES CONTROL /NN ; Generate only graphical table of all


; elements

SRES CONTROL /I/NN ; Generate graphical table of inputs


; and outputs only

SRES CONTROL /NG/B/P ; Generate list of code blocks only, on


; the printer, no .RES file is created

Invocation example:

C:\>SRES CONTROL

SAIA PCD RESOURCE TABLE GENERATOR V1.7


Processing file: CONTROL.PCD
Creating file: CONTROL.RES

Resource table complete, 0 error(s)

C:\>_

2.1 Return Values


==================

SRES returns a value to DOS on exit. This value can be used by the
parent process or batch file (using the ERRORLEVEL parameter) which
invoked SRES.

0 Resource table complete, no errors.

1 Resource table complete, but non-fatal errors were


detected, see section 4.2.

2 A fatal error occurred, see section 4.1, the resource


table was not completed.

3 Aborted with Ctrl-C or Ctrl-Break, the condition of the


resource table is undefined.
SRES - RESOURCE TABLE GENERATOR - Page 5

3. RESOURCE TABLE FORMAT (.RES File)


=====================================

Each page of the Resource Table has two title lines, giving the module
name and its creation date and time, the creation date and time of
the Resource Table, the page number, and the Registered User name.

Refer to the examples in section 6.

3.1 Numeric Representation


---------------------------

Each element, constant and code block is grouped by type and sorted by
value.

Elements which are referenced indirectly via the index register are
grouped and sorted separately, and are listed after the directly
referenced elements. For indexed elements, the element description is
postfixed with an "x", for example "I|Ox" and "Fx".

Definition instructions are listed in a separate section. The mnemonic


of the instruction, the addresses where it appears and its operands
are listed.

Element, constant and code block types are as follows. When grouped
type, the following order is used (the same order is used for the
graphical representation).

Element types:

I|O Input or Output (share same address range)


F Flag
R Register
T|C Timer or Counter (share same address range)
TEXT Text
DB Data Block
SEMA Semaphore

Constant types:

K 13-bit constant, medium control code of 'K'


CONST 32-bit constants

Code block types:

COB Cyclic Organisation Block


XOB eXception Organisation Block
PB Program Block
FB Function Block
SB Sequential Block
IST Initial step
ST Step
TR Transition

Special instructions:

DEFTB Define timebase


DEFVM Define volatile memory
DEFWPR Define write protect in Run state
DEFWPH Define write protect in Halt state
DEFTC Define timer/counter partition
SRES - RESOURCE TABLE GENERATOR - Page 6

Numeric representation continued


--------------------------------

For each type, the following information is shown.

Element types:

- The element number.


- The address of each referencing instruction.
- The mnemonic of each referencing instruction.
- For texts, the text length.
- A read/write indicator, R=read, W=write. This indicates
if the element is read or written, and depends on which
operand of the instruction references the element.

Eg. 123 STH R


| | |
| | +------ Read/write indicator
| +------------- Mnemonic
+------------------- Address (program line number)

For elements appearing in Function Block parameter lists, the


CFB mnemonic, FB number and parameter number are shown, no
read/write indicator appears. Eg.

Eg. 699 CFB 0 1


| | | |
| | | +------ Parameter number
| | +---------- Function block number
| +------------- Mnemonic (always CFB)
+------------------- Address (program line number)

For elements referenced from Texts, the text number and


whether the element is read or written is shown:

eg. 123 TEXT R


| | |
| | +------ Read/write indicator
| +------------- Referenced from a text
+------------------- The text number

Constant types, these are separated into 13-bit (K) constants and
32-bit (CONST) constants.

- The constant number.


- The address of each referencing instruction.
- The mnemonic of each referencing instruction.
- All constants are read-only, the read/write indicator is
always R.
- For 32-bit constants, the decimal, hexadecimal and floating
point representations of the value are also shown.
SRES - RESOURCE TABLE GENERATOR - Page 7

Code block types:

- The code block number.


- The start and end address of the block.
- The length of the block in program lines.
- The address of each referencing instruction.
- The mnemonic of each referencing instruction.
- The condition code of each referencing instruction, where
applicable.
- For Steps (ST) and Transitions (TR), the incoming and
outgoing ST or TR numbers are shown.

XOBs cannot have referencing instructions, so these fields will


always be blank.

3.2 Graphical Representation


-----------------------------

Elements and code blocks are grouped by type, and are shown in a
matrix of up to 100 elements or blocks per line, in sub-groups of 10,
so that an individual element can be quickly located by its number.

Each element or block has a symbol:

. Not referenced and not defined

X Referenced via Index register (might not be defined)

N Not referenced but is defined

U Undefined but directly referenced

D Defined and directly referenced


SRES - RESOURCE TABLE GENERATOR - Page 8

4. ERROR DETECTION AND RECOVERY


================================

The input .PCD file is checked in some detail as it is processed:

- The structure of the .PCD or .UPL file is checked for the


following:

- Correct end of block instructions.


- Blocks within blocks.
- Multi-defined blocks and texts.
- Undefined blocks and texts.

- Its checksum is verified.


- Instruction opcodes must be valid.
- Medium control codes, condition codes and special codes must be
valid.
- Missing or unexpected operands.
- ALL operand values are checked.

4.1 Fatal Errors


-----------------

Fatal errors 4, 5, 6, and 7 may be preceded by the standard DOS


error prompt, for example:

Not ready error reading drive A


Abort, Retry, Ignore ? _

Other fatal errors are reported immediately, with no opportunity to


correct the problem.

All fatal errors cause the program to terminate, and return is made
to DOS or the invoking menu. After a fatal error, the .RES file or
printout will usually be either empty or not present.

Fatal Error 0: PCDSETUP.DAT not found or invalid

The configuration data file PCDSETUP.DAT should be in the PCD


directory. Refer to the installation instructions.

Fatal Error 1: No input file name

The command line must contain the name of the input .PCD or .UPL
file to be processed.

Fatal Error 2: Invalid file name: <file name>

The entered file name does not produce a valid DOS file name.

Fatal Error 3: Invalid switch: <switch>

See section 2 for the list of valid switches.


SRES - RESOURCE TABLE GENERATOR - Page 9

Fatal Errors continued


----------------------

Fatal Error 4: Printer not ready

/P switch used to print the resource table, but the printer is


not connected or powered off.

Fatal Error 5: Can't open file: <filename>

The file does not exist (if it's a .PCD or .UPL input file), or
the file cannot be opened for writing if it's a .RES output
file.

Fatal Error 6: Read error on file: <filename>

The input file cannot be correctly read.

Fatal Error 7: Write error on file: <filename>

The output file cannot be written. This usually means the


destination disk is full, not ready, or the destination file
is read-only.

Fatal Error 8: Invalid absolute object file: <filename>

The input .UPL or .PCD file contains an invalid header, invalid


code segment or its checksum is invalid.

Fatal Error 9: Out of memory

The personal computer does not contain enough memory to produce


the resource table. Try running SRES from the DOS prompt, or
use the switches to generate separate smaller tables for each
element type.

Fatal Internal Error: Line <n>: Reference: <ref>

An internal error was detected. The reference text indicates


the location of the error. If this error occurs, the reference
text and the circumstances of the error should be reported
immediately to SAIA Technical Support (attn. me), supplying
the PCD/UPL file.
SRES - RESOURCE TABLE GENERATOR - Page 10

4.2 Recoverable Errors


-----------------------

These do not prevent the creation of the resource table, but may affect
its content. If a recoverable error is detected, the bad program line
is ignored.

Errors 10 to 14 are detected during the first pass. The are listed at
the start of the resource table.

Errors 15 to 23 are detected when the relevant pass is processed. If


code blocks or texts are not processed ( /NB or /NX switches used ),
then these errors are not detected. Block or text not defined or
multi-defined errors (15, 17, 22 and 23) are listed immediately before
their referencing entries in the resource table.

These errors should never occur, since it is not possible to create an


invalid .PCD or .UPL file, although errors 13 to 22 may occur in an
uploaded .UPL file if the program was incorrectly edited using the
debugger SBUG. Errors 19..21 may also not be detected by the assembler.

The error messages are displayed on the console, and also appear in the
resource table. The number of errors found is also listed at the end
of the table, and as a sign-off message on the console:

Resource table complete, 6 error(s).

Each message indicates the program line number of the error.

These are the recoverable errors:

Error 10: Invalid opcode: Line <n>

This instruction cannot be processed because has an unknown


opcode.

Error 11: Invalid mc/sc/cc: Line <n>

The medium control code, condition code or special code is


invalid and cannot be processed.

Error 12: Invalid operand: Line <n>

The instructions operand is invalid, if it references an element


or code block it will not appear in the resource table.

Error 13: Missing operand: Line <n>

The instruction does not have enough operands. Any elements,


constants or code blocks referenced in the preceding operands
of the instruction will be in the resource table.

Error 14: Unexpected operand: Line <n>

A 'floating' operand, which is not referenced by any instruction


has been found, it is ignored.
SRES - RESOURCE TABLE GENERATOR - Page 11

Recoverable errors continued


----------------------------

Error 15: Multi-defined block: Line <n>

The code block at Line <n> has been defined more than once in
the same program, only the first definition is processed. This
can be caused in uploaded programs if another copy of the block
was loaded using the debugger's "File Load" command.

Error 16: Block structure error: Line <n>

Missing end of block, invalid end of block or block within


block.

Error 17: Text <n> multi-defined

Text <n> has been defined more than once in the same program,
only the first definition is processed. This can be caused in
uploaded programs if another copy of the text was loaded using
the debugger's "File Load ... tExt" command.

Error 18: Invalid text number: <n>

The text number is greater than 3999. This error can be caused
by corrupted text memory.

Error 19: Invalid SASI text: TEXT <n>


Error 20: Invalid LAN text: TEXT <n>
Error 21: Invalid STXT text: TEXT <n>

The text is invalid. This error occurs while SRES is processing


a text referenced by the SASI, STXT, LRXD and LTXD instructions.
These texts must have the correct format.

Error 22: <type> <n> not defined

Code block or text number <n> is referenced but not defined.


Where <type> can be COB, XOB, PB, FB, SB, ST, TR, TEXT or DB.

Error 23: Data block <n> multi-defined

Data block <n> has been defined more than once in the same
program. This can be caused in uploaded programs is a second
copy of the data block was downloaded using the debugger's
"File Load ... Db" command.

Error 24: Invalid data block number: <n>

The data block number is greater than 7999. This error can
be caused by corrupted data block memory.
SRES - RESOURCE TABLE GENERATOR - Page 12

5. HOW IT WORKS
================

The total number of elements, constants and code blocks may be very
large in a large program. This means that a large ammount of memory
would be required to hold a data structure containing information on
all the elements, constants and blocks in a large program.

To overcome this problem, without resorting to temporary work files,


the input file is processed several times (several passes). Each time
a different set of element types is processed and then written to the
output file or printer.

Elements are processed in the same order as they appear in the table.
The input file is processed in up to 4 passes. Less than 4 passes may
be done if a particular pass is not required.

On each pass, each program line is disassembled, using a simple (fast)


disassembler, and lists of the elements being processed are produced
in memory. At the end of the pass, the lists are sorted, formatted and
output to the .RES file or printer.

The input file is read in blocks of 32K bytes (8K instruction lines),
so if the file is less than 32K bytes in size, it will actually be read
only once, and not once each time it is processed. Most .PCD/.UPL files
are less than 32K bytes.

5.1 Performance and Limitations


--------------------------------

Certain instructions actually reference more than one element, where


one of the operands specifies a base address, and another operand may
specify a number of elements, or a fixed number of elements may be
used. In these cases, all referenced elements appear in the table, see
the BITI and DIGI instructions for an example. The exceptions to this
are the SHIU and SHID instructions. These instructions shift up or
down a block of registers. Only the first, last, and the next higher
or lower register appear in the table, intervening registers are not
listed.

The resource table generator is fast, although speed is dependent on


the content of the input file. On a 6MHz IBM AT, the speed is between
2500 and 7000 lines per minute for a complete resource table.

There is no limit to the size of the input file, up to the maximum


256K bytes.

The maximum number of references for any particular element or block


type is dependent on the ammout of available memory. With 512K memory,
and no other large memory-resident programs, over 10'000 references
to each element type or code blocks can easily be handled.

The run-time use of function block parameters inside function blocks


is not listed, function block parameters are not matched with their
references. For example, if FB 0 parameter 1 was Flag 0, wherever
parameter 1 is used within FB 0, the Flag 0 reference is NOT listed.
The only reference listed is where Flag 0 appears in the CFB 0
parameter list.
SRES - RESOURCE TABLE GENERATOR - Page 13

6. RESOURCE TABLE EXAMPLE


==========================
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 1
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

FLAGS - NUMERIC FORMAT

TYPE NUMBER ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

F 0 91 RES W 107 RES W 132 RES W 646 ORH R


661 STH R 685 STH R 1426 SET W 1429 SET W
1432 SET W 1435 SET W 1000 TEXT R
F 2 43 RES W 182 SET W 541 SET W 728 STH R
736 ANL R 1036 ANL R 1111 STH R 1117 ANL R
1338 STH R 1000 TEXT R
F 4 42 RES W 478 SET W 1033 ORH R 1139 ANL R
1145 ORH R
F 5 41 RES W 601 SET W 759 STH R 764 STH R
775 STH R 792 STH R 809 STH R 826 STH R
843 STH R 1032 STH R
F 6 1127 STL R
F 7 524 RES W 1049 STH R 1093 STH R 1381 SET W
F 9 286 RES W 820 STH R 1063 STH R 1096 ORH R
1401 SET W
F 10 533 RES W 1056 STH R 1094 ORH R 1392 SET W
F 11 44 RES W 854 STL R 860 STH R 1034 ORH R
1138 STL R 1144 STH R 1209 SET W
F 12 303 RES W 866 STH R 1218 SET W
F 13 309 RES W 871 STH R 1259 SET W
F 14 315 RES W 876 STH R 1273 SET W
F 15 321 RES W 881 STH R 1278 SET W
F 16 327 RES W 886 STH R 1286 SET W
F 18 333 RES W 891 STH R 1306 SET W
F 19 339 RES W 896 STH R 1314 SET W
F 20 345 RES W 901 STH R 1317 SET W
F 22 54 RES W 369 SET W 431 RES W 938 STH R
F 23 55 RES W 373 SET W 437 RES W 944 STH R
F 24 56 RES W 377 SET W 443 RES W 950 STH R
F 25 57 RES W 381 SET W 449 RES W 956 STH R
F 26 58 RES W 385 SET W 455 RES W 962 STH R
F 27 59 RES W 389 SET W 461 RES W 968 STH R
F 28 60 RES W 393 SET W 467 RES W 974 STH R
F 29 61 RES W 397 SET W 473 RES W 980 STH R
F 30 62 RES W 401 SET W 480 RES W 986 STH R
F 31 138 SET W 155 RES W 709 STH R
F 32 90 RES W 113 RES W 137 RES W 542 RES W
645 ORH R 670 STH R 694 STH R 1080 STH R
1095 ORH R 1343 SET W 1423 SET W
F 33 212 RES W 230 RES W 248 RES W 525 SET W
747 STH R 753 STH R 780 STH R 786 STH R
803 STH R 837 STH R
F 34 258 RES W 268 RES W 277 RES W 534 SET W
769 STH R 797 STH R 814 STH R 831 STH R
848 STH R
F 39 1097 OUT W 1098 STL R
F 40 125 RES W 626 STL R 632 STH R 1180 SET W
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 8
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

FLAGS - GRAPHICAL FORMAT

0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999
0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789

0000 D.D.DDDD.D DDDDDDD.DD D.DDDDDDDD DDDDD....D DDDDDDDDDD DDDDDDDDDD D......... .......... .......... ..........
0100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0200 D.D.DDDD.D DDDDDDD.DD D.DDDDDDDD DDDDD....D DDDDDDDDDD DDDDDDDDDD .......... .......... .......... ..........
0300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0400 D.D.DDDD.D DDDDDDD.DD D.DDDDDDDD DDDDD....D DDDDDDDDDD DDDDDDDDDD .......... .......... .......... ..........
0500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0600 D.D.DDDD.D DDDDDDD.DD D.DDDDDDDD DDDDD....D DDDDDDDDDD DDDDDDDDDD .......... .......... .......... ..........
0700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1000 DDDDDDDDDD DDDDDD.... .......... .......... .......... .......... D......... .......... .......... ..........
1100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
5000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
5100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
...
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 10
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

REGISTERS - NUMERIC FORMAT

TYPE NUMBER ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

R 10 1322 MUL W 1332 ADD R


R 11 1323 LD W 1329 SUB R
R 12 1328 BITI W 1330 SUB R
R 13 1331 SUB W 1333 ADD R
R 14 1334 ADD W
R 16 163 CFB 0 3 1191 CMP R 1220 CMP R 1225 CMP R
R 17 1196 CMP R 1230 CMP R 1235 CMP R
R 18 1201 CMP R 1240 CMP R 1245 CMP R
R 21 173 LD W 365 INC W 366 CMP R 370 CMP R
374 CMP R 378 CMP R 382 CMP R 386 CMP R
390 CMP R 394 CMP R 398 CMP R 1320 MUL R
R 22 207 SUB W 208 MOV R
R 23 225 SUB W 226 MOV R
R 24 243 SUB W 244 MOV R
R 26 210 MOV W 1192 CMP R 1231 CMP R 1241 CMP R
R 27 228 MOV W 1197 CMP R 1221 CMP R 1246 CMP R
R 28 246 MOV W 1202 CMP R 1226 CMP R 1236 CMP R
R 29 63 LD W 412 LD W 1376 CMP R 1380 INC W
1387 CMP R 1391 DEC W 1398 CMP R
R 60 145 RXC W 205 SUB R 223 SUB R 241 SUB R
507 RXC W 523 TXC W 532 TXC W 615 RXC W
1177 CMP R 1182 RXC W 1340 CMP R 1345 CMP R
1348 CMP R 1351 CMP R 1354 CMP R 1357 CMP R
1360 CMP R 1363 CMP R 1366 CMP R 1369 CMP R
1372 CMP R 1383 CMP R 1394 CMP R 1405 CMP R
1408 CMP R 1411 CMP R 1414 CMP R 1417 CMP R
R 210 2824 MUL W 2834 ADD R
R 211 2825 LD W 2831 SUB R
R 212 2830 BITI W 2832 SUB R
R 213 2833 SUB W 2835 ADD R
R 214 2836 ADD W
R 216 1665 CFB 0 3 2693 CMP R 2722 CMP R 2727 CMP R
R 217 2698 CMP R 2732 CMP R 2737 CMP R
R 218 2703 CMP R 2742 CMP R 2747 CMP R
R 221 1675 LD W 1867 INC W 1868 CMP R 1872 CMP R
1876 CMP R 1880 CMP R 1884 CMP R 1888 CMP R
1892 CMP R 1896 CMP R 1900 CMP R 2822 MUL R
R 222 1709 SUB W 1710 MOV R
R 223 1727 SUB W 1728 MOV R
R 224 1745 SUB W 1746 MOV R
R 226 1712 MOV W 2694 CMP R 2733 CMP R 2743 CMP R
R 227 1730 MOV W 2699 CMP R 2723 CMP R 2748 CMP R
R 228 1748 MOV W 2704 CMP R 2728 CMP R 2738 CMP R
R 229 1565 LD W 1914 LD W 2878 CMP R 2882 INC W
2889 CMP R 2893 DEC W 2900 CMP R
R 260 1647 RXC W 1707 SUB R 1725 SUB R 1743 SUB R
2009 RXC W 2025 TXC W 2034 TXC W 2117 RXC W
2679 CMP R 2684 RXC W 2842 CMP R 2847 CMP R
2850 CMP R 2853 CMP R 2856 CMP R 2859 CMP R
2862 CMP R 2865 CMP R 2868 CMP R 2871 CMP R
2874 CMP R 2885 CMP R 2896 CMP R 2907 CMP R
2910 CMP R 2913 CMP R 2916 CMP R 2919 CMP R
R 410 4230 MUL W 4240 ADD R
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 13
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

REGISTERS - GRAPHICAL FORMAT

0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999
0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789

0000 .......... DDDDD.DDD. .DDDD.DDDD .......... .......... .......... D......... .......... .......... ..........
0100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0200 .......... DDDDD.DDD. .DDDD.DDDD .......... .......... .......... D......... .......... .......... ..........
0300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0400 .......... DDDDD.DDD. .DDDD.DDDD .......... .......... .......... D......... .......... .......... ..........
0500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0600 .......... DDDDD.DDD. .DDDD.DDDD .......... .......... .......... D......... .......... .......... ..........
0700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1000 DDD....... DDDDDDDDD. D......... .......... .......... .......... D......... .......... .......... ..........
1100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
1900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
2900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
3900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
4000 .......... .......... .......... .......... .......... .......... .......... .......... .......... ......
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 16
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

TEXTS - NUMERIC FORMAT

TYPE NUMBER LEN ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

TEXT 0 1105 81 TXS R 1583 TXS R 2989 TXS R 4395 TXS R


TEXT 1 2 549 TXS R 1421 TXS R 2051 TXS R 2923 TXS R
3457 TXS R 4329 TXS R 4863 TXS R 5735 TXS R
TEXTx 10 883 98 TXSX R 1600 TXSX R 3006 TXSX R 4412 TXSX R
TEXT 11 932
TEXT 12 42
TEXT 13 819
TEXTx 20 620 121 TXSX R 1623 TXSX R 3029 TXSX R 4435 TXSX R
TEXT 21 524
TEXT 22 42
TEXT 23 571
TEXTx 30 246 176 TXSX R 1678 TXSX R 3084 TXSX R 4490 TXSX R
TEXT 31 235
TEXT 32 246
TEXT 33 237
TEXTx 40 153 1335 TXSX R
TEXT 41 152
TEXT 42 153
TEXT 43 150
TEXTx 50 178 479 TXSX R
TEXT 51 177
TEXT 52 219
TEXT 53 175
TEXTx 60 178 602 TXSX R
TEXT 61 177
TEXT 62 178
TEXT 63 176
TEXTx 110 17 181 TXSX R 1683 TXSX R 3089 TXSX R 4495 TXSX R
TEXT 111 15
TEXT 112 15
TEXT 113 13
TEXTx 120 17 430 TXSX R 1932 TXSX R 3338 TXSX R 4744 TXSX R
TEXT 121 15
TEXT 122 15
TEXT 123 13
TEXTx 130 17 436 TXSX R 1938 TXSX R 3344 TXSX R 4750 TXSX R
TEXT 131 15
TEXT 132 15
TEXT 133 13
TEXTx 140 17 442 TXSX R 1944 TXSX R 3350 TXSX R 4756 TXSX R
TEXT 141 15
TEXT 142 15
TEXT 143 13
TEXTx 150 17 448 TXSX R 1950 TXSX R 3356 TXSX R 4762 TXSX R
TEXT 151 15
TEXT 152 15
TEXT 153 13
TEXTx 160 17 454 TXSX R 1956 TXSX R 3362 TXSX R 4768 TXSX R
TEXT 161 15
TEXT 162 15
TEXT 163 13
TEXTx 170 17 460 TXSX R 1962 TXSX R 3368 TXSX R 4774 TXSX R
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 21
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

TEXTS - GRAPHICAL FORMAT

0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999
0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789

0000 DD........ XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... .......... .......... ..........
0100 .......... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD......
0200 XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... ..........
0300 .......... .......... .......... .......... XDDD...... XDDD...... XDDD...... .......... .......... ..........
0400 .......... .......... .......... .......... XDDD...... XDDD...... XDDD...... .......... .......... ..........
0500 .......... .......... .......... .......... XDDD...... XDDD...... XDDD...... .......... .......... ..........
0600 .......... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... ..........
0700 .......... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... ..........
0800 .......... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... XDDD...... ..........
0900 .......... .......... .......... .......... .......... .......... .......... .......... .......... .........D
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 22
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

CONSTANTS - NUMERIC FORMAT

TYPE NUMBER ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

K 0 1388 CMP R 2890 CMP R 4296 CMP R 5702 CMP R


K 2 367 CMP R 1869 CMP R 3275 CMP R 4681 CMP R
K 3 371 CMP R 1377 CMP R 1399 CMP R 1873 CMP R
2879 CMP R 2901 CMP R 3279 CMP R 4285 CMP R
4307 CMP R 4685 CMP R 5691 CMP R 5713 CMP R
K 4 375 CMP R 1877 CMP R 3283 CMP R 4689 CMP R
K 5 379 CMP R 1881 CMP R 3287 CMP R 4693 CMP R
K 6 383 CMP R 1885 CMP R 3291 CMP R 4697 CMP R
K 7 387 CMP R 1471 DIV R 1514 DIV R 1889 CMP R
3295 CMP R 4701 CMP R
K 8 391 CMP R 1384 CMP R 1893 CMP R 2886 CMP R
3299 CMP R 4292 CMP R 4705 CMP R 5698 CMP R
K 9 395 CMP R 1897 CMP R 3303 CMP R 4709 CMP R
K 10 399 CMP R 1491 DIV R 1901 CMP R 3307 CMP R
4713 CMP R
K 13 1395 CMP R 2897 CMP R 4303 CMP R 5709 CMP R
K 20 1321 MUL R 2823 MUL R 4229 MUL R 5635 MUL R
K 32 1178 CMP R 1341 CMP R 1406 CMP R 2680 CMP R
2843 CMP R 2908 CMP R 4086 CMP R 4249 CMP R
4314 CMP R 5492 CMP R 5655 CMP R 5720 CMP R
K 48 206 SUB R 224 SUB R 242 SUB R 1346 CMP R
1708 SUB R 1726 SUB R 1744 SUB R 2848 CMP R
3114 SUB R 3132 SUB R 3150 SUB R 4254 CMP R
4520 SUB R 4538 SUB R 4556 SUB R 5660 CMP R
K 49 1349 CMP R 2851 CMP R 4257 CMP R 5663 CMP R
K 50 1352 CMP R 2854 CMP R 4260 CMP R 5666 CMP R
K 51 1355 CMP R 2857 CMP R 4263 CMP R 5669 CMP R
K 52 1358 CMP R 2860 CMP R 4266 CMP R 5672 CMP R
K 53 1361 CMP R 2863 CMP R 4269 CMP R 5675 CMP R
K 54 1364 CMP R 2866 CMP R 4272 CMP R 5678 CMP R
K 55 1367 CMP R 2869 CMP R 4275 CMP R 5681 CMP R
K 56 1370 CMP R 2872 CMP R 4278 CMP R 5684 CMP R
K 57 1373 CMP R 2875 CMP R 4281 CMP R 5687 CMP R
K 100 1458 DIV R 1481 DIV R
K 211 1511 MUL R
K 2311 1465 MUL R
CONST 0 33 COB R 64 LD R 413 LD R 1535 COB R
00000000H 1566 LD R 1915 LD R 2941 COB R 2972 LD R
0.000000E+00 3321 LD R 4347 COB R 4378 LD R 4727 LD R
CONST 1 174 LD R 1676 LD R 3082 LD R 4488 LD R
00000001H
CONST 100 575 LD R 2077 LD R 3483 LD R 4889 LD R
00000064H
CONST -1644972479 567 LD R 1324 LD R 2069 LD R 2826 LD R
9DF3B641H 3475 LD R 4232 LD R 4881 LD R 5638 LD R
1.234000E+00
CONST 3000 83 LD R 100 LD R 123 LD R 166 LD R
00000BB8H 617 LD R 1585 LD R 1602 LD R 1625 LD R
1668 LD R 2119 LD R 2991 LD R 3008 LD R
3031 LD R 3074 LD R 3525 LD R 4397 LD R
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 24
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

CYCLIC ORGANISATION BLOCKS - NUMERIC FORMAT

TYPE NUMBER START END LENGTH ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

COB 0 32 36 5
COB 1 1534 1538 5
COB 2 2940 2944 5
COB 3 4346 4350 5

CYCLIC ORGANISATION BLOCKS - GRAPHICAL FORMAT

0000000000 111111
0123456789 012345

0000 DDDD...... ......

EXCLUSIVE ORGANISATION BLOCKS - NUMERIC FORMAT

TYPE NUMBER START END LENGTH

XOB 16 0 31 32

EXCLUSIVE ORGANISATION BLOCKS - GRAPHICAL FORMAT

0000000000 1111111111 2222222222 33


0123456789 0123456789 0123456789 01

0000 .......... ......D... .......... ..


*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 25
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

PROGRAM BLOCKS - NUMERIC FORMAT

TYPE NUMBER START END LENGTH ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

PB 1 1190 1318 129 285 CPB


PB 2 1319 1336 18 421 CPB
PB 3 1337 1403 67 517 CPB
PB 4 1404 1437 34 150 CPB
PB 11 2692 2820 129 1787 CPB
PB 12 2821 2838 18 1923 CPB
PB 13 2839 2905 67 2019 CPB
PB 14 2906 2939 34 1652 CPB
PB 21 4098 4226 129 3193 CPB
PB 22 4227 4244 18 3329 CPB
PB 23 4245 4311 67 3425 CPB
PB 24 4312 4345 34 3058 CPB
PB 31 5504 5632 129 4599 CPB
PB 32 5633 5650 18 4735 CPB
PB 33 5651 5717 67 4831 CPB
PB 34 5718 5751 34 4464 CPB
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 26
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

PROGRAM BLOCKS - GRAPHICAL FORMAT

0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999
0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789

0000 .DDDD..... .DDDD..... .DDDD..... .DDDD..... .......... .......... .......... .......... .......... ..........
0100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 27
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

FUNCTION BLOCKS - NUMERIC FORMAT

TYPE NUMBER START END LENGTH ADDR MNEMONIC ADDR MNEMONIC ADDR MNEMONIC

FB 0 1438 1533 96 160 CFB 1662 CFB 3068 CFB


4474 CFB
FB 1 1533 1625 93 164 CFB 1663 CFB 3048 CFB
4476 CFB
FB 2 1625 1740 116 168 CFB 1664 CFB 3098 CFB
4479 CFB
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 28
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

FUNCTION BLOCKS - GRAPHICAL FORMAT

0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999
0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789

0000 DDD....... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0100 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0200 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0300 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0400 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0500 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0600 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0700 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0800 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
0900 .......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
*** SAIA PCD RESOURCE TABLE V1.7 *** MODULE: SMIRKS.PCD ( 8-24-87 2:26p) PRODUCED: 9-17-87 11:08a PAGE 50
HOORAY HENRY AND CO. LTD, LAUGHABLE LANE, GIGGLESVILLE, BRITISH EMPIRE

SPECIAL INSTRUCTIONS - NUMERIC FORMAT

MNEMONIC ADDR OPERAND ADDR OPERAND ADDR OPERAND ADDR OPERAND

DEFTB 26 1
DEFVM 27 1000
DEFTC 25 100
DEFWPH 86 1234

Resource table complete, 0 error(s)

*** END SRES.DOC ***


************************************************************************
* *
* SVIEW - PCD PROGRAM VIEWER UTILITY *
* FUNCTIONAL SPECIFICATION *
* *
* FILENAME sview.doc *
* AUTHOR Matt Harvey, SAIA AG, Murten *
* *
************************************************************************

REVISION HISTORY
05-Jan-98 V2.1

21-Jun-96 V2.0

24-Apr-95 V1.9

18-Mar-95 $18B
1) Changed the command key for "coNnect" (N) to "cOnnect" (O)
to match SBUG's "cOnnect" command.

09-Jun-93 V1.7
1) New "Print to File" and "Print to Printer" commands. The
displayed code or structure can now be written to a file.
New section 5, "PRINT COMMAND".
2) Now has S-BUS and modem support.
- New "CoNnect" commands: "coNnect Cpu", "coNnect Sbus-
station".
- The title line now shows the connected S-BUS station if
connected to an S-BUS network.
3) "View structure" command changed to "sTructure".
4) Error messages re-numbered and several new errors added
(for S-BUS communications etc).
5) Supports the new TFR and CPBI instructions.
6) Add ERROR 50: PCD NOT CONNECTED TO COMx OR POWERED OFF

06-Dec-91 $154
1) Now has F1=Help.
2) Add errors 7 and 8.
3) "View structure" display now shows where nesting level errors
occurred with "=>".

03-Sep-91 $152
1) Add "cpU" command to select CPU 0 or 1 on a PCD4.
New section 6.4 and error messages 30, 31 and 32.
2) If PCD memory and .PCD file do not match, SVIEW is not
forced off line anymore, but ERROR 19 occurs when a block
is displayed (the block can still be displayed).

05-Nov-90 V1.4
1) Update PUT and GET instructions for X and DB types.
22-Nov-89 V1.3
1) More than one '.' allowed in a file name during entry (SWMR 7).
Add ERROR 9 to detect this.
2) SBs now displayed (SWMR 69).
Added "Sb" command to main menu.
"Structure" command changed to "View structure".
3) Now works in colour as defined in PCDCOLOR.DAT.
4) PG1 format instructions removed from code display.
5) Code display now shows Registers in decimal, hex and floating
point units on one screen, the "Units" command has been
removed.
6) Now correctly displays the refreshed value for operands
which do not have an MC.
7) Now doesn't interpret ST/TR parameter lists as Inputs and
Outputs (bug, V1.2 displayed a refreshed value for these!).
8) Now supports COM1, COM2, COM3 and COM4.
9) New help screens.
10) Code display now has a header line.
11) Better scrolling of refreshed elements if up/down arrow keys
used.

05-Dec-88 V1.2
1) Refreshed value of indexed element is now shown in brackets.

27-Jun-88 V1.1
1) Add Fatal Error 6 (6.1).

23-Mar-88 V1.0
Initial edit.
TABLE OF CONTENTS
=================

Page

1. INTRODUCTION . . . . . . . . . . . . . . . 1
1.1 Invocation from DOS . . . . . . . . . . 1

2. TOP LEVEL MENU . . . . . . . . . . . . . . 2

3. PROGRAM DISPLAY . . . . . . . . . . . . . 4

4. BLOCTEC STRUCTURE DISPLAY . . . . . . . . 6

5. PRINT COMMAND . . . . . . . . . . . . . . 7

6. LIMITATIONS . . . . . . . . . . . . . . . 8

7. ERRORS AND ERROR MESSAGES . . . . . . . . 9


7.1 Fatal Errors . . . . . . . . . . . . . . 9
7.2 General Errors . . . . . . . . . . . . . 10
7.3 Program Structure Errors . . . . . . . . 11
7.4 "Connect" Command and Comms Errors . . . 12
SVIEW - Page 1

1. INTRODUCTION
================

SVIEW is an interactive menu-driven program display (view) utility


for SAIA PCD programs. It processes a .PCD or .UPL absolute object
file, and provides the following facilities:

* Displays a list of all COBs, XOBs, PBs, FBs and SBs used in
the program.

* Displays the code of any COB, XOB, PB, FB or SB along with the
refreshed values of any Inputs, Outputs, Flags, Registers,
Timers and Counters referenced by the instructions.

* Displays the block structure of any COB. This is a graphical


picture the COB-SB-PB-FB calling structure of the program.
It indicates conditionally called PBs, FBs and SBs.

* Detects structure errors in a Bloctec program. Missing blocks,


block nesting too deep etc, see section 7.3.

* Allows any of the above displayed information to be printed to


the printer or to a file.

* Can select the CPU on a PCD4 system, and an S-BUS station if


connected to an S-BUS network.

1.1 Invocation from DOS


------------------------

SVIEW is invoked from DOS with this command:

SVIEW filename[.ext]

The file name (including the drive and path) is optional, and should
be the name of a valid PCD absolute object file. If the file name is
not supplied, the file is invalid or it can't be found, the user is
prompted to enter a file name by SVIEW. The default file name
extension is ".PCD".

SVIEW can also be invoked from the PCD Programming Utilities main
menu with "View program".

To use SVIEW on line, the CPU must be connected when SVIEW is first
run, SVIEW only checks that a PCD is connected when it starts up.
If a PCD is not connected, SVIEW remains off line even if a PCD is
subsequently connected. To go on line, exit SVIEW and restart it.
SVIEW - Page 2

2. TOP LEVEL MENU


==================

If a file name was not supplied on the command line, the user is first
prompted for the name of the file to be viewed. If the file was not
found, the entered file name is displayed and can be edited, or a new
file name can be entered.

When the cursor is in the filename entry field, pressing function key
F5 displays a window containing a list of all the ".PCD" files,
allowing a file name to be chosen. A mask may be entered into the
field before pressing F5, e.g. "*.UPL".

│ │
│ Program to view (.PCD or .UPL): __________________________________________ │
= =
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Enter name of file to view (F5=dir), press ENTER to execute, ESC to abort. │
└────────────────────────────────────────────────────────────────────────────────┘

If the file name has been entered and is a valid PCD absolute object
file, it is processed, and a list of all COBs, XOBs, PBs, FBs and SBs
is displayed. This forms the top level menu.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD PROGRAM VIEWER V2.1 Stn: 12 CPU: 0 Status: RUN Program: DEMO │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│╓─CYCLIC ORGANISATION BLOCKS (Cob)─────────────────────────────────────────────┐│
│║ 000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│╓─EXCEPTION ORGANISATION BLOCKS (Xob)──────────────────────────────────────────┐│
│║ 000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 ││
│║ 019 020 021 022 023 024 025 026 027 028 029 030 031 ││
│╚══════════════════════════════════════════════════════════════════════════════╛│
│╓─PROGRAM BLOCKS (Pb)──────────────────────────────────────────────────────────┐│
│║ 000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 ││
│║ 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 ││
│║ 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 ││
│║ 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 ││
│║ 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 ││
│║ 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 ││
│║ 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 ││
│║ 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 ││
│║ 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 ││
│║ 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 ││
│║ 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 ││
│║ 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 v│
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Cob Xob Pb Fb Sb sTructure cOnnect Quit │
│ F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘
SVIEW - Page 3

Top level menu continued


------------------------

The top line indicates the program name. If connected to a CPU, the
top line also indicates the CPU number, CPU status and S-BUS station
if connected to an S-BUS network. If not connected, the top line shows
the CPU status as "OFF LINE", and the CPU number is not present.

If no blocks of a particular type are present in the program, "None"


is displayed in the associated box.

If the CPU is connected, a check is made that the program in the CPU
and the program to be viewed are the same. If they are not, an error
message is displayed.

If the block list is larger than one screen full, this is indicated
by a bright and blinking down arrow at the bottom right of the screen.
The PGDN, PGUP, UP ARROW, DOWN ARROW, HOME or END keys can be used to
view the complete block list.

The prompt line indicates all the options:

Cob }
Xob } These commands selects a code block to be displayed
Pb } as source code, with refreshed operand values.
Fb }
Sb }

sTructure Selects a COB for the block structure display.

cOnnect Selects the CPU (0 or 1) on a PCD4 system, or the


S-BUS station if connected to an S-BUS network.

Quit Exits SVIEW, ESCape also exits.

F1 Function key F1 displays help.

The first (capital) letter of the option is the command letter. Press
this letter to select the option.

If Cob, Xob, Pb, Fb or Sb are selected, the user is first prompted to


enter the block number with one of these prompts, on line 24:

Enter COB number (0..15): _


Enter XOB number (0..31): _
Enter PB number (0..299): _
Enter FB number (0..999): _
Enter SB number (0..31): _

If the entered block number is valid, and the block exists, the code
is disassembled, and the code of the selected is displayed, see
section 3.

If "sTructure" is selected, the user is prompted to enter the number


of the desired COB. If the number is valid and the COB exists, the
Bloctec structure is built from the code and displayed, see section 4.
SVIEW - Page 4

3. PROGRAM DISPLAY
===================

This displays the disassembled source code of the selected code block.

If the CPU is on line, the contents of any elements referenced by


the operands of the instructions are displayed in reverse video, and
continually updated (refreshed). If the CPU is not in RUN, then the
refreshed data will not change.

If the code in memory does not match the code read from the .PCD file,
an error message is displayed, and the refreshed values will probably
be meaningless.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD PROGRAM VIEWER V2.1 Stn: 12 CPU: 0 Status: RUN Program: DEMO │
├────────────────────────────────────────────────────────────────────────────────┤
│ ADDS MNEMO MC OPERAND DECIMAL HEX FLOATING POINT │
├────────────────────────────────────────────────────────────────────────────────┤
│ 5119 PB 8 │
│ 5120 STH F 515 0 │
│ 5121 ORH F 516 1 │
│ 5122 ORH F 517 1 │
│ 5123 JR L 3 │
│ 5124 SET F 518 1 │
│ 5125 JR 59 │
│ 5126 RES F 518 1 │
│ 5127 SUB R 510 2000 000007D0H │
│ 5128 R 500 0 00000000H 0.000000E+00 │
│ 5129 R 511 67138320 04007310H │
│ 5130 MOV R 511 67138320 04007310H │
│ 5131 L 0 │
│ 5132 R 516 32768 00008000H │
│ 5133 L 0 │
│ 5134 IFP R 516 32768 00008000H │
│ 5135 0 │
│ 5136 FMUL R 516 32768 00008000H │
│ 5137 R 520 -527451838 E08FB942H 3.508772E+00 │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Print Quit │
│ Use PGUP, PGDN, ARROW, HOME or END to view. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

Register values are displayed in three units: decimal, hexadecimal


and floating point (if it's a valid floating point number). The
values of other elements are displayed only in decimal.

If the code is larger than one screen full, the PGUP, PGDN, HOME,
END and ARROW keys can be used to scroll the display.
SVIEW - Page 5

Program display continued


-------------------------

For indexed operands, the refreshed value shown is the value of the
base element only, and is shown in brackets.

The code for the block can be printed by pressing 'P' for "Print",
see section 5. It is printed WITHOUT the refreshed element values.
These can be printed using the DOS "print screen" function, by
pressing Shift+PrtSc.

'H' for "Help" displays the Program Display help screen, 'Q' for
"Quit" (or ESCape) returns to the top level screen.
SVIEW - Page 6

4. BLOCTEC STRUCTURE DISPLAY


=============================

This shows the calling sequence of PBs, FBs and SBs. Blocks which are
called conditionally are indicated by the ¤ character, which looks
like a switch.

┌────────────────────────────────────────────────────────────────────────────────┐
│ SAIA PCD PROGRAM VIEWER V2.1 Stn: 12 CPU: 0 Status: RUN Program: DEMO │
├────────────────────────────────────────────────────────────────────────────────┤
│ │
│ COB001─┬¤PB017─┬─FB200 │
│ │ └─PB018─┬─FB200 │
│ │ └─PB019─┬─FB200 │
│ │ └─PB020─┬─FB200 │
│ │ └─PB021─┬─FB200 │
│ │ └─PB022─┬─FB200 │
│ │ └─PB023=> │ <-- Nesting
│ └¤PB025─┬¤PB026─┬¤PB027─┬¤PB028─┬¤PB029─┬¤PB030─┬¤PB031 │ error
│ │ │ │ │ │ └¤PB041 │
│ │ │ │ │ └¤PB040─┬¤PB031 │
│ │ │ │ │ └¤PB041 │
│ │ │ │ └¤PB039─┬¤PB030─┬¤PB031 │
│ │ │ │ │ └¤PB041 │
│ │ │ │ └¤PB040─┬¤PB031 │
│ │ │ │ └¤PB041 │
│ │ │ └¤PB038─┬¤PB029─┬¤PB030─┬¤PB031 │
│ │ │ │ │ └¤PB041 │
│ │ │ │ └¤PB040─┬¤PB031 │
│ │ │ │ └¤PB041 │
│ │ │ └¤PB039─┬¤PB030─┬¤PB031 │
│ │
├────────────────────────────────────────────────────────────────────────────────┤
│ Print Quit │
│ Use PGUP, PGDN, ARROW, HOME or END to view. F1=Help │
└────────────────────────────────────────────────────────────────────────────────┘

The structure can be printed using the "Print" command, as for the
Program display, see section 5.

If the structure is larger than one screen full, the PGUP, PGDN,
HOME, END and ARROW keys can be used to scroll the display.

'H' for "Help" displays the Bloctec Structure Help screen, 'Q' for
"Quit" (or ESCape) returns to the top level screen.
SVIEW - Page 7

5. PRINT COMMAND
=================

"Print to Printer"

Sends the displayed block or structure to the standard printer. If


the printer is off-line, an error message is displayed. The form-feed
control on the printer should be used to select a new page, if
required.

"Print to File"

Writes the displayed block or structure to a disk file. The user is


prompted to enter the name of the destination file.

*** NOTE ***

If the printer has been defined as "IBM compatible" on the "Configure/


Printer" menu, then it is printed using the same graphics characters
as shown on the screen (─┬¤ etc). If not IBM compatible, then the
standard ASCII characters are used ( + - |, and * to indicate a
conditionally called block).
SVIEW - Page 8

6. LIMITATIONS
===============

General:

* If the CPU status changes (Halts, is powered off, disconnected


etc.), this is not detected by SVIEW unless refreshing the
operand values of a displayed block. The CPU is not polled.

Program Display:

* There is no indication that the code displayed on the screen


is actually being executed. The refreshed element values may
be being changed by other parts of the program.

* For indexed elements, only the value of the base element is


shown, in brackets.

* Disassembly errors are ignored. It is almost impossible to


create a PCD file containing disassembly errors anyway.

* Each time a block is selected, the code is read from the


file and disassembled into memory before display. This may
take a few seconds if the block is very large.

* Code that exists outside of a block cannot be displayed, and


no errors are generated. Such code is illegal, and can never
be executed by the CPU. It is not possible to create a program
containing "floating" code, unless the Debug program has been
used to incorrectly edit the code, which has then been uploaded.
The disassembler (SDISASM) will detect such code, and issue
detailed error messages.

* If the code in the PCD does not match the code read from the
file, an error message is displayed, and the refreshed values
may be meaningless.

Bloctec Structure Display:

* The on-line highlighting of blocks which are being executed is


not yet implemented.
SVIEW - Page 9

7. ERRORS AND ERROR MESSAGES


=============================

All error messages are displayed left justified on line 23, in bold
video. All are accompanied by a long "beep". Error messages are
cleared from the screen on the next key depression.

7.1 Fatal Errors


-----------------

If a fatal error occurs, SVIEW must be aborted. The following prompt


is displayed:

CAN'T CONTINUE: Press any key to exit _

When any key is pressed, SVIEW is exited.

FATAL ERROR 1: PCDSETUP.DAT NOT FOUND OR INVALID

The configuration data file PCDSETUP.DAT should be in the PCD


Programming Utilities directory or the current directory, and
must be the correct version.

FATAL ERROR 2: PROGRAM NOT LICENSED

The configuration file does not support this program. Ensure


the correct PCDSETUP.DAT file from the distribution diskette is
used.

FATAL ERROR 3: INVALID ABSOLUTE OBJECT FILE: <filename>

The input file is not a valid PCD absolute object file. SVIEW
must be exited, and invoked again with a valid file.

FATAL ERROR 4: READ ERROR ON FILE: <filename>

The input file is corrupted and cannot be processed. Re-create


the input file using the Uploader or Linker.

FATAL ERROR 5: OUT OF MEMORY

There is not enough memory remaining to run SVIEW. Try using the
/X switch when invoking the main PCD menus ("PCD /X"), so that
extended or expanded memory can be used. Or remove any memory
resident programs such as SHELP or RAM disks, and try again.

FATAL ERROR 6: TOO MANY CALLS

There are more than 32767 block call instructions (CPB, CFB etc)
in the program. SVIEW cannot handle so many. This should never
occur!

FATAL INTERNAL ERROR: REFERENCE <description>

SVIEW has detected an internal run-time error. Report the


description and exact circumstances to SAIA Technical Support
immediately, supplying the input file.
SVIEW - Page 10

7.2 General Errors


-------------------

ERROR 10: INVALID FILE NAME: <filename>

The supplied file name is not a valid DOS file name, or is


a device name (e.g. PRN or AUX). Enter a valid file name.

ERROR 11: TOO MANY COMMAND LINE PARAMETERS

More than one file name was present on the command line.

ERROR 12: UNEXPECTED SWITCH: <switch>

SVIEW does not use any switches. The file name must be
re-entered.

ERROR 13: CAN'T OPEN FILE: <filename>

The input file does not exist. Correct the file name.

ERROR 14: NO FILENAME ENTERED

A PCD file name must be entered before it can be viewed!

ERROR 15: PCD MEMORY AND FILE DO NOT MATCH

The program loaded in the connected CPU's memory, and the


program loaded by SVIEW are not the same. The refreshed
operand values may be meaningless. This error will also occur
if a changed block has been downloaded using Debug, although
the code in the file does match the code in the downloaded
block - because the downloaded block will not be at the same
address as it is in the PCD file.

ERROR 16: INVALID NUMBER

An invalid block number was entered. Re-enter a valid number.

ERROR 17: BLOCK DOES NOT EXIST

The block whose number has just been entered does not exist
in the loaded program. Re-enter the number of a block that
does exist.

ERROR 18: PRINTER NOT READY

The printer is off-line, not connected or powered off.


Enable the printer and execute the Print command again.

ERROR 19: WRONG HELP FILE VERSION: SVIEW.HLP


ERROR 20: INVALID HELP FILE FORMAT: SVIEW.HLP

The help file "SVIEW.HLP" is for an old version of SVIEW.


Delete it and copy the latest version from the distribution
diskette.

ERROR 21: WRITE ERROR ON FILE: <filename>

Usually caused by a write protected or full disk.


SVIEW - Page 11

7.3 Program Structure Errors


-----------------------------

These errors are detected when processing the file. Each error lists
the user program line number "n" of the error and the block where it
occurred. These errors are recoverable, the program or bloctec
structure can be displayed, even if errors are detected, but it may
not be correct.

If more than one error occurs, the messages are scrolled up the screen.

Once all errors have been detected, a prompt "Press any key to
continue"
is displayed. The depression of any key clears the error messages and
displays the program or bloctec structure.

<block> is the block type and number. Eg. "FB 12", "PB 123".
<statement> is a block call or end of block instruction. Eg. "CFB 0",
"ECOB".

ERROR 30: LINE n: MISSING END OF BLOCK IN <block>

A start of block instruction has been found without there


having been a closing end of block statement for the
preceding block. Or, the end of the PCD file has been
reached without finding the end of block statement.

ERROR 31: LINE n: WRONG END OF BLOCK STATEMENT IN <block>: <statement>

The end of block instruction does not match the block opening
instruction. For example: FB 0 .. ECOB.

ERROR 32: LINE n: INVALID BLOCK NUMBER: <block>

A block call or open instruction contains an impossible block


number. For example, "CPB 1000", where the largest program
block number allowed is 299. This error will noramlly never
occur.

ERROR 33: LINE n: UNEXPECTED END OF BLOCK: <statement>

The end of block statement is not related to any block


opening statement.

The program line number is not given with the next two errors because
it is not used by the recursive algorithm which generates the bloctec
structure, and is not available.

ERROR 34: BLOCK DOES NOT EXIST: <block>

A block has been called which does not exit in the program.

ERROR 35: MORE THAN 7 NESTED CALLS AT <block>: <called block>

The number of nested calls (subroutine levels) cannot


exceed 7. Indicated by "=>" on the structure display.
SVIEW - Page 12

7.4 "Connect" Command and Communications Errors


------------------------------------------------

ERROR 40: THIS COMMAND IS ONLY FOR PCD4

The "cOnnect" command can select CPU 0 or CPU 1 only on a


PCD4. For the PCD6, the PCD8.P800 comms interface must be
physically connected to the correct CPU. The PCD2 and PCD6.M5
have only one CPU.

ERROR 41: CPU n NOT PRESENT

CPU n does not exist in the PCD system and cannot be


selected.

ERROR 42: NO RESPONSE FROM PCD

Check that the PCD or P800 are properly connected to the


correct serial port, and the correct baud rates and protocols
are selected. See the "Configure/Serial ports" menu. This can
also occur if a SASI instruction has been executed which re-
assigns the PGU port.

ERROR 43: SERIAL PORT COMn NOT PRESENT

The serial port (COM1..COM4) selected for the PCD connection


cannot be used. Select another port from the "Configure/
Serial ports" menu.

ERROR 44: COMMUNICATIONS ERROR (PARITY, FRAMING OR OVERRUN)

Usually caused by incompatible baud rates or comms protocols.

ERROR 45: INVALID RESPONSE FROM PCD

This can occur if the PCD or PCD8.P800 contains old firmware,


or the protocol or baud rate is invalid.

ERROR 46: BAD CONNECTION BETWEEN P800 AND PCD6

Caused by dirty or damaged connector pins. Power off the


PCD6,
unplug the PCD8.P800, check it's clean, then re-connect it.

ERROR 47: NO RESPONSE FROM S-BUS STATION n

Connection cannot be made to this station. Check the PCD is


powered on, connected to the S-BUS network, and correctly
configured for S-BUS.

ERROR 48: COMMAND NOT ACCEPTED BY PCD (NAK RESPONSE)

The connected CPU cannot execute the command. This normally


occurs only if connected via an interface which has been
configured to support LEVEL 1 S-BUS or P800 protocol (e.g.
MODE SD0 or SS1).

ERROR 49: NOT USING S-BUS PROTOCOL

This command is only valid if connected using S-BUS


communications.
SVIEW - Page 13

ERROR 50: PCD NOT CONNECTED TO COMx OR POWERED OFF

Occurs when P800 mode is selected, and the PCD is not


returning the CTS (RDYOUT) signal.

*** END SVIEW.DOC ***

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy