,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 1
,ju
,hd
,ce
OmegaSoft 6809 Cross Pascal for OS-9/68000 (V1.00)
,,
,ft

,ce 1
3-##
,,
,ce
OmegaSoft 6809 Cross Pascal for OS-9/68000 (V1.00)
,ce
O.S. DEPENDENT - STANDARD I/O DEVICES

Drivers are provided should you wish to run your program under the 6809 version of OS-9.

,ce
STANDARD I/O DEVICES

INPUT

The supplied device driver for Input (.INPUT) is located in file SD1. It will read data from the standard input path (path 0). In addition to the 6 byte device descriptor and the 1 byte element Buffer there is a one byte path number and two unused bytes (for compatibility with text files), a 2 byte pointer, and a 116 byte line buffer.

The driver uses the operating system call I$RDLN so the normal line editing functions are available (data is not processed until the carriage return is hit). Due to the nature of pascal I/O the normal system end of file key cannot be used. This is because once you start a pascal read operation you are committed to returning valid data. Control Z is used as an eof flag and is normally used as the last character before the carriage return to set the Eof function true. Unfortunately this also echos a period on the screen. 

This driver also sets in a signal intercept if the "b" pascal option was enabled when the standard input device was declared (see comment syntax in Language Handbook). This means that a control Q or control C will not terminate the pascal program. The break function will return true if a control Q or control C has been entered. This allows you to cleanly exit the program by using the break function. If the "b" pascal option was not set then no intercept will be set and typing a control Q or control C will result in the normal operating system "crash" mode of exit.

The device driver will also check to see if the standard input path has been redirected to a disk file by using the OS-9 I$GSTT call. If it has not then the Interactive bit (M$INT) in the pascal device descriptor is set. If it has (device using RBF file manager) then the interactive bit is cleared.

OUTPUT

The supplied device driver for Output (.OUTPU) is located in file SD1. It will write data to the standard output path (path 1). In addition to the 6 byte device descriptor and the 1 byte element buffer there is a one byte path number, a 1 byte column position flag, and a 1 byte space for possible use as a line counter (for line feeds as opposed to using a form feed character). The column position flag is zero if no characters have been output since the last carriage return or one otherwise. This flag is checked when doing a page operation to make sure the carriage is at column zero before the page operation is performed.
,pg
,ce
STANDARD I/O DEVICES

AUXOUT

The supplied device driver for Auxout (.AUXOU) is located in file SD1. It will write data to the standard error path (path 2). In addition to the 6 byte device descriptor and the element buffer there is a one byte path number, a 1 byte column position flag, and a 1 byte space for possible use as a line counter (for line feeds as opposed to using a form feed character). The column position flag is zero if no characters have been output since the last carriage return or one otherwise. This flag is checked when doing a page operation to make sure the carriage is at column zero before the page operation is performed.

KEYBOARD

The supplied device driver for Keyboard (.KEYBO) is located in file SD1. In addition to the 6 byte device descriptor and 1 byte element buffer there is a 1 byte path number. This driver opens a path using the same name as the standard input path and then clears out all of the editing flags in the path descriptor so that there are no special keys and no echoing. This driver does not buffer the data in any way. If you use this device you should close it at the end of the program since it is not one of the operating systems standard devices.

FILE

The supplied device driver for Files (.DISK) is located in file SD1. In addition to the 6 byte device descriptor and the element buffer there is a one byte path number. If this is a text file there is also a 1 byte column position flag (for page operation as explained in Output), 1 byte for possible use as a line counter flag, a 2 byte pointer, and a 116 byte line buffer (for reads only).

Five of the possible 6 modes are available for opening a file. Create for input does not make any sense and will be rejected by the operating system. The only difference between the pascal modes of opening and the OS-9 modes in the operating system is that OS-9 deviated from the UNIX model by not correctly implementing the create primitive. The create primitive is supposed to create a new file or if one already exists with the same name - truncate it to zero length. The OS-9 implementation will return an error code if the file already exists. To overcome this problem our pascal implementation of create will first try to delete the file. It will then do a normal OS-9 create.

If the file is of type text and capable of input then the I$GSTT function will be used to determine the type of file manager being used. Normally this is RBF and the Interactive bit (M$INT) of the pascal device descriptor will be cleared. If instead it turns out it is SCF (by opening the file as /term for instance) then the interactive bit will be set.

The last parameter of an open or create procedure is used as the attributes of the file. If the last parameter is not specified it will be set so that owner read and write are set. Note by setting this parameter to 128 ($80 hex) directory files can be opened.
,pg
,ce
STANDARD I/O DEVICES

ERROR

The supplied device driver for errors (.ERROR) is located in file SD2. Error number 255 results in return to the operating system (F$EXIT) with no error. All other errors will return that error code to the operating system via F$EXIT. It is assumed that if you are using printerr in the operating system that you are using the modified errmsg file. The supplied driver is of course unsuitable for most target systems and will need to be modified to fit your requirements.

,ce
RUNTIME LIBRARY

The runtime library has conditional assembly which allows the error checking to be removed. This is provided so that this overhead can be removed for real-time, dedicated applications. These type of applications tend to have no means of indicating that an error has occurred. This change can also make quite a difference in execution time, especially in calling procedures and functions.

In file "xpasequ" there is a flag called "ECHECK", set this to zero to remove error checking. The chain files "asu.cf", "aso.cf", "asf.cf", "asp.cf", and "asd.cf" must be run to re-assemble all runtime files. The chain file "xrl.cf" should then be run to form the runtime library. The chain file "xos9io.cf" should be run to form the os9 I/O driver library.
