Journal Articles

CVu Journal Vol 1, #3 - Feb 1988
Browse in : All > Journals > CVu > 013 (15)

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: The OS-9/68000(tm) Upgrade for the Atari ST(tm)

Author: Martin Moene

Date: 28 June 2010 08:57:00 +01:00 or Mon, 28 June 2010 08:57:00 +01:00

Summary: 

Body: 

Intoduction

To follow up their "OS-9/68000 Upgrade for the BBC" Cumana have brought out the "OS-9/68000 V2.1 Upgrade for the Atari ST". Like Swifte's Mirage Operating System it provides multi-tasking on the Atari ST and Mega-ST without graphics (ED - GKS Level 0a is currently available for OS-9, and Level 2c is "in the works". The Mirage standard terminal driver has some limited support for line graphics). Unlike Mirage, OS-9 comes as an all in one package, however, this means a larger initial cost.

The package includes a cartridge with a boot ROM and real time clock, plus several disks (how many depends on your disk capacity) on which come:

The disks are not copy protected, however, all but one are in OS-9 format and OS-9 will not run without the cartridge.

With the package come three A5 ring binders containing the manuals which, at four inches thick, means you have some reading before you can use all the software. There is an optional Technical Reference Manual, which is a must for 'serious' (ie. systems) programming. I shall cover each piece of software in turn.

The Operating System

History

OS-9/68000 is a multi-tasking, multi-user operating system developed for Motorola by Microware Systems from Iowa. The original OS-9 was developed for the 6809 processor. The design was based on Unix(tm), it exploited the ability of the 6809 to run re-entrant position independent code to give multi-tasking in 64K-2M. The 64K version was ported onto the Tandy Color Computer and the Dragon where it has developed a loyal band of followers. Naturally when the 68000 was announced Microware was commisioned to implement OS-9 for it, with the greater processor power and memory further steps were made towards Unix compatibility and the current version (V2.1) which is provided by Cumana contains most of the features found in Unix.

Internals

There are several concepts built into OS-9 which contribute to it being a Unixlike programming environment, they also help to explain why OS-9 is not exactly like Unix.

Memory Management

OS-9 manages memory by the use of 'memory modules'. No program or constant data can be loaded into memory unless it is in OS-9's module format. This format is, roughly, a header containing control information, the module contents (program and/or data) then a CRC which is used to spot overwrites etc.

One of the pieces of information that can be taken from the header is the module name, using this OS-9 keeps a directory of all the modules currently loaded into memory. All modules are re-entrant (they do not modify themselves) and the program's data (like GEMDOS BSS) area is not allocated contiguously.

OS-9's modular system means that it can make efficient use of the memory available when multitasking. No matter how many times you have a program running, at the same moment, only one copy of the program is loaded. It also permits two rather nice features of OS-9.

The first is the 'sticky' module; normally a module is only kept in the directory whilst it is being run by at least one process, with sticky modules the module is kept in the directory until the memory is needed. Most of the commands are 'sticky' modules and as such it is rather like having a large and fast disk cache.

The second nice feature is the 'user trap handler'; OS-9 uses the 68000 TRAP #0 instruction for its system calls, the other TRAP numbers are free for 'user trap handlers'. A user trap handler is a module which can be linked by a task to allow access to commonly used functions called by means of a trap call.

An example of this is the 'math' module on the ST; this contains the support code for all the common floating point and character conversion routines, the 'C' and Pascal compilers optionally generate code which uses this trap handler. Of course this saves memory, but more importantly it allows the math module to be changed without recompiling code, so an add-on floating point processor can be used with the change of just one module.

I/O

Like Unix OS-9 has a unified i/o system, all files and devices are treated as a stream of bytes. OS-9 divides devices into 'classes' within which they have similar function, each class is managed by a 'file manager' module (q.v.). There are five file managers available from Microware, RBF (Random Block File == disk manager), SCF (Sequential Character File == terminals, printers, modems), SBF (Sequential Block File == Tape streamers etc), Pipe (Unix like pipes), and lastly NFM (Network File Manager). The Upgrade comes with SCF, RBF and PIPE.

