Executable ROS contains several complex routines to drive peripheral I/O devices like opening a file on tape or diskette, printing text on a printer and so on. These routines are all accessed by jumping to a fixed location in memory, a selection routine called I/O supervisor, that transfers the requested operation to one of the specialized device routines. Selection of the desired device and the function to be executed is done by passing some parameters in an I/O control block (IOCB) to the supervisor routine. Not all entries of the IOCB may be used depending on the function to be called.
There are already routines available for the most important devices contained in Executable ROS. These are the keyboard, screen, tape drive, disk drive and printer. Other devices need routines to be loaded into memory from tape or disk with the help of the LOADER utility program (part of the Customer Support Functions). This procedure is needed for all communications devices, i.e. Async. Comm., Serial I/O, Parallel I/O and BSC, as well as the Print/Plot utility for the printer or drivers for custom/foreign devices.
The IOCB is a data structure that is stored in RWS and passed as a parameter to the I/O supervisor. This supervisor then decides depending on the device address which I/O routine to call. At the end a return code will be given back and eventually some more return values.
Offset Size Description Name ------------------------------------------------------------------------------ 0 1 Device address IOCB_DA 1 1 Subdevice address (SDA) IOCB_Sub 2 1 Command code IOCB_Cmd 3 1 Flags IOCB_Flags 4 2 Address of I/O buffer IOCB_BA 6 2 Size of I/O buffer in bytes IOCB_BS 8 2 Control information 1 IOCB_CI1 A 2 Address of I/O working area1 IOCB_WA C 2 Return code2 IOCB_Ret E 2 Control information 2 IOCB_CI2 10 2 Device status IOCB_Stat1 12 2 Device status IOCB_Stat2 1 A memory area of about 10 to 20 bytes in RWS for internal Information. 2 Possible return codes are described in the IBM 5110 MIM chapter "Error Codes".Following device addresses may be given in the IOCB:
Value Device ---------------------------------------- 00 Display 01 Common and Language ROS 03 Diskette sort feature 04 Keyboard 05 Printer 06 BSCA 07 Parallel I/O 08 Asynchronous Communications 0A Serial I/O 0C Print plot 0D Diskette 0E Tape
Command Function --------------------------------------------------------------------- 00 Turn on display 01 Turn off display ("IN PROCESS" will light) 02 Scroll screen 1 line up1 03 Scroll screen 1 line down1 04 Clear screen 05 Turn on alarm 06 Turn off alarm 07 Sound alarm for a short time (beep) 1 An empty line will be inserted.Additional entries in the IOCB are not needed.
IOCB_Cmd Function --------------------------------------------------------------------- 01 Keyboard input IOCB_Sub Function --------------------------------------------------------------------- 00 Input of a text string with echo, editing keys and display of the relative cursor position in screen corner (like input in language interpreter); returns when pressing a special key. 80 Input of a single character without echo; returns the keyboard code in IOCB_Flags IOCB_Flags: Starting cursor position within the buffer IOCB_BA: Normally an address within the display buffer ($0200-$05FF) IOCB_BS: Max. input length if IOCB_Sub=$00
Return values:
IOCB_Flags: Keyboard code of the pressed key if IOCB_Sub=$80 IOCB_CI1: If IOCB_Sub=$00 the high byte contains the special key that terminated input $80 - Cursor up $40 - Cursor down $20 - EXECUTE $0X - CMD x (x=key 0 to 9 of top row)IOCB_Flags contains the cursor position on exit.
IOCB_Cmd Function --------------------------------------------------------------------- 00 Sense (needed before first Write command) 01 Ramp head (move head to parking position) 02 Write (print text line) FF Diagnostic write (moves head without actually printing) IOCB_BA: Address of the line to be printed IOCB_BS: Number of characters to print, if 0 nothing is printed but line feeds are still done IOCB_CI1: $0000 - no line feed $0001 to $000F - line feed from 1 up to 15 lines IOCB_WA: Address of working area
Only the commands are listed here. A detailed description can be found on the page Diskette operations.
IOCB_Cmd Function --------------------------------------------------------------------- 00 Sense - Read Volume Header (Sector 7) 01 Read - Read absolute or relative sector 02 Write - Write absolute or relative sector 03 Write last - Write last sector of file (?) 04 Find - Find a directory entry or file 05 Mark - Create or delete a directory entry 08 (undocumented) - (?) 0B Write header - Update a directory entry 0C Scan - (?) 10 Find ID - Find a specific sector (incl. seek etc.) 11 Initialize head - Retract the heads to track zero
You will find only a list of commands here, too. The description is found on the page Tape operations.
IOCB_Cmd Function --------------------------------------------------------------------- 00 Sense 01 Read - Read file block from tape 02 Write - Write file block to tape 03 Write last - Write last file block to tape 04 Find - Find a file on tape 05 Mark - Mark a file 06 Initialize and mark - (to be done) 07 Rewind - (to be done) 08 Forward space record - (to be done) 09 Backspace record - (to be done) 0A Find next header - (to be done) 0B Write header - Write file header to tape FD Translate only - Translate text EBCDIC <-> tape code
After an IOCB has been created with the proper entries the I/O supervisor
has to be called. This routine is located in Executable ROS and has thus
to be called with the help of the RWS/ROS switch routine. The address of
the I/O supervisor is stored in memory location $AE, the address of the
switch routine in $AC.
The I/O supervisor expects the address to the IOCB in R3; the switch routine
expects the return address to your own program in R2. (see
Subroutine mechanisms). All other registers
may have to be saved as they will be trashed.
One example of how to call the I/O supervisor:
... ... D301 xxxx LWI R3, #Beep_IOCB ; Address of IOCB 2857 MOVE R8, $AE ; Address of I/O Supervisor 0203 INC2 R2, R0 ; Store return address in R2 2056 JMP ($00AC) ; Jump into switch routine ... ... Beep_IOCB: db 4, 0 db 7, 0 dw 0, 0, 0, 0, 0, 0, 0, 0