SCF is used for the ST console, RS232, printer and Midi ports. It provides line editing, one line retrieval, XON/XOFF etc. The ST console driver has been writtem for alpha only and is consequently fast. The keys are user defineable, the mouse can be enabled (it behaves as the cursor keys), and in monochrome a 50 line mode is available.

RBF is used for floppy, hard and RAM disks. The floppy driver allows you to define step rate and a variable sized RAM cache. The hard disk device driver uses multiple sector transfer to get speed as opposed to a cache. The RAM disk can be configured to be from 64 to 512k.

Disks have a Unix-like hierarchial directory structure (though no 'links'), filenames can be up to twenty eight (yes, 28 characters) long. File access control is similar to Unix though for compatability (with OS-9/6809) reasons only group and public permissions are implemented. Unlike Unix a sudden power down of the machine will not damage the file structure. One 'quirk' is that their is no 'root' ("/") device because each device has to have a name, so absolute paths have the form:

/<device>[/<dir>].../<filename>

For example '/h0/sys/termcap' is the absolute path to the system 'termcap' database file. This could cause difficulties with directories for '.h' files etc. However, there is a 'system default drive' ('/dd') which you can define as a duplicate to be the internal floppy, RAM or hard disk where such files are assumed to be kept.

Needless to say the OS-9 format is not compatible with the GEMDOS format, unhappily at the moment no utility is provided to access GEMDOS disks, though I am told one is due later this year. Furthermore the 'standard' OS-9 formats are either all single density or single density on track 0; as you may be aware the ST is unable to read or write in single density. However, the format used is identical with that used by the Color Computer and Dragon so many OS-9 suppliers are equipped to provide software in this format, if not (or if you're an existing OS-9 user) Cumana offer a copying service.

OS-9 PIPEs are true Unix-like pipes, both unnamed and named pipes are available, their is a slight difference from Unix in that they are by default only 90 bytes size, however, this default can be customised and can be changed to any size by the 'opener' of a pipe.

Although SBF and NFM are not supplied by Cumana, you can buy them from Microware (or their UK Agents Vivaway) and provided you are willing to resort to machine code both tape streamers and Networking are possible.

Signals and Events

These are two more ways of communicating between processes. Signals are the familiar Unix mechanism of 'interrupting' a task. The nearest equivalent to events is semaphores.

Commands

Like Unix the 'shell' (command interpreter) is just another program. In fact most of the commands are not built into the shell but are seperate programs in their own right.

The familiar '$' prompt belies the fact that despite the 'it is very similar to UNIX in operation and appearance to the user' claim this is most certainly NOT Unix. The command set is a subset of Unix (no lexx or yacc) and the names of the common commands are not the same, for example the command to list a directory is 'dir' not 'ls', and the command to change data directory is 'chd' not 'cd'.

There is no 'batch' language, the shell will execute files as though they were a list of commands typed in at the terminal but there is no support for flow control. Some support for command line parameters is built into a utility called 'cfp' (command file processor) but it is very limited. You do get I/O redirection though you can only redirect the three standard I/O paths. They are refered to as   '<'   '>'   '>>'   (stdin, out and err respectively), append to and delete before are obtained by using  '+'  and  '-'  so  '>>-listing'  appends the stderr output to the file 'listing'. Wild cards are limited to '*' and '?'. Having said this, the source to some Unix like commands are available from the CUG(UK) library, and you could port a Unix shell to OS-9 with ALL its features.

Performance

Whilst the system commands for OS-9 were written in 'C' the actual operating system itself was hand-coded in assembler. As a consequence of this and the fact that OS-9 does not page memory the performance of an OS-9 system is far better than a Unix system running on the same machine (infact Unix wouldn't run on a floppy on system as OS-9 does).

Macro Assembler/Linker/Debugger

Assembler

This is a competent conditional macro assembler (though as is usual it doesn't support ATV's). Two special directives PSECT and VSECT are supported so that the assembler can generate files suitable for the linker to build into OS-9 module format (q.v.).

Linker

A linker, it doesn't require you to write a control file first (as does the GST Linker, under GEMDOS). Also its documentation has the decency to tell you the format of the input file, so if you really wanted you could write your own linker for a target system. The '-g' option causes a symbol table module to be generated as well as the output module, this is used by the debugger.

User-state Debugger

This is called the user-state debugger because Microware also have the system- state debugger, the difference is that the user state debugger is for 'normal' programs and all other operations carry on in the background as usual. The system state debugger is for developing system code and when this debugger waits for input so does the whole system.

The user-state debugger allows debugging of a program with, providing the symbol table module is available, access to all the global variables. Not only can you set breakpoints and change memory values, you are able to 'trace' execution seeing each instruction as it executes or execute a number of instructions at a time. All this happens without the rest of the system being affected because of the operating system's support for a process running in a 'debug' state. Whilst there is no macro facility it is a very useable debugger with suitably brief commands.

C Compiler

The OS-9 implementation of Microware 'C' is included in the upgrade, this is the current version. The C is a full K&R implementation with one restriction, bit fields within structs and unions are not supported. Microware have stated that they intend to implement this in a future release.

Some of the ANSI extensions have been added (enum and some of the functions), though void is currently #define'd to int. A full set of termcap access functions have also been added. The preprocessor directive #if xxxx is supported, so is in line assembler with #asm (though there is a strong warning in the manual). The preprocessor also supports multiline macros.

Because OS-9 code has to be position independent the amount of static data that can be referenced is limited by what can be addressed with the index register plus 16 bit displacement mode of the 68000. As a result a new 'remote' storage class has been added that allows reference to static items outside the initial 64k. In reality not many programs need more than 64k of STATIC variables and there is no restiction for automatic or 'malloc'd variables.

The code produced by the compiler seems relatively efficient, unlike the Lattice Compiler the first 2 parameters are passed in the registers. There is also an optimiser which improves the code by a claimed 11% in speed and size.

Like the K&R compiler the compiler is split into seperate programs cc (executive), cpp (preprocessor), c68 (compiler), o68 (optimiser), and then the assembler and linker are called. Make is also included and the system is a great improvement on the GEM environment for C development.

One of the claims made for OS-9 is that it is "compatible with Unix at the C source code level". Having ported Unix C-Kermit to OS-9 I can say that it is not as compatible as you might expect. The following had to be changed or added for C-Kermit.

You might get the impression that Unix compatibility is not total, however, it has been possible to emulate all the Unix function in the OS-9 port of Kermit. The only changes to the non-system dependent code have been to change things like the #define of the end of line character.

Pascal Compiler

The Pascal compiler is completely ISO Level 0 compatible. This means it does not support conformant arrays (more about this later). The many extensions to the ISO standard are listed below:

All these can be disabled with a compile time option, if you wish to produce portable code.

As I said conformant arrays (the ISO Level 1 feature) are not supported but you will have noticed that there is a new type STRING. In my experience the most popular use of conformant arrays is for string processing.

BASIC

OS-9/68000 BASIC is the 68000 descendant of the 6809 BASIC09. It is a highly structured pseudo-compiled BASIC. The BASIC command takes you into a complete BASIC environment from where you can edit, run and debug BASIC programs.

The editor is a simple line based editor almost identical to the BASIC09 editor; changes are made by either deleting the entire line or with the change (c/from/to/) command. The editor is infact the weakest point of the BASIC; though once the line is entered there is immediate partial compilation this flags any syntax errors, and the LIST command puts all keywords in upper case and auto indents loop constructs etc. for you.

Once you've typed in your program you type 'q' to quit the editor and then the second phase of compilation is carried out. This flags any context errors - if none exist you can run the program. Any runtime error will drop you into the debugger. This allows you to print off the contents of variables (or set them), single or multi step, and trace back procedures. Even better it allows you to run the trace mode (also accessible with the TRON command) this lists each source line as it is executed with the result of each sub-expression printed out beneath it. It is infact very similar in appearance to the VM/CMS REXX trace mode.

As I said this is a structured BASIC, the structured statements available are:

FOR ... TO ... [STEP ...] ..... NEXT

WHILE xxx DO .... ENDWHILE

IF xxx THEN .... ELSE .... ENDIF

REPEAT .... UNTIL

LOOP ....

EXITIF xxxx THEN .... ENDEXIT ....

ENDLOOP

All the above are multiline constructs, and there is no necessity for line numbers, indeed you're cautioned that it slows BASIC down if you use line numbers.

User defined types are also supported with the statement TYPE eg.

TYPE person := name : STRING[80] ; age, height : INTEGER;
gender : BOOLEAN

and space reserved for them with the DIM statement eg.

DIM fred, jim : person

Structure (and array) assignment is allowed eg.

fred := jim (* or fred = jim *)

You can have REMarks for comments or use (* a comment *). It is missing the BASIC DEF FNx construct instead each "program" is a 'procedure' and the RUN statement allows one procedure to call another passing parameters in the process. The parameters are passed 'by reference' so it is in fact possible for procedures to have side effects as with C functions, however, there are no global or static variables.

Lastly, it is possible to 'pack' a procedure; this compresses the compiled form so that it can no longer be edited or debugged, but it can be run either by BASIC or by 'runb' the BASIC runtime support. BASIC has its own OS-9 module type for packed modules, so you can from the shell type a command like:

$ invoice -q fred

and enter a BASIC program without being aware of it, as the shell will load the runtime support for BASIC and run your packed procedure for you.

Stylograph

Stylograph is perhaps best described as a 'medium' function wordprocessor. Like Dynacalc it has its roots in OS-9/6809 (versions of both are available for the Color Computer and the Dragon), however, Stylograph's roots show through a little more. Stylograph is a three and a half mode word processor. The modes are 'system', 'insert/overwrite' and 'escape'.

When you start Stylograph you are presented with 'system' mode. This is essentially a menu which you move a '>' cursor with the 'i' and ',' keys, if you press <return> against one of the options then you execute that option. The options include, call OS-9 shell, edit, print text, save text, exit, spool text to disk for later printing, read more text, load a file, save a file, and some printer setup options.

Selecting edit from system mode puts you in the escape mode. In this mode you can move around the text with 'j' for left, 'l' for right, 'i' for up ',' for down and so on. If you actually want to enter some text you have to enter either insert or overwrite modes (press ';' or '1'). This was acceptable for the old 6809 version but on a 16bit machine you expect something a bit slicker.

Once in insert mode you format the text in two ways. The first is to use keys like control-B for bold and control-U for underline. The second is using a markup language similar to ROFF to set headers and footers, at least most of the formatting is done for you to see. For example the ',ce' command causes the next line to be centred on the screen as well as on the printout. There is one noticeable ommision from the markup language - that is book type headers and footers, by this I mean when the header and footers appear like

Page # Title Chapter

on odd pages and

Chapter Title Page #

on even pages.

With Stylograph come Mailmerge and Spellcheck. Mailmerge is a perfectly adequate system for running off Stylograph documents as standard letters. Spellcheck is a 'batch' spellchecker with a extendable dictionary. By 'batch' I mean that you have to save your document and quit Stylograph in order to run it, despite this it is adequate.

Dynacalc

I can't really comment about this as my (beta) version of the Upgrade was missing the keyboard definition file for Dynacalc (it is on its way to me at this moment). However, from the manual I can see that like its 8-bit predecessor its ancestry is in Visicalc and as a consequence it bears a more than a passing to Lotus. Though it has no macros and Label cells do not spill into the next cell. Again it can perhaps be best characterised as 'medium function'.

Sculptor

Sculptor is a 4th generation language and database system (once known under the name of SAGE) that is also available for MS-DOS(tm) and Unix. It would require a full article on its own in order to do it full justice. Sculptor comprises of a number of utility programs which are based around two interpreters. The first is 'sage' - this is designed to run programs which interact with the user through menu's and panels to allow database updates and enquiries etc. The second is 'sagerep' which is designed around printing out reports. There are effectively two levels of use of Sculptor; the first is using standard utilities to define a file and build a simple enquiry system and report system. The second is to write from scratch an entire application system, I'll describe the former, if you're interested in the latter then I'd go and visit your dealer.

The first job of building a sculptor database is to define the layout of its records, this is done using a program called 'describe'. This presents you with a prompt to define each fields name,title (for display), contents and size, and any validation criteria. This done, a program called 'newkf' is run to initialise the database followed by a program 'sg' which generates and compiles a sage program to allow addition, deletion, search, and amendment of the database. You then type 'sage <database name>' and you can start entering data into the database. To build a report program you simply run a program called 'rg' and this creates a sagerep program in the same fashion as the 'sg' program does for 'sage'.

Micro Emacs

As part of the 'deal' to get OS-9 cheaply, Cumana had to forgo some things that normally come with Professional OS-9. The FSAVE and FRESTORE commands which are the 'official' method of archiving OS-9 hard disks are not included. Nor is Microware's port for microEMACS 3.6, instead Cumana have arranged to supply the OS-9 port of microEMACS 3.8i on a public domain disk with the Upgrade. This is, I am told, far superior to the 3.6 based version supplied by Microware.

MicroEMACS is a very powerful full screen editor. Commands can be 'bound' to the keys of your choice and a macro language is available. Multiple files can be edited at once and multiple views of the same or different files can be on the screen at the same time, all are edited and kept synchronised. MicroEMACS also uses the termcap file so it is possible to use it to edit in both 50 line and the 40 column modes. I am very impressed with this editor.

Autortc and Setime

These are two utilities which run under GEMDOS. The first sets the GEMDOS clocks from the real time clock (RTC) and is designed to be put in the 'auto' folder of the GEMDOS boot disk. The second is a .TTP command which allows you to set the RTC from either a command line or the GEMDOS clock, or to set the GEMDOS clock from the RTC.

Summary

OS-9/68000 with all the associated software is a very powerful package. You would easily pay 50-100 pounds for an equivalent to each piece of software running under GEMDOS. However, at the new price of #497.95 inc VAT (U.K. Sterling) I expect a lot of people to be frightened off.

The obvious competition is the Mirage Operating System from Sahara, however if you were to add the price of the Mirage OS, the BASIC, Assembler, C, and Pascal from Sahara you would be paying #546.29 inc VAT. In this light the OS-9 price is good and perhaps if you want, and will use, all the rolled in software then you should consider it, certainly there is more 'function' in OS-9.

At the introductory price of #299.00 excl VAT it was unbeatable, at the current price, the question remains whether people will really believe that they want ALL the software and the limited Unix compatiblity. Given that, as with Mirage, OS-9 is best suited to a hard disk system Unix freaks should perhaps consider a PC compatible and Minix (soon to be available on the ST as well - ED) though I doubt whether it would be as reliable.

Contacts

Microware, the writers of OS-9, can be contacted at:
Microware Systems Corporation, 1900 NW 114th Start, Des Moines, Iowa 50322
Telephone: 515-224-1929
Telex: 910-520-2535. FAX 515-224-1352

The Soft Centre, the UK agent, can be contacted at:
Software House, Burr Start, Luton, Beds., LU2 0HN
Telephone: 0582-405511
Telex: 825115 Ref: Vivaway. FAX: 0582-456521

Cumana, who are handling the ST version are at:
Pines Trading Estate, Broad Steet, Guildford, Surrey, GU3 3BG.
Telephone: 0483-503121
Telex: 859380. FAX: 0483-503326

A useful publication, if you are interested in Motorola systems in general, and
9 in particular, is
68 Micro Journal, Computer Publishing Center, 5900 Cassandra Smith Road,
PO BOX 849, Hixson, TN 37343
Telephone: 615-842-4600. Telex: 510-600-6630

Notes: 

More fields may be available via dynamicdata ..