RTS8V2B.DOC DISCLAIMER This document file was created by scanning the original document and then editing the scanned text. As much as possible, the original text format was restored. Some format changes were made to insure this document would print on current laser printers using 60 lines per page. The original spelling and grammar has been preserved. 1-Jun-1996 RTS/8 User's Manual Order No. DEC-08-ORTMA-C-D Version 2B digital equipment corporation - maynard, massachusetts First Printing, June 1974 Revised: September 1975 February 1977 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under a license and may be used or copied only in accordance with the terms of such license. Digital Equipment Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by DIGITAL. Copyright 1974, 1975, 1977 by Digital Equipment Corporation The postage prepaid READER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist us in pre- paring future documentation. The following are trademarks of Digital Equipment Corporation: DIGITAL DECsystem-10 MASSBUS DEC DECtape OMNIBUS PDP DIBOL OS/8 DECUS EDUSYSTEM PHA UNIBUS FLIP CHIP RSTS COMPUTER LABS FOCAL RSX COMTEX INDAC TYPESET-8 DDT LAB-8 TYPESET-10 DECCOMM DECsystem-20 TYPESET-11 RTS/8 CONTENTS Page PREFACE vii CHAPTER 1 INTRODUCTION 1-1 1.1 RTS/8 DESCRIPTION 1-1 1.2 REAL-TIME SYSTEM OPERATION 1-2 CHAPTER 2 USING TASKS UNDER RTS/8 2-1 2.1 THE STRUCTURE OF RTS/8 TASKS 2-1 2.2 CONCEPTS OF TASK COMMUNICATION 2-1 2.2.1 Task Synchronization Through the Use of Event Flags 2-2 2.2.2 Intertask Messages 2-3 2.3 EXECUTIVE INTERNAL TASK TABLES 2-5 CHAPTER 3 RTS/8 EXECUTIVE REQUESTS 3-1 3.1 COMMUNICATION WITH THE RTS/8 EXECUTIVE 3-1 3.2 ERs USED TO COMMUNICATE BETWEEN TASKS 3-1 3.2.1 SEND - Send Message 3-2 3.2.2 WAITE - Wait on Event Flag 3-3 3.2.3 SENDW - Send and Wait 3-3 3.2.4 RECEIVE - Receive Message 3-4 3.2.5 POST - Post Event Flag 3-5 3.2.6 Example of ERs for Message and Event Flags 3-5 3.3 ERs USED TO SET AND CLEAR TASK FLAGS 3-7 3.3.1 BLKARG - Block Task for Specified Reason 3-7 3.3.2 UNBARG - Unblock Task for Specified Reason 3-8 3.3.3 SUSPND - Suspend a Task's Execution 3-8 3.3.4 RUN - Run a Task 3-9 3.4 USING INTERRUPTS IN RTS/8 3-10 3.5 EXECUTIVE REQUEST WAIT STATES 3-13 CHAPTER 4 RTS/8 SYSTEM TASKS 4-1 4.1 CLOCK HANDLER 4-2 4.1.1 Examples of Clock Handler Calls 4-4 4.2 TERMINAL HANDLER 4-5 4.2.1 Additional Assembly Parameters Affecting Terminal Handler Properties 4-8 4.2.2 Useful Equates in the Parameter File 4-10 4.2.3 Examples of Terminal Handler Messages 4-11 4.3 LINE PRINTER HANDLER 4-11 4.4 MASS STORAGE HANDLERS 4-12 4.4.1 Floppy Disk Handler 4-14 4.4.2 LINCtape Handler 4-18 4.4.3 Example of Mass Storage Handler Call 4-20 4.5 POWER FAIL TASK 4-20 4.6 OS/8 SUPPORT TASK 4-21 4.6.1 Mapping of Fields with OS/8 Support Task 4-23 iii CONTENTS (Cont.) Page 4.7 OS/8 - RTS/8 COMMUNICATION (OS8COM) 4-23 4.7.1 Using the OS8COM Task 4-24 4.7.2 Other Techniques 4-25 4.8 OS/8 FILE SUPPORT TASK 4-25 4.9 UNIVERSAL DIGITAL CONTROLLER/INDUSTRIAL CONTROLLER SUBSYSTEM (UDC/ICS) HANDLER 4-27 4.9.1 AO Analog Output 4-29 4.9.2 AI Analog Input 4-29 4.9.3 DO Digital Output 4-30 4.9.4 DI Digital Input 4-31 4.9.5 GC Generic Code 4-31 4.9.6 EC Enable Counter 4-31 4.9.7 RC Read Counter 4-33 4.9.8 DC Disable Counter 4-33 4.9.9 ECT Enable Contacts 4-33 4.9.10 CS Change of State 4-34 4.9.11 DCT Disable Contacts 4-34 4.9.12 UDC/ICS Assembly Parameters 4-34 4.9.13 UDC/ICS Error Conditions 4-35 4.10 CASSETTE HANDLER 4-36 4.10.1 Handler Function 4-36 4.10.2 Utility Function 4-38 4.11 CASSETTE FILE SUPPORT HANDLER 4-39 4.12 PDP-8A NULL TASK 4-41 4.13 KL8-A SUPPORT 4-41 4.13.1 Executive KL8-A Support 4-42 4.13.2 TTY Task KL8-A Support 4-42 4.13.3 KL8-A Support for the OS/8 Support Task 4-43 4.13.4 KL8-A Support for a User Task 4-43 4.14 EXIT TASK 4-44 CHAPTER 5 MONITOR CONSOLE ROUTINE 5-1 5.1 MCR COMMAND ARGUMENTS 5-1 5.2 MCR COMMANDS 5-2 5.2.1 DAte [mm/dd/yyyy [,Time-of-day]] 5-2 5.2.2 TIme [Time-of-day] 5-2 5.2.3 NAme Task-ID,Newname 5-2 5.2.4 REquest Task-ID [,(@Time-of-day ! Interval) [,Interval]] 5-3 5.2.5 STop Task-ID 5-4 5.2.6 DIsable Task-ID 5-4 5.2.7 ENable Task-ID 5-4 5.2.8 CAncel Task-ID 5-4 5.2.9 SYstat [Task-ID] 5-5 5.2.10 OPen Address [,Count] 5-6 5.2.11 EXamine Address [,Count] 5-6 5.2.12 DEposit Address,Word [,Word] [,Word] 5-6 5.2.13 POst Address 5-6 5.2.14 EXIT 5-7 5.3 MCR ERRORS 5-7 5.4 NONRESIDENT MCR 5-7 iv CONTENTS (Cont.) Page CHAPTER 6 ASSEMBLING AND LOADING TASKS FOR RTS/8 6-1 6.1 PARAMETER FILE STRUCTURE 6-1 6.1.1 Executive Specifications 6-2 6.1.2 Task Definitions 6-2 6.1.3 System Task Specifications 6-3 6.1.4 System Wide Definitions 6-4 6.1.5 Task Setup 6-4 6.2 CREATING AN RTS/8 SYSTEM 6-5 6.3 USING THE OS/8 BITMAP PROGRAM 6-8 6.4 SAMPLE RTS/8 TASK PROGRAM 6-8 6.5 USE OF CONTROL FILES UNDER RTS/8 6-10 6.6 RTS/8 SYSTEM TASK PARAMETERS 6-11 6.6.1 Clock Handler Parameters 6-11 6.6.2 Swapper Parameters 6-12 6.6.3 Terminal Handler Parameters 6-12 6.6.4 Monitor Console Routine Parameters 6-14 6.6.5 OS/8 Support Task Parameters 6-14 6.6.6 KL8-A Support Parameters 6-15 6.6.7 Line Printer Handler Parameters 6-15 6.6.8 DECtape Handler Parameters 6-15 6.6.9 EXIT Task 6-16 CHAPTER 7 NONRESIDENT TASKS 7-1 7.1 OVERVIEW 7-1 7.1.1 Writeable Tasks 7-3 7.1.2 Checkpointable Tasks 7-3 7.1.3 Interaction Between Tasks 7-3 7.2 MEMORY PARTITIONS 7-3 7.2.1 FREE Command 7-4 7.3 NONRESIDENT TASK INITIALIZATION 7-5 7.3.1 Parameters for Nonresident Tasks 7-6 7.3.2 Assembling Nonresident Tasks 7-7 7.3.3 Creating the SAVE Image File 7-7 7.4 PARAMETER INITIALIZATION FOR PARTITIONS 7-8 7.4.1 General Information 7-8 7.5 NONRESIDENT TASK IMPLEMENTATION 7-8 CHAPTER 8 DEMONSTRATION PROGRAM 8-1 8.1 MODIFIED PARAMETER FILE (PARAM.PA) 8-1 8.2 NONRESIDENT TASK LISTINGS 8-12 8.2.1 Nonresident Task NR20 8-12 8.2.2 Nonresident Task NR22 8-13 8.3 ASSEMBLY AND LOAD PROCEDURE 8-14 8.4 NONRESIDENT TASK ASSIGNMENT AND EXECUTION 8-15 CHAPTER 9 ADVANCED RTS/8 PROGRAMMING TECHNIQUES 9-1 9.1 PERFORMING A RESCHEDULE 9-1 9.1.1 Writing Delicate Code 9-1 9.1.2 Inhibiting Task Switching 9-2 v CONTENTS (Cont.) Page 9.2 EXECUTIVE REQUESTS FOR ADVANCED APPLICATIONS 9-4 9.2.1 WAITM - Waiting for Multiple Event Flags 9-4 9.2.2 WAITX - Wait for Exactly This Event Flag 9-6 9.2.3 DERAIL - Derail a Task's Execution 9-6 9.2.3.1 Dangers of DERAIL 9-7 9.2.3.2 Restrictions Using DERAIL 9-7 9.3 STARTING PARTITIONS AT AN ARBITRARY BOUNDARY 9-8 9.4 DIRECT REFERENCES TO SYSTEM TABLES 9-9 APPENDIX A RTS/8 DISTRIBUTED SOURCE FILES A-1 APPENDIX B RTS/8 COMPONENT SIZES B-1 APPENDIX C RTS/8 FLOWCHARTS C-1 APPENDIX D RTS/8 ASSEMBLY ERROR MESSAGES D-1 APPENDIX E EXECUTIVE INTERNAL TASK TABLES E-1 GLOSSARY Glossary-1 INDEX Index-1 FIGURES FIGURE 2-1 Message Format and Linking of Messages 2-4 7-1 Nonresident Task Implementation 7-2 B-1 RTS/8 System Memory Map (Default Memory Allocation) B-4 E-1 Executive Internal Task Table Structure E-5 TABLES TABLE 1-1 RTS/8 System Tasks 1-2 2-1 Summary of Event Flag States 2-3 3-1 Summary of Executive Requests 3-2 3-2 Symbolic Names for Specifying WAITBITS 3-9 3-3 Summary of Wait States Incurred by Executive Requests 3-14 4-1 Summary of Terminal Handler Assembly Parameter Default Values 4-10 9-1 Summary of Task Switching Flag (TSWFLG) States 9-4 B-1 RTS/8 Component Sizes B-1 B-2 MCR Component Size B-6 vi PREFACE This manual describes the PDP-8 Real-Time Operating System (RTS/8). Knowledge of PDP-8 assembly language programming (PAL8) is essential for a complete understanding of this manual. In addition, the user should be familiar with real-time systems in general and with the operation and use of the development system for the PDP-8, OS/8. The information in Chapter 9, "Advanced RTS/8 Programming Techniques" is for the experienced RTS/8 user. It should be read after the user has gained familiarity with RTS/8. This version of the manual has been enlarged and expanded to incorporate several new RTS/8 features. The Major features include KL8-A Support, PDP-8/A Null Task, the EXIT Task, and two new Executive Requests. Other features are the nonresident implementation of the MCR, UDC/ICS support, an OS8COM facility that allows the OS/8 system to talk to an RTS/8 task, and control files that allow the user to efficiently make multiple task copies. RTS/8 flowcharts have been added to show system operation. The following PDP-8 handbooks will be helpful for review and reference: INTRODUCTION TO PROGRAMMING (DEC-08-XINPA-A-D) SMALL COMPUTER HANDBOOK (90P45) OS/8 HANDBOOK (DEC-S8-OSHBA-A-D) UDC8 UNIVERSAL DIGITAL CONTROL SUBSYSTEM MAINTENANCE MANUAL (46H745) PDP-8A MINICOMPUTER HANDBOOK (EB0621976) ICS8 INDUSTRIAL CONTROL SUBSYSTEM MAINTENANCE MANUAL (EKOICS8MM) vii CHAPTER 1 INTRODUCTION 1.1 RTS/8 DESCRIPTION RTS/8 is a compact real-time system designed for the PDP-8 family of processors (except the PDP-8/S). This system allows up to 63 tasks to run concurrently and compete for resources on a fixed priority basis. It can be used for a wide range of applications in which a number of processes must be monitored and controlled. As with other real-time systems, RTS/8 responds to physical or conceptual events to permit the timely execution and scheduling of tasks. The RTS/8 Executive controls execution and interaction among all tasks. The Executive decides which tasks should run (based on the priorities of the runnable tasks), and services the tasks by means of Executive Requests (ERs). A task is the basic program unit within RTS/8. RTS/8 system tasks (DEC-supplied) and their file names are listed in Table 1-1. The system supports both resident and nonresident tasks. A resident task resides permanently in memory; a nonresident task is one in which the major portion of the task resides on a mass storage device and is loaded into memory only when that task becomes executable. Using nonresident tasks permits portions of several tasks to share the same areas of memory, providing economical use of memory. RTS/8 includes system tasks that control most standard DIGITAL I/O devices. A full complement of peripherals is supported, including RK8 and RK8-E moving-head disks, DF32 and RF08 fixed-head disks, TC08 DECtape, RX8 floppy disk, LINCtape, DEC cassette, and LEO and LS8E line printers (RTS/8 does not support TD8E DECtape). The Monitor Console Routine (MCR) task provides an interface between the user at the console terminal and the system. The MCR provides the user with a series of commands to control, inspect, and, to some extent, debug the system. The MCR commands are straightforward and easy to use. They allow the user to schedule and execute tasks at specified intervals, suspend task execution, and print system status reports. A system task also is provided that allows a single copy of the OS/8 operating system to run in the background, creating a real-time foreground-OS/8 background system. With OS/8 in the background, the user has the facilities for program assembly, debugging, and editing. The minimum RTS/8 hardware configuration required for a foreground only system is a PDP-8 family processor, 4K words of memory, and a console terminal capable of papertape input. A system capable of running a real-time foreground and OS/8 in the background requires a PDP-8 family processor with KM8-A, KM8-E or TSS-8 Time Sharing options, a mass storage device (such as an RK8E cartridge disk or RX8 floppy disk), and two terminals (one must be dedicated to OS/8 system execution). 1-1 INTRODUCTION RTS/8 tasks are created by editing the RTS/8 master parameter file to produce a parameter file that describes the user's particular system. Task source files are then assembled with the edited parameter file using the PAL8 assembler. The assembler can run either under OS/8, or the OS/8 support system under RTS/8. Then using ABSLDR under OS/8, all task binaries are joined into a complete RTS/8 system. Table 1-1 RTS/8 System Tasks ---------------------------------------------------------------------- | Task Name | File Name | Task Function | ---------------------------------------------------------------------- | - | PARAM.PA | System parameter file with | | | | equates blank. Appropriate | | | | values should be inserted to | | | | create specific parameter files. | | | RTS8.PA | RTS/8 Executive | | MCR | MCR.PA | Monitor Console Routine | | null task | MCR.PA | Null task | | OS8 | OS8SUP.PA | OS/8 Support Task | | OS8F | OS8SUP.PA | OS/8 File Support Task | | PWRF | PWRF.PA | Power Fail Task | | CLOCK | CLOCK.PA | Clock Handler Task | | TTY | TTY.PA | Terminal Driver Task | | LPT | LPT.PA | Line Printer Driver Task | | DTA | DTA.PA | TC08 DECtape Driver Task | | RK8 | RK8.PA | RK8 Disk Driver Task | | RK8 | RK8E.PA | RK8E Disk Driver Task | | RF08/DF32 | RF08.PA | RF08/DF32 Fixed-Head Disk Driver Task | | CSA | CSA.PA | Cassette Driver Task | | CSAF | CSAF.PA | Cassette File Support Task | | UDC/ICS | UDCICS.PA |Universal Digital Controller/Industrial| | | | Controller Subsystem Handler Task | | RX8A | RX01RT.PA | Floppy Disk Handler (1st controller) | | RX8B | RX01RT.PA | Floppy Disk Handler (2nd controller) | | RX8C | RX01RT.PA | Floppy Disk Handler (3rd controller) | | RX8D | RX01RT.PA | Floppy Disk Handler (4th controller) | | LTA | LTA.PA | LINCtape Driver Task | | SWAPPER | SWAP.PA | Nonresident Task swapper | | NULL8A | NULL8A.PA | Null Task for PDP-8A | | EXIT | EXIT.PA | Exit Task | | | | | ---------------------------------------------------------------------- 1.2 REAL-TIME SYSTEM OPERATION A multiprogramming system is a software framework that allows available resources (such as memory, CPU time, and peripheral devices) to be shared by several tasks. Basically, a task is a portion of machine code that performs a specific function; a task is defined by convention since it overlaps with the definitions of "program" and "subroutine." 1-2 INTRODUCTION Multiprogramming allows many tasks to be in some state of execution simultaneously. If a task cannot use available central processor time because it is waiting for completion of an I/O operation (or is blocked by some other condition), the central processor can be switched to another task to use the available time, thus increasing system efficiency. Most real-time systems are required to serve a group of tasks that run at varying times or frequencies and alternate between being compute bound or I/O bound. If machine resources are to be efficiently used, these tasks cannot be run in series since the central processor will be poorly utilized during the periods the tasks are I/O bound. In addition, most real-time tasks are essentially time-critical and should not wait for a slow, less important I/O or compute bound task to finish before being executed. Thus, multiprogramming and a priority scheme for scheduling the central processor provide maximum resource utilization. Thus, a real-time system is a multiprogramming system that must, in addition to the multiprogramming features, respond quickly to critical internal or external events. The real-time system is required to suspend the operation of a less important task and start the task that deals with the critical event. A priority scheme establishes the relative importance of various tasks in the system. This allows a less important task to be interrupted to permit execution of a critical real-time task. For RTS/8, a fixed priority scheme was chosen because such a scheme is simple and reliable, and requires low scheduling overhead. 1-3 CHAPTER 2 USING TASKS UNDER RTS/8 2.1 THE STRUCTURE OF RTS/8 TASKS The RTS/8 Executive is the controlling program in an RTS/8 System. The Executive decides which task should run based on the priorities of the runnable tasks (those tasks not waiting for completion of any I/O or other events). It also provides services to the tasks by means of Executive Requests. Executive Requests are discussed in Chapter 3. The user assigns unique task numbers to each task in an RTS/8 System. He can assign up to 63 (77 octal) task numbers, and must account for system tasks within the total number of tasks. A task number, once assigned, cannot change during the execution of the program, since RTS/8 uses a fixed priority system. Task numbers serve the following purposes: 1. The task number is used by the RTS/8 Executive as an index to various system tables which contain information about each task. 2. The task number is used by other tasks in the system to reference a particular task when performing certain Executive Requests (such as sending a message). 3. The task number determines the task's priority - the lower the task number, the higher the priority of the task. The Executive uses five internal tables to maintain information about the tasks in the system. A brief description of these tables is given in Section 2.3. 2.2 CONCEPTS OF TASK COMMUNICATION RTS/8 is event driven, i.e., the highest priority runnable task executes continuously until it is completed or some event or condition in the system causes it to be suspended. Another change or condition can reactivate the task. Tasks can be self-starting if assembled to run at system startup, started by another task, or started by the user at the terminal console using the MCR task. RTS/8 performs two main types of task communication, as follows: 1. Task synchronization through the use of Event Flags 2. Intertask messages 2-1 USING TASKS UNDER RTS/8 2.2.1 Task Synchronization Through the Use of Event Flags Whenever two processes occur independently, one process may need to wait until the execution of the other is finished. This can be illustrated by using the PDP-8 terminal interface as an example. The PDP-8, when ready to generate the first character, alerts the terminal by issuing a Load Teleprinter Sequence (TLS) instruction. The PDP-8 must now wait in a TSF; JMP.-l loop if it wishes to do further I/O immediately. It cannot proceed with the next character until the terminal raises its ready flag to signal that it is finished printing the first character. When the flag is raised, the PDP-8 then exits from the wait loop and proceeds to load the next character. Similarly, RTS/8 provides Event Flags as a signalling mechanism to synchronize tasks with each other. An Event Flag is a user-chosen location that contains the status of an event. The events are either l) physical processes such as a clock ticking or a valve closing, or 2) conceptual occurrences such as a certain string of characters typed by the operator or scheduling a task for execution. Like device flags, an Event Flag can signify either a busy or a completed state, defined as PENDING (>0) and FINISHED (=0), respectively. Thus, a task can direct another task via a message to perform a specified action, at which time it sets a mutually-agreed upon Event Flag to the PENDING value. When the second task has completed the specified action it sets the Event Flag to the FINISHED value; this is known as Posting the Event Flag. As a simple example, if the first task has been waiting for the Event Flag with the instructions: TAD Event Flag /LOAD EVENT FLAG IN AC SZA CLA /IF EVENT FINISHED, SKIP JMP .-2 /KEEP TRYING then the Posting of the Event Flag will cause the first task to exit from its loop, continuing on with the knowledge that the second task has completed its processing. Since this loop ties up the PDP-8 processor, Event Flags under RTS/8 have an additional state, WAITING (<0). Using the example just cited, the addition of the WAITING state now allows the first task to tell the RTS/8 Executive that it wants to WAIT until the Event Flag signifying the status of the second task is FINISHED. The monitor saves the contents of the waiting task's PC and sets the Event Flag Wait bit in its Task Flags Table Word. The Event Flag is set to the WAITING state. The WAITING state for an Event Flag is octal 4000 plus the waiting task's Task Number. When the Event Flag is POSTed via an RTS/8 Executive Request call, the task WAITING for it is automatically taken out of Event Flag Wait by RTS/8. (If no other blocking bits are set, the waiting task is again runnable, and will resume execution when higher priority tasks are blocked.) WAITE is the mnemonic for the RTS/8 Executive Request that Waits for an Event Flag. This code would look as follows: CAL WAITE event flag 2-2 USING TASKS UNDER RTS/8 All Executive Requests are described fully in Chapter 3. A summary of Event Flag states is shown in Table 2-1. Table 2-1 Summary of Event Flag States ------------------------------------------------- | Event Flag State | Value | |-----------------------|-----------------------| | | | | FINISHED (posted) | 0 | | PENDING | >0 | | WAITING | <0 (4000 + Task No.) | | | | ------------------------------------------------- 2.2.2 Intertask Messages Just as Event Flags under RTS/8 are analogous to hardware device flags, messages are analogous to data-sending hardware I/O instructions (for example, TLS). That is, messages start a task, providing the task is WAITING for a message, and at the same time, they pass information to the task. Messages are transmitted by Executive Requests. An RTS/8 message consists of a three-word Message Header followed by any number of contiguous words of information to be exchanged between two tasks. The Message Header is used exclusively by RTS/8. The first word of the Message Header is the Event Flag for the message. When the message is sent, the RTS/8 Executive sets the Event Flag to the PENDING state. This signifies that the message has been sent but not yet completed. No action occurs to the Event Flag upon receipt of the message by the receiving task; however, RTS/8 requires that the receiver POSTs the Event Flag when it has performed the action specified (or implied) by the message. This posting serves two purposes: 1. It informs the task which sent the message (the "sender") that the requested action has been completed, and 2. It allows the message to be sent again (see Item 2 below). If multiple messages are waiting to be received by a task, RTS/8 uses the second and third words of the Message Header to link these messages together (see Figure 2-1). The second word is a CDF (Change Data Field) instruction to the field of the next message. The third word is the address of the next message. A second word of 0 signifies that this is the last message. If the receiving task is not actively waiting for a message, the message is placed on the receiving task's Input Message Queue. Messages are then queued in order of decreasing priority of the sender (increasing task number). Messages sent from the same task are queued in the order in which they were issued. 2-3 USING TASKS UNDER RTS/8 RTS/8 EXECUTIVE MSGTBL MESSAGE 1 MESSAGE 2 MESSAGE 3 --------- ------------ ------------ ------------ <---- | CDF | /->|Event Flag| /->|Event Flag| /->|Event Flag| | --------- | ------------ | ------------ | ------------ | | PTR |__| | CDF | | | CDF | | | 0 | Message --------- ------------ | ------------ | ------------ Header | PTR |__| | PTR |__| | | | ------------ ------------ |----------| <---- | | | | | | | | | | | | | | | | | | | | Message | | | | | | Content | | | | | | | ------------ | | | | | | | ------------ <---- | | | | ------------ Figure 2-1 Message Format and Linking of Messages The rest of the message can contain any desired information. Sending a message does not physically move the message information to the receiving task, but provides the receiver with the field and address of the first data word of the message. It should be noted that the information in a message is not copied into the receiver's area. This has the following implications: 1. Data in a message should not be modified by the sender while the Event Flag for the message is PENDING. 2. The same message cannot be sent a second time before its Event Flag is FINISHED the first time. RTS/8 enforces this by checking the message Event Flag on a SEND operation and putting the sender into Event Flag Wait if the message is still PENDING. 3. It is legal for the receiving task to store information in the body of the message. In this way, an "answer" to the message can be returned without the complications of sending a return message back to the sender. For example, when a task sends a message to the disk driver task requesting I/O, the driver places the error status of the completed operation in a specific word in the message to indicate whether an error occurred. 2-4 USING TASKS UNDER RTS/8 2.3 EXECUTIVE INTERNAL TASK TABLES The Executive uses five internal tables to maintain information about the tasks in the system. A brief description of these tables is as follows: Table Description Task State Table (TSTABL) Contains information such as the contents of the task's PC, Link and AC at the time the task stopped running. Task Flags Table (TFTABL) Contains information about why the task is not running, i.e., it indicates for what conditions (blocking or wait bits) the task is waiting. Task Input Message Queue Contains messages that have been sent Header Table (MSGTBL) to this task. This table is referred to simply as the Message Table. Residency Table (RESTBL) Used for nonresident tasks, this table specifies where the task is to reside in memory, and where it resides on the swap device. Partition Table (PARTBL) Used for nonresident tasks, this table contains information about each memory partition, such as length and location of the partition. Memory partitions are shared by nonresident tasks. The user does not need to know the format of these tables to use RTS/8. However, a detailed explanation of these tables is given in Appendix E. 2-5 CHAPTER 3 RTS/8 EXECUTIVE REQUESTS 3.1 COMMUNICATION WITH THE RTS/8 EXECUTIVE RTS/8 tasks communicate with the RTS/8 Executive via Executive Requests (ERs). RTS/8 uses locations 20-27 in every field as a communication region for ERs to facilitate Executive Requests across field boundaries. The Executive can be called in any field via a JMS 20 instruction (designated symbolically as CAL). The Data Field (DF) does not have to be any specific value when the CAL is given, since the code in location 20 sets the DF to the Instruction Field (IF), sets the IF to 0 and jumps to the RTS/8 Executive. A summary of Executive Requests is given in Table 3-1. Most of the Executive Requests are explained in detail in this chapter. The RESCHD, WAITX and DERAIL Executive Requests are described in Chapter 9. The RTS/8 Executive will not honor any request to switch tasks arising from an interrupt if the interrupted task's Program Counter (PC) was less than 100(octal). This protects the RTS/8 Executive's entry point (location 20 in each field) from being destroyed. User tasks must be written so that instructions are never executed below 100 in any field. All ER's except DERAIL and SKPINS can relinquish processor control to higher-priority tasks as a result of their action. 3.2 ERs USED TO COMMUNICATE BETWEEN TASKS The five ERs associated with the Intertask Messages and the Event Flags are SEND, WAITE, SENDW, RECEIVE and POST. An example of their use is shown in Section 3.2.6. In addition, a sixth ER called WAITX is described in Chapter 9, Advanced Programming Techniques (Section 9.2.2). 3-1 RTS/8 EXECUTIVE REQUESTS Table 3-1 Summary of Executive Requests ---------------------------------------------------------------------- |Code| Symbolic | Description |Section Reference| | | Name | | | |----|----------|----------------------------------|-----------------| | | | | | | 0 | SEND | Send a message to a task | 3.2.1 | | | | | | | 1 | RECEIVE | Look for and/or receive a | 3.2.4 | | | | message from a task | | | | | | | | 2 | WAITE | Wait for an Event Flag to be | 3.2.2 | | | | posted | | | | | | | | 3 | | RUN Run a task | 3.3.4 | | | | | | | 4 | SUSPND | Suspend execution of a task | 3.3.3 | | | | | | | 5 | POST | Post an Event Flag | 3.2.5 | | | | | | | 6 | SKPINS | Insert code into interrupt | 3.4 | | | | skip chain | | | | | | | | 7 | DERAIL | Derail or force a task's | 9.2.3 | | | | execution to a new address | | | | | | | | 10 | BLKARG | Block a task from running for | 3.3.1 | | | | a specific reason | | | | | | | | 11 | SENDW | Send a message and wait for | 3.2.3 | | | | it to be received | | | | | | | | 12 | UNBARG | Remove a reason that a task | 3.3.2 | | | | is blocked from running | | | 13 | RESCHD | Force the RTS/8 Scheduler to run | 9.1.2 | | | | | | | 14 | WAITX | Wait for a particular Event | 9.2.2 | | | | Flag to be posted | | ---------------------------------------------------------------------- 3.2.1 SEND - Send Message Format: CAL SEND TSKNUM MESSAG The SEND ER sends the message located at MESSAG in the field of the CAL instruction to the task whose number is TSKNUM. If the receiving task has a higher priority than the sender and is waiting for a message, the sender is temporarily suspended and the receiver runs. In this case, the sender is not put into any WAIT state once the 3-2 RTS/8 EXECUTIVE REQUESTS message is sent. However, if the Event Flag in location MESSAG is PENDING (nonzero), meaning the message is still busy from a previous SEND, the sender will be put into Event Flag Wait on location MESSAG, and only when the Event Flag becomes FINISHED (zero) will this SEND be performed. Care should be taken that a message is sent from only one task as only the last request to send a busy message is remembered; the first task can go to sleep in Event Wait permanently. 3.2.2 WAITE - Wait on Event Flag Format: CAL WAITE EFLG The WAITE ER checks the status of location EFLG and if it is FINISHED, returns control to the caller. If EFLG is PENDING, its state is changed to WAITING and the calling task is put into Event Flag Wait. When location EFLG is POSTed by another task or interrupt routine, the calling task becomes runnable again. The Event Flag must be initialized (set to 1) before use in most cases, particularly when a task is initiating an event to be completed by another task. The waiting task must reset the Event Flag before using it again in that the Event Flag does not reset itself. NOTE In advanced applications, the user may be waiting for multiple Event Flags (see Section 9.2.1 for description of WAITM). In this case the task will run whenever any one of the Event Flags is posted, and not necessarily the one specified in the WAITE. To insure that a particular Event Flag is posted, use the WAITX ER described in Section 9.2.2. 3.2.3 SENDW - Send and Wait Format: CAL SENDW TSKNUM MESSAG The SENDW ER is exactly equivalent to the sequence: CAL SEND /SEND THE MESSAGE TSKNUM MESSAG CAL WAITE /WAIT FOR RECEIVER TO ACKNOWLEDGE MESSAG 3-3 RTS/8 EXECUTIVE REQUESTS 3.2.4 RECEIVE - Receive Message Format: TAD TSKNUM /ONLY TO RESTRICT TO ONE CAL /SENDING TASK RECEIVE MADDR, 0 /MESSAGE ADDRESS STORED /HERE; CDF TO MESSAGE /FIELD IN AC ON RETURN If the AC is zero when the RECEIVE ER is issued, the calling task's Input Message Queue is examined. If there are messages in the calling task's Input Message Queue, the first (i.e., highest-priority) message is dequeued and the address of its first data word is placed in MADDR. A CDF to the field of the message is stored in the AC. If there are no messages, the task is placed in Message Wait until such time as a message is sent to this task. However, a task may first examine its Input Message Queue Header in field 0 to determine the state of the Input Message Queue. If the AC is nonzero when the RECEIVE ER is issued, the calling task's Input Message Queue is searched for a message whose sender's Task Number matches the contents of bits 1-11 of the AC. If such a message is found, it is removed from the queue as specified above; if a message is not found, the issuing task is placed in Message Wait. This allows a message from only one given task to be received. NOTE The following information is useful to the advanced user. When a task is in MSGWT, after just having done a RECEIVE, its PC as stored in the TSTABL points back to the location containing the CAL. Thus, when a message comes in, the task re-executes the RECEIVE ER and accepts the message. This mechanism is normally transparent to the user. One implication is that no harm is caused by taking a task out of MSGWT because once the task starts up again, it will re-execute the RECEIVE ER, and go back into MSGWT. Normally, if there are no messages in the Input Message Queue when a task performs a RECEIVE, the task is put into Message Wait. However, a 1 in bit 0 of the AC (i.e., the AC is negative) when the RECEIVE is issued indicates that the task is not willing to wait. Thus, with no messages in the Input Message Queue (or none sent by the task specified in bits 1-11 of the AC), the task will then continue to run (at CAL +3) with the AC equal to zero. The zero AC provides the means for the RTS/8 Executive to inform the task that there were no messages (of the desired type) pending. 3-4 RTS/8 EXECUTIVE REQUESTS 3.2.5 POST - Post Event Flag Format: TAD EFPTR /POINTER TO EVENT FLAG CAL POST CDF EFFLD /FIELD OF EVENT FLAG The Event Flag pointed to by the AC, in the field specified by the CDF, is set to the FINISHED (zero) state. If its previous state was WAITING, the task that was waiting for it is cleared of its Event Flag Wait. This ER never sets the calling task in a WAIT state. If the task waiting for the Event Flag is of a higher priority than the calling task, the calling task is temporarily suspended while the other is run. 3.2.6 Example of ERs for Message and Event Flags The following example illustrates the RTS/8 ERs dealing with Messages and Event Flags. Since I/O and interrupts under RTS/8 have not been discussed yet, this example is elementary. There is no advantage to keeping the functions of the two tasks separate, and the entire send/receive structure is being used here as an elaborate subroutine call. A description of the execution sequence follows the example. Task A A1 ALOOP, CAL SEND /SEND TASK B MESSAGE 1 B MES1 A2 CAL SEND /SEND TASK B MESSAGE 2 B MES2 A3 CAL WAITE /WAIT FOR MESSAGE 1 MES1 A4 JMP ALOOP /LOOP MES1, ZBLOCK 3 /MESSAGE 1 15 /RANDOM NUMBERS 37 23 MES2, ZBLOCK 3 /MESSAGE 2 -1 /RANDOM NUMBERS 4 3-5 RTS/8 EXECUTIVE REQUESTS Task B B1 BLOOP, CAL RECEIVE /GET A MESSAGE MADDR, 0 B2 DCA EFCDF /SAVE MESSAGE CDF FOR POST B3 TAD EFCDF B4 DCA .+1 /PUT CDF INLINE B5 HLT /CDF TO MESSAGE FIELD B6 TAD I MADDR /GET 1ST DATA WORD OF /MESSAGE (DO NOTHING WITH IT) B7 CLA B8 STA CLL RTL /-3 IN AC B9 TAD MADDR /AC POINTS TO MESSAGE /EVENT FLAG B10 CAL POST /DECLARE MESSAGE RECEIVED EFCDF, HLT /CDF TO MESSAGE FIELD HERE Bll JMP BLOOP /LOOP The flow of execution in this example depends on which of the two tasks has higher priority. Assuming that at some time both A and B become runnable and task A has higher priority, the sequence of execution is as follows: Sequence Reason For Execution A1 Task A has higher priority than task B. A2 Task A has higher priority than task B. A3 Task A has higher priority than task B. B1 Task A is now in Event Flag Wait since MES1 was PENDING; MES1 is now in WAITING state. Sequence Reason For Execution B2-B10 Task A is still waiting; the RECEIVE at B1 received MES1 A4 The POST at B10 posted MES1 and "woke up" A, which has higher priority than B. A1 A continues executing. A2 A tries to send MES2 again; B has not yet processed it; MES2 is PENDING. Bll Therefore, A is put into Event Flag Wait and B is resumed; MES2 is now WAITING. Bl-B10 B now RECEIVes and POSTs MES2. A2 This brings A out of Event Flag Wait; the RTS/8 Executive has modified task A's program counter so that it will re-execute the offending SEND. A3 A3 now waits for MES1 to be POSTed. If task B has higher priority, the sequence of execution is: 3-6 RTS/8 EXECUTIVE REQUESTS Sequence Reason For Execution B1 Task B has higher priority than task A. A1 Task B is placed in Message Wait since there are no messages in its input queue. Task A then sends MES1 to Task B. B2-B10 Task A's message brings task B out of Message Wait; since B has higher priority, A is stopped and B runs. Bll The POST at B10 sets MES1 to FINISHED but has no other effect. B1 Now task B tries to get another message. A2 There are no other messages, so task B is put in Message Wait and A is run. B2-Bll Task A sends MES2 which "wakes up" B; B processes MES2 and B1 returns for more, A3 and is put in Message Wait. Since MES1 is FINISHED A4 the WAITE at A3 has no effect and task A A1 loops back to A1 and sends MES1 again. 3.3 ERs USED TO SET AND CLEAR TASK FLAGS Several ERs allow a task to explicitly set and clear flags in the Task Flags Table entry of another task, and to set flags in its own table entry. These ERs are BLKARG, UNBARG, SUSPND and RUN. 3.3.1 BLKARG - Block Task for Specified Reason Format: TAD TASKNUM /OR 0 IF SELF CAL BLKARG WAITBITS TASKNUM contains the number of the task to be blocked (that is, not allowed to run). WAITBITS specifies one or more bits to be set in that task's Task Flags word. Assuming WAITBITS is nonzero, this will cause the specified task to become non-runnable. If TASKNUM contains zero, the issuing task will be blocked on the specified wait bits. The TASKNUM=0 form of this ER is the only legal way to specify the issuing task as the task to be blocked; if TASKNUM is equal to the issuing task number, the action of this ER is undefined. Example: 3-7 RTS/8 EXECUTIVE REQUESTS Task 14 is placed into User Wait by executing the following code. TAD (14 CAL BLKARG USERWT Symbolic names for specifying the condition for blocking or unblocking a task in the WAITBITS word is given in Table 3-2. 3.3.2 UNBARG - Unblock Task for Specified Reason Format: TAD TASKNUM CAL UNBARG WAITBITS TASKNUM contains the number of the task to unblock, and WAITBITS specifies one or more bits to be cleared in that task's Task Flags word. If the Task Flags word becomes zero as a result of this operation, the specified task becomes runnable; if the specified task has higher priority than the issuing task and becomes runnable, the issuing task is temporarily suspended while the higher-priority task runs. This ER is a no-op (no operation) if issued with TASKNUM equal to the issuing task's number. Example: Task 14 is taken out of User Wait by executing the following code. TAD (14 CAL UNBARG USERWT 3.3.3 SUSPND - Suspend a Task's Execution Format: TAD TASKNUM /0 IF SELF CAL SUSPND This SUSPND ER is identical in action to the following instructions: TAD TASKNUM CAL BLKARG RUNWT 3-8 RTS/8 EXECUTIVE REQUESTS Table 3-2 Symbolic Names for Specifying WAITBITS ----------------------------------------------------------------------- |Symbolic Name| Value | Meaning | |-------------|-------|-----------------------------------------------| | | | | | NONRWT | 4000 | Nonresident Wait - This task cannot run| | | | because it is not in memory. | | | | | | EFWT | 2000 | Event Flag Wait - This task is waiting for an| | | | Event Flag (which contains a WAITING value| | | | corresponding to this task) to be POSTed. | | | | | | RUNWT | 1000 | Run Wait - This task is waiting for a RUN ER| | | | to be executed with its number in the AC, or| | | | for the operator to type "REQUEST task" to| | | | the Monitor Console Routine (see Chapter 5). | | | | | | SWPWT | 0400 | Swap Wait - This task cannot run because it is| | | | in the process of being brought into memory. | | | | | | EORMWT | 0200 | Event or Message Wait - This task is waiting| | | | for an Event Flag to be posted or a message to| | | | arrive, whichever happens first. | | | | | | USERWT | 0100 | User Wait - This bit is reserved for use by| | | | user-written tasks. RTS/8 does not use this| | | | bit. | | | | | | ENABWT | 0040 | Enable Wait - This task is waiting to be| | | | Enabled. Use of this bit is restricted to the| | | | Monitor Console Routine for the "ENABLE task"| | | | and "DISABLE task" commands (see Chapter 5). | | | | | | MSGWT | 0020 | Message Wait - This task is waiting to be sent| | | | a message. | | | | | | DNEWT | 0001 | Task does not exist. This bit should never be| | | | set or cleared by a user task. | ----------------------------------------------------------------------- 3.3.4 RUN - Run a Task Format: TAD TASKNUM CAL RUN This RUN ER is identical in action to the following instructions: TAD TASKNUM CAL UNBARG RUNWT 3-9 RTS/8 EXECUTIVE REQUESTS The SUSPND and RUN ERs exist because their function is performed often enough to warrant a shorthand version. An example that shows how they can be used in a task follows. A data collection task is to print a report every 1000 data points without interrupting the data collection/reduction process. When executed, the Report Generation Task comes up running, so that the first report occurs on the first data. In this simplified example, the data operated on by the report program may have been already updated for the next cycle before being reported. A full example would require a scheme such as double buffering to protect the data. Data Control Task DLOOP, TAD (-1750 /1000 DECIMAL DCA COUNT DATALP, CAL WAITE DATAEF /WAIT FOR DATA READY . /CODE TO STORE DATA . /POINT IN BUFFER . . /GET A DATA POINT ISZ COUNT /AND PROCESS IT JMP DATALP /COUNT OFF 1000 POINTS TAD (REPORT CAL /RUN REPORT TASK RUN JMP DLOOP /KEEP COLLECTING COUNT, 0 Report Generation Task RLOOP, CAL /AC=0, SUSPEND SUSPND /UNTIL NEEDED JMS TITLE /HAS BEEN RUN . . /PRINT REPORT . /WITH TITLE . . JMP RLOOP /REPORT OVER-GO /BACK AND WAIT To eliminate interference with the data collection, REPORT should have a lower priority than DATA. 3.4 USING INTERRUPTS IN RTS/8 The RTS/8 Executive contains code to receive and dismiss hardware interrupts and to perform interrupt-initiated task switching, but it does not provide room for an interrupt skip chain. Instead, the skip chain is literally a chain and is built up dynamically at system 3-10 RTS/8 EXECUTIVE REQUESTS startup time via the SKPINS ER. A description of the SKPINS ER is as follows. Format: CAL SKPINS MODULE MODULE is the address (in the current field) of an interrupt processing module. An interrupt processing module has the following format: MODULE, 0 /THIS WORD GETS A POINTER /TO THE NEXT MODULE 0 /MODULE ENTERED HERE - CONTAINS /CDF CIF TO NEXT MODULE FIELD SKDR /SKIP ON DEVICE READY (SKP) /(ONLY IF SKDR REALLY MEANS SKIP /ON DEVICE NOT READY) JMP I MODULE /NOT READY - GO TO NEXT MODULE IN /CHAIN CDF CIF CUR /THIS ONE IS MINE - SET DF AND IF /CORRECTLY . /INTERRUPT PROCESSING . . CIF 0 /DISMISS THE INTERRUPT, MAYBE POST POSTDS /AN EVENT FLAG DEPENDING UPON /CONTENTS OF AC See item 7 below for the definition of the POSTDS instruction. Whenever a task executes a SKPINS ER, the interrupt chain is broken at the very end and the user's interrupt module is inserted. This is usually done by tasks at system start-up time only. The last interrupt module points to the interrupt dismiss routine as its "next module". In this way, RTS/8 tries to avoid superfluous interrupts. SKPINS always inserts at the end of the skip chain. This implies that the skips in the skip chain are ordered roughly by priority of the task which inserted them, since any SKPINS ERs in a task are usually executed as once-only code at system start-up time. Once an interrupt module receives control (i.e., its I/O skip succeeds), there are several restrictions on its execution: 1. The interrupt module must clear the interrupt request. 2. The Data Field and Instruction Field are those of the next interrupt module; the user must correct this as described above before any indirect addressing or jumps are performed. 3. An interrupt module may not issue any RTS/8 ERs. 4. An interrupt module should not compute excessively when interrupts are off. Typical execution time should be under 3-11 RTS/8 EXECUTIVE REQUESTS 75us. If considerably more computing than this is needed, a task should be scheduled to perform it by POSTing an Event Flaq. A POSTDS instruction is used to wake up the task from Event Wait. 5. Interrupt modules must not turn interrupts on because the state of the interrupted task will be destroyed by a second interrupt. 6. On entry to the interrupt module, the contents of the AC, Link, and Data Field have already been saved, but not the contents of the Multiplier Quotient (MQ). Therefore, interrupt modules requiring the use of the MQ should save it, and then restore it before dismissing the interrupt. 7. Interrupt modules must dismiss the interrupt by setting the Instruction Field to 0 and issuing a POSTDS instruction. POSTDS is defined as a JMP I 24 instruction. An Event Flag may be POSTed when the interrupt is dismissed by setting the Data Field to the field of the Event Flag and placing the location of the Event Flag in the AC prior to issuing the POSTDS. For example: CDF CUR /DF = THIS FIELD TAD (EVFLG /EVFLG MAY NOT BE AT LOCATION 0 CIF 0 POSTDS /DISMISS INTERRUPT AND POST EVFLG If an Event Flag is not going to be posted by the interrupt routine, the AC must be cleared prior to issuing the POSTDS instruction. For example, an RTS/8 Paper Tape Punch handler task might contain the following sections of code: In the initialization code (contained in a task that is runnable at system start-up time): START, CAL /LINK THE PUNCH SKIP SKPINS /INTO THE SKIP CHAIN PTPINT GETREQ, CAL RECEIVE /WAIT FOR MESSAGE . . . As a character punch subroutine used by the main body of the task: 3-12 RTS/8 EXECUTIVE REQUESTS PUNCH, 0 /ENTER WITH CHAR IN AC DCA TEMP /SAVE CHAR CAL /WAIT UNTIL PUNCH READY WAITE PTPEF /SET PUNCH EVENT FLAG ISZ PTPEF /TO THE PENDING STATE TAD TEMP PLS /PUNCH CHAR CLA JMP I PUNCH /RETURN . . . Interrupt skip chain code: PTPINT, ZBLOCK 2 /USED TO CHAIN SKIPS PSF /CHECK PUNCH FLAG JMP I PTPINT /NOT READY CDF CIF CUR /SET CORRECT DF, IF PCF /CLEAR PUNCH FLAG TAD (PTPEF POSTDS /DISMISS INTERRUPT, /POSTING PTPEF . . . PTPEF, 0 /PUNCH INITIALLY READY TEMP, 0 RTS/8 does not provide a mechanism for removal of entries from the interrupt skip chain. 3.5 EXECUTIVE REQUEST WAIT STATES A summary of wait states generated by Executive Requests is shown in Table 3-3. 3-13 RTS/8 EXECUTIVE REQUESTS Table 3-3 Summary of Wait States Incurred by Executive Requests ---------------------------------------------------------------------- | ER | Wait State | Condition | PC Suspended At | |---------- |----------------|---------------------|-----------------| | SEND | none | EFWT for SEND if | _ | | | | message busy at | | | | | 'CAL' | | | | | | | | RECEIVE | MSGWT | If no messages | 'CAL' | | (No wait | | in Input Queue | | |if AC=4000)| | and AC positive | | | | | | | | WAITE | EFWT | If Event Flag | 'CAL'+3 | |(No wait if| | not FINISHED | | | EF 'done')| | | | | | | | | | RUN | none | _ | _ | | | | | | | SUSPND | RUNWT | If task = self | 'CAL'+2 | | | | | | | POST | none | _ | _ | | | | | | | SKPINS | none | _ | _ | | | | | | | DERAIL | none | _ | _ | | | | | | | BLKARG | any (given by | If task = self | 'CAL'+3 | | | argument) | | | | | | | | | SENDW | EFWT | If message free | 'CAL'+3 | | | | but Event Flag | | | | | not FINISHED | | | | EFWT | If message busy | 'CAL' | | | | | | | UNBARG | none | _ | _ | | | | | | | RESCHD | none | _ | _ | | | | | | | WAITX | EORMWT | If specified Event | 'CAL' | | | | Flag not FINISHED | | | | | | | | WAITM | any (given by | _ | 'CAL'+3 | | | argument) | | | | | | | | |--------------------------------------------------------------------| | NOTE: (a) 'CAL' denotes the address of the CAL instruction in the| | Executive Request. | | (b) A message is said to be busy if its Event Flag has not | | yet been POSTED by its previous user. | ---------------------------------------------------------------------- 3-14 CHAPTER 4 RTS/8 SYSTEM TASKS The RTS/8 system includes system tasks that control most of the standard Digital PDP-8 I/O devices. Also included is one task that provides interactive system control from the console terminal and allows a single copy of the OS/8 monitor system to run in the background. Foreground tasks are protected from background tasks; however, the reverse is not true. The complete list of system tasks available in the RTS/8 system is as follows: o Clock Handler - accepts requests in the form of RTS/8 messages to perform actions after a specified time has elapsed. o Console and Non-console Terminal Handlers - handle a single terminal in either line or character mode. o Line Printer Handler - supports an LS8, LS8E, LP8 or LV8 line printer. o Mass Storage Handlers - Control the passing of information from these devices to and from memory for the RK08 and RK8-E moving-head disks, DF32 and RF08 fixed-head disks, and TC08 DECtape unit. Data is read and written in the standard RTS/8 block format (400 octal contiguous words). o Floppy Disk Handler - provides support for the use of the RX8 floppy disk. o LINCtape Handler - supports both OS/8 and DIAL-format LINCtapes. o OS/8 Files Support Task - allows the user to look up, create, and delete files in OS/8 directories from a foreground task. This task, when used with the mass storage handlers, provides the capability to read or write OS/8 files on mass storage devices. o OS/8 Support Task - supports the execution of an OS/8 operating system in the background. o UDC/ICS Handler - enables the user to control the various types of UDC/ICS modules. o Cassette Handler - allows the user to read or write data on a tape cassette. o Cassette File Support Handler - allows the user to look up, enter, and delete files from a DECcassette in CAPS-8 format. 4-1 RTS/8 SYSTEM TASKS o Power Fail Task - when used with power fail hardware, it provides for an orderly shutdown when AC power is lost. Also, it allows a programmed restart when power returns. o Exit Task - allows the user to perform special processing before making an exit from RTS/8. o PDP-8A Null Task - allows the user to count in decimal on the LED display of the PDP-8A. The sources of the system tasks are supplied with the RTS/8 system. The tasks referred to as "handlers" are completely message-driven, i.e., when idle they are in the Message Wait state. Other tasks send these handlers I/O request messages. When the handler completes the I/O operation, it POSTs the Event Flag associated with the request message and issues another RECEIVE ER. 4.1 CLOCK HANDLER The Clock Handler Task can be assembled to handle any one of four hardware clocks. The user selects the clocks by setting the symbol CLKTYP in the parameter file to 0 for KD8-EA/DK8-EC, to 1 for KW12, to 2 for PDP-8A, or to 3 for DK8-EP. The Clock Handler accepts RTS/8 messages and inserts the entries into an internal clock queue. As the entries become due, they are removed from the queue, and the request is decoded and executed. The user fixes the length of the queue at assembly time by defining the symbol CLKQLN in the parameter file to the minimum number of entry slots. The default value for CLKQLN is 20. The format of a clock message is: CLKMSG, ZBLOCK 3 /3 WORDS RESERVED FOR RTS/8 COMMAND+TASKNO /TASKNO=0 MEANS TASKNO=SENDING TASK TIMEHI TIMELO EXTRA1 EXTRA2 The words TIMEHI and TIMELO specify a time interval from the present time in terms of "system ticks". The user specifies the number of system ticks in a second in the RTS/8 parameter file by defining the parameter SHERTZ. The hardware tick rate (in ticks per second) is specified by the parameter HERTZ. CLKTYP and HERTZ are determined completely by the user's hardware configuration. SHERTZ equals the reciprocal of the software system clock resolution. HERTZ must be an exact multiple of SHERTZ. For example, the parameters for a line-frequency clock might be: DECIMAL HERTZ= 120 SHERTZ= 10 indicating that there will be 10 "system ticks" per second based on a 60-cycle clock. Such parameters might be used if only 1/10 second 4-2 RTS/8 SYSTEM TASKS resolution is necessary in the Clock Handler. Note that the maximum interval that can be expressed in TIMEHI and TIMELO is (2**24)/SHERTZ seconds. This is approximately three days if SHERTZ=60. Other RTS/8 system tasks use the symbol CLOCK when referring to the Clock Handler. The user should define this symbol in the RTS/8 parameter file to be equal to the Clock Handler's task number. It should be undefined if a Clock Handler is not to be included in the system. (See Chapter 6 for a description of the parameter file.) COMMAND is the type of request and has the following meanings: Octal Symbolic Description 0000 MARKTIME POST the event flag CLKMSG after the specified interval elapses. TASKNO, EXTRA1, and EXTRA2 are ignored. 1000 SCHEDULE POST CLKMSG immediately. Execute a RUN ER on the task specified by TASKNO after the specified interval elapses. EXTRA1 and EXTRA2 are ignored. 2000 TIMOUT POST CLKMSG immediately. DERAIL the task specified by TASKNO into a subroutine whose address is specified in EXTRA1 after the specified interval elapses. EXTRA2 is ignored. 3000 SCHEDULE PERIODICALLY POST CLKMSG immediately. Execute a RUN ER on the task specified by TASKNO after the specified interval elapses, and re-queue this command with the parameters EXTRA1 and EXTRA2 in place of TIMEHI and TIMELO. This has the effect of running the specified task periodically with a period specified by EXTRA1 and EXTRA2. 7000 CANCEL Cancel all the clock requests for the task specified by TASKNO. TIMEHI, TIMELO, EXTRA1, and EXTRA2 are ignored. POST CLKMSG immediately. Note that the requests are not actually deleted and that they still occupy space in the queue until they time out. 4-3 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_________/ \_______________________/ | | Command: _____________| | Task number __| 0 MARKTIME 1 SCHEDULE 2 TIMOUT 3 SCHEDULE PERIODICALLY 7 CANCEL Command Word Format - Clock Handler The Clock Handler also maintains the current time-of-day (in system ticks until midnight), in symbolic locations TODH (high-order) and TODL (low-order) in Page 0 of Field 0. When this time-of-day reaches zero (i.e., at midnight), it is reset to the quantity -(SHERTZ*86400) (24 hours until midnight) and an OS/8-format date word in symbolic location DATE in Page 0 of Field 0 is incremented by one day. Note that in order for the quantity SHERTZ*86400 to be contained in 24 bits, SHERTZ must be less than 192. If SHERTZ is larger, an assembly error will result while assembling the Clock Handler. 4.1.1 Examples of Clock Handler Calls CAL /WITH A 60HZ SYSTEM TICK RATE, SENDW /THIS CAUSES THE CURRENT TASK CLOCK /TO "GO TO SLEEP" FOR 2 SECONDS. SLEEPM . . SLEEPM, ZBLOCK 3 /MESSAGE HEADER 0 /SET EVENT FLAG AFTER INTERVAL 0;170 /INTERVAL IS 120 (DECIMAL) SYSTEM /TICKS If the user changes the value 170 to the assembler expression 2^SHERTZ, the preceding sequence becomes configuration-independent. CAL /RUN THE TASK REPORT ONCE SEND /EVERY HOUR, INDEFINITELY, CLOCK /ASSUMING A 60HZ SYSTEM TICK RATE RUNMSG RUNMSG, ZBLOCK 3 /MESSAGE HEADER SCHEDULE REPORT PERIODICALLY /RUN REPORT AFTER SPECIFIED /INTERVAL AND PERIODICALLY /THEREAFTER, 4-4 RTS/8 SYSTEM TASKS 0;1 /FIRST RUN IS ALMOST IMMEDIATELY /(1/60 SECOND) 64;5654 /PERIOD BETWEEN RUNS IS 216000 /(DECIMAL) SYSTEM TICKS = 3600 /SECONDS = 1 HOUR. 4.2 TERMINAL HANDLER The RTS/8 Terminal Handler handles a single terminal in either line or character mode. Input in line mode is terminated by a carriage return or an ALTMODE character and may be edited using the RUBOUT and ^U characters. The RUBOUT character deletes the last valid character typed and prints a backslash; the ^U character deletes the entire line and returns the carriage. Character mode input is not echoed and is terminated by overflow of a specified character count. If multiple terminals are to be handled, multiple copies of this Terminal Handler must be assembled. Assembly parameters in the body of the handler specify which device codes the handler will use to access its terminal. These parameters also specify whether the handler is to be a "console" Terminal Handler, that is, the terminal on which the MCR program is going to be run. The console Terminal Handler invokes the MCR whenever a ^C is typed on the keyboard; nonconsole terminal handlers treat ^C as any other character. For the console handler, C wakes up MCR by POSTing an Event Flag. The parameters edited into the distributed version of the Terminal Handler assemble the handler to handle the PDP-8 console terminal as a "console" device. Thus, when the MCR function is required, both the MCR task and the Terminal Handler task must be assembled and included as part of the RTS/8 system. Modification of the Terminal Handler to support a VT50 terminal and other features are described in Section 4.2.1. The format of messages to the Terminal Handler can be either of the following: ZBLOCK 3 ZBLOCK 3 command+length ASSGN+tsknum INBUF OUTTXT Description: Description: Types text specified by ASSGN=200 OUTTXT and command, then Assigns Terminal Handler to task specified reads text into INBUF. Deassigns Terminal Handler if tsknum=0 Legal Commands, which can be combined, are as follows: 4-5 RTS/8 SYSTEM TASKS Octal Symbolic Action if specified Action if not specified 4000 NOPACK Output text is in Output text is in unpacked ASCII, one packed 6-bit, two character per word characters per word terminated by a 0000. terminated by a 00. 2000 NOCRLF Do not type a CR/LF Type a CR/LF after after the message. typing the message. 1000 IND OUTTXT points to the OUTTXT is the first first word of the word of the output text. output text. 0400 NOLINE Input is in character Input is in line mode; mode; terminated terminated by a CR after 'length' input or ALTMODE (ESC). The characters read. length is still tested. Length Is a seven-bit field which specifies the maximum size of the input buffer if input is in line mode, or the number of characters to input if input is in character mode. If input is in line mode and there are LENGTH-1 characters in the input buffer, characters other than carriage return, ALTMODE, RUBOUT and ^U will not be accepted or echoed the message Event Flag is Posted. INBUF Is a pointer to the input buffer; if it is zero, no input is taken. The input buffer is filled with input characters packed one per word with the parity bit (bit 4) forced on. If input is in line mode, the last character of the line is followed by a zero word (if a carriage return terminated the line) or a -1(7777) word (if an ALTMODE character terminated the line). OUTTXT Is either the first word of the output text string (if IND=0) or a pointer to the first word of the output string (if IND=1000) in the same field as the message. ASSGN =200 "Assigns" the Terminal Handler to the specified task. This will cause the terminal handler to only accept messages from the specified task. If another task tries to SEND a message to the Terminal Handler while it is assigned, the message will be placed in the Terminal Handler's Message Input Queue but will not be removed for processing by the Terminal Handler until the assignment is released. The task to which the Terminal Handler is assigned can release the 4-6 RTS/8 SYSTEM TASKS assignment by sending a message assigning the Terminal Handler to task number 0. No I/O operation is performed by an assignment message. tsknum Is a 6-bit field used with the ASSGN command to specify the task number of the task to which the terminal is to be assigned. If this field is zero, the terminal is deassigned allowing the terminal task to accept commands from any task. --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ ^ ^ ^ ^ \___________________________/ Command (bits 0-4) | | | | |__ | | | | |____ | | 0: Packed ASCII \__| | |______ | | | 1: Unpacked ASCII / |________ | | | | | | | | | 0: CR/LF at end of message \__| | | | | 1: No CR/LF at end of message / | | | | | | | | 0: OUTTXT is the first word \___| | | | 1: OUTTXT points to first word / | | | | | | 0: Input in line mode \_________| | | 1: Input in character mode / | | | | Bit 4 must be a 0 _____________________| | | Length (bits 5-11) | | If bit 3=1, no. of characters to input \____________| If bit 3=0, maximum size of input buffer / Command and Length Word Format - Terminal Handler I/O Mode --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_____________/ ^ ^ \_______________________/ | | | | Unused _________________| | | | | | | Bit 4 must be a 1 ________________| | | | | Unused _______________________________| Task number __| Command Word Format - Terminal Handler ASSGN Mode 4-7 RTS/8 SYSTEM TASKS 4.2.1 Additional Assembly Parameters Affecting Terminal Handler Properties Several assembly parameters are available to the user as an aid in using the TTY task. This section describes these parameters. A summary of their default values is shown in Table 4-1. VT50 =0 Do not treat CTRL/S and CTRL/Q as special characters. =1 Support CTRL/S and CTRL/Q. If this feature is enabled, typing CTRL/S while data is being printed/displayed on the terminal will cause data to stop until the next CTRL/Q is typed. This can be used on fast CRT terminals to temporarily "freeze" the screen. This parameter must be set to 1 if the user's terminal is a model VT50 or VT52 since these terminals will occasionally send synchronization characters to the host computer of their own volition. WIDTH =n Where n is an octal number that sets the page width to n characters. TTY width is currently set to 120(octal) characters. For example, setting the parameter WIDTH = 60 changes the TTY page width to 80(decimal) characters. After n characters are printed on the terminal, the handler will automatically type out a carriage-return line-feed. Sometimes it is desirable to suppress this CR/LF (for example, when using direct cursor addressing). In this case, WIDTH should be set equal to 0. SCOPE This option is used to determine treatment of the RUBOUT key as follows: SCOPE=0 provides the normal mode of RUBOUT support (echo rubouts with a backslash). SCOPE=1 causes RUBOUT to move the cursor left one position, physically removing the character from the screen. If the cursor is in column 1, RUBOUT still works, but has no visible effect. TAB This option is used to simulate tabs by the proper number of spaces. This is accomplished via the assembly parameter TAB as follows: 4-8 RTS/8 SYSTEM TASKS TAB=0 specifies that the hardware does not support tabs. The software simulates tabs with spaces. TAB=1 specifies that the hardware does support tabs. FILL Fill characters are supported via the assembly parameter FILL as follows: FILL=0 provides no fill characters. FILL=n sends n fill characters (nulls) after a line feed. The number n must be in the range 1-5. FILL=4 is recommended for 2400 baud VT05s. CONSOL CONSOL = 1 means the handler is being assembled for the console terminal(default). CONSOL = 0 means that this handler will not wake up the MCR when a ^C is typed. OLDTTY OLDTTY = 1 specifies the use of the old two-page handler which was supplied with RTS/8 version 1. This handler has fewer features than the new handler but it is a page shorter. The parameters VT50, WIDTH, SCOPE, TAB and FILL described herein have no effect when using this handler. OLDTTY = 0 specifies the use of the new 3-page terminal handler. LSBOT LSBOT = 1 specifies the listing of both the old two-page and new three-page. LSBOT = 0(default) causes only the handler selected by the OLDTTY parameter to be listed. TTFLD Specifies the field of the TTY Handler task; for example, 20 designates field 2. TTLOC Specifies the starting location of the TTY Handler task; for example, 3000 designates the starting location at 3000. 4-9 RTS/8 SYSTEM TASKS Table 4-1 Summary of Terminal Handler Assembly Parameter Default Values ---------------------------------------------------------------------- | Parameter | Default Value | Meaning | |-----------|---------------|----------------------------------------| | VT50 | 1 | Support ^S, ^Q | | | | | | WIDTH | 120 | Page width of 80(decimal) characters | | | | | | SCOPE | 0 | Rubouts echo as \ | | | | | | TAB | 0 | Simulate tabs | | | | | | FILL | 0 | No fill characters | | | | | | CONSOL | 1 | ^C wakes up MCR | | | | | | OLDTTY | 0 | Use 3-page TTY task | | | | | | LSBOT | 0 | List only TTY task selected by OLDTTY | | | | | | TTFLD | 10 | Not a default value, but given as an | | | | example to show that the given number | | TTLOC | 5000 | assignments for TTFLD and TTLOC load | | | | the TTY Handler in field 1 starting at | | | | location 5000 | ---------------------------------------------------------------------- 4.2.2 Useful Equates in the Parameter File Several useful equates (described in Section 4.2) are available which can be used when sending messages to TTY or LPT tasks. They are as follows: NOPACK = 4000 Used if output message is not 6-bit ASCII format. NOCRLF = 2000 Used if output message should not be followed by carriage return/line feed. IND = 1000 Used if OUTTXT points to the first word of the output text. NOLINE = 400 Used if input is in character mode. ASSGN = 200 Used to assign the device handler for use only by this task. KL8ALINE = 100 Used with KL8-A support (see Section 4.13.2). 4-10 RTS/8 SYSTEM TASKS 4.2.3 Examples of Terminal Handler Messages HIYA, ZBLOCK 3 /MESSAGE HEADER 0 /PACKED TEXT, END WITH CR/LF, 0 /NO INPUT TEXT /HELLO/ /TEXT TO BE OUTPUT Sending the above message to the Terminal Handler prints HELLO on the terminal. QUEST, ZBLOCK 3 /MESSAGE HEADER NOCRLF+60 /PACKED TEXT, NO CR/LF, /48-CHARACTER INPUT LIMIT ANSWER /POINTER TO INPUT BUFFER TEXT /TYPE THE ANSWER:/ Sending the above message to the Terminal Handler prints TYPE THE ANSWER: on the terminal and inputs a reply without first returning the carriage. The answer obtained from the above message could be printed on the terminal by sending the following message: TYPANS, ZBLOCK 3 /MESSAGE HEADER NOPACK+IND /UNPACKED TEXT, INDIRECT, WITH CR/LF 0 /NO INPUT ANSWER /POINTER TO OUTPUT TEXT 4.3 LINE PRINTER HANDLER The RTS/8 Line Printer Handler outputs to an LEO, LS8E, LP8 or LV8 line printer. The format of messages to the Line Printer Handler is identical to the format of messages to the terminal handler, but the INBUF word and the LINE bit are ignored (the INBUF word must, however, be present in the message). 4-11 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ ^ ^ ^ ^ \___________________________/ Command (bits 0-4) | | | | |__ | | | | |____ | | 0: Packed ASCII \__| | |______ | | | 1: Unpacked ASCII / |________ | | | | | | | | | 0: CR/LF at end of message \__| | | | | 1: No CR/LF at end of message / | | | | | | | | 0: OUTTXT is the first word \___| | | | 1: OUTTXT points to first word / | | | | | | 0: Input in line mode \_________| | | 1: Input in character mode / | | | | Bit 4 must be a 0 _____________________| | | Length (bits 5-11) | | If bit 3=1, no. of characters to input \____________| If bit 3=0, maximum size of input buffer / Command and Length Word Format - Line Printer Handler I/O Mode --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_____________/ ^ ^ \_______________________/ | | | | Unused _________________| | | | | | | Bit 4 must be a 1 ________________| | | | | Unused _______________________________| Task number __| Command Word Format - Line Printer Handler ASSGN Mode 4.4 MASS STORAGE HANDLERS Handlers are available for TC08 DECtape, DF32 and RF08 fixed-head disks, RK8 and RK8E moving-head disks, RX01 floppy disks and LINCtape. All mass storage handlers accept the same message format to read or write blocks on various mass storage devices. However, the Floppy Disk Handler and the LINCtape Handler allow the use of additional parameters other than the ones described herein. These parameters are described in Sections 4.4.1 and 4.4.2. 4-12 RTS/8 SYSTEM TASKS The format of messages to mass storage handlers is: MSMESG, ZBLOCK 3 UNIT RW + PAGES + FIELD BUFADD BLOKNO STATUS where: UNIT Is the number of the logical unit on which the operation is to be performed. DF32 and RF08 disks consist of only one unit. TC08 DECtape has logical units 0-7 corresponding to its physical units 0-7. LINCtape has logical units 0-7 corresponding to its physical units 0-7. RK8 disk has logical units 0-3 corresponding to its physical units 0-3. RK8E disk has logical units 0-7. Units 0-3 correspond to the outer (lower track number) half of physical units 0-3, and units 4-7 correspond to the inner (higher track number) half of physical units 0-3, respectively. RX01 has units 0 or 1 which corresponds to the left and right drive, respectively. RW Is 0 for a read operation, 4000 for a write operation. PAGES Specifies the number of (128-word) pages to transfer (times 100 octal). For example, PAGES=2000 specifies the transfer of 20(octal) pages or 2048 words; if PAGES=0, 40(octal) pages or 4096 words are transferred. FIELD Is the PDP-8 field in which the transfer takes place (times 10 octal). For example, if FIELD=30, the transfer takes place in field 3. The RW+PAGES+FIELD word is sometimes called the function word of the message. --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_____________________________/ \_______________/ | | Reserved for task use ______| | | Unit ________________________________________________| Unit Word Format - Mass Storage Handlers 4-13 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ \_________________/ \_________/ \___________/ | | | | 0: Read operation \_| | | | 1: Write operation / | | | | | | No. of pages to transfer ________| | | | | 0-7 Field of transfer ___________________________| | | Reserved for task use ________________________________________| Function Word Format - Mass Storage Handlers BUFADD Is the starting address of the buffer to be transferred. BLOKNO Is the block number on the device from which the transfer will begin. All devices are assumed to have 256-word blocks. On DECtape, the first 128 words of each of an even/odd pair of 129-word DECtape records are considered to be a block. STATUS Is a word that the handler sets on completion of the operation. It contains a zero if the operation is successful, otherwise it will contain a nonzero quantity which is the contents of the device status register. Tasks which use the mass storage handlers should test this word after the I/O operation has been completed (that is, after the Event Flag has been POSTed) to determine if any errors occurred during the transfer. All RTS/8 mass storage handlers retry operations three times if errors are encountered before setting the STATUS word to a nonzero. Note that the middle three words of a message to the RTS/8 mass storage handlers are identical to the arguments to an OS/8 handler when the same operation is performed. 4.4.1 Floppy Disk Handler Each copy of the Floppy Handler can control one single or dual RX01 drive; for more than one RX01, multiple copies of the handler are required. The format of messages to the Floppy Disk Handler is: ZBLOCK 3 CODE+DEL+MODE+UNIT RW+PAGES+FIELD BUFADD BLOKNO STATUS 4-14 RTS/8 SYSTEM TASKS where: CODE = 0 Regular condition. BLOKNO is interpreted as an OS/8 logical record number. Also, PAGES is interpreted in the OS/8 sense to mean the number of pages of data to transfer. The DEL bit is ignored. = 4000 Special Physical Sector Condition. PAGES is ignored. One sector is transferred. It is specified by BLOKNO which is to be interpreted as TTTTTTTSSSSS. That is, the high order 7-bits of BLOKNO represent the physical track number. This number must be in the range 0-76 decimal (0-114 octal). The low order 5 bits of BLOKNO represent the sector number on that track. This number must be in the range 1-26 decimal (1-32 octal). DEL = 0 Deleted data marks should not be considered. = 2000 Handle deleted data marks (if CODE=4000) as follows: If writing a sector, write deleted data indication. Do not note this fact in STATUS word. If reading a sector, set bit 5 of STATUS word to a 1 if read deleted data indication. In such a case, the STATUS word may be nonzero even though no physical error has occurred. Other STATUS bits are relevant and STATUS negative means hard error. MODE = 0 Specifies transfer in 12-bit mode. = 100 Specifies transfer in 8-bit mode. OS/8 format uses 12-bit mode. In 12-bit mode, the 64 12-bit words that comprise an OS/8 floppy sector are packed into the first 96 bytes of the sector, while the last 32 bytes contain random bit patterns. In 8-bit mode, an 8-bit byte on the floppy disk corresponds to the low order 8-bits of a 12-bit word in memory. Data in the high order 4 bits of a word in memory is not transferred to the floppy disk. In 12-bit mode, a sector contains 64 (decimal) 12-bit words of data. In 8-bit mode, a sector contains 128 8-bit bytes of data. UNIT = Specifies the drive unit number. It may be 0 or 1. The number 0 refers to the unit on the left of a dual drive. RW = 0 Read data from floppy disk. = 4000 Write data to floppy disk. 4-15 RTS/8 SYSTEM TASKS PAGES = Specifies the number of pages to transfer (times 100 octal). Pages = 0 transfers 40 pages (a full field). This value takes the range 0-37 in bits 1-5 of this word. PAGES is ignored if CODE = 4000. In that case, either 100 (octal) 12-bit words or 200 8-bit bytes (from 200 words) are transferred depending on MODE. FIELD = Specifies the field of buffer (times 10 octal). Bits 6-8 of this word have the range 0-7. BUFADD = Specifies the address of the first word of the buffer containing data. Field of buffer is determined by FIELD. Length of buffer depends on PAGES if CODE = 0 or on MODE if CODE = 4000. BLOKNO = Represents first logical OS/8 block to transfer if CODE = 0. Each OS/8 block consists of 4 sectors. Track 0 is ignored and a 2-to-1 interleave scheme is employed. If CODE = 4000, this word contains physical track and sector numbers in the format TTTTTTTSSSSS. STATUS = Receives the status of the operation upon completion. If negative, a hard error has occurred. If 0, no error has occurred. This word may be positive nonzero only if DEL = 2000. The meaning of the STATUS bits is as follows: Bit Meaning if 1 0 Hard error 1-3 Not used by controller 4 Not used by RTS/8 5 Deleted data indication 6-7 Not used by controller 8 Reserved for future use by controller 9 INIT done (can occur after temporary power failure to controller) 10 Parity error 11 CRC error NOTE On power fail restart, the INIT error might occur. When this error occurs, the calling task should send the I/O message again. 4-16 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ ^ ^ ^ | | | | 0: Regular condition\| |_________ | | 1: Special physical / | | | sector condition/ | | | | | | 0: Do not handle deleted marks \__| | | 1: Handle deleted marks / | | | | 0: Transfer in 12-bit mode \_____________| | 1: Transfer- in 8-bit mode / | | 0: Left unit of dual drive \______________________________________| 1: Right unit of dual drive / CODE = 4000 (bit 0 set to 1) transfers one sector specified by BLOCKNO as follows: --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_________________________/ \___________________/ | | Physical track no. \__________| | (0-114 octal) / | | Sector no. on track \__________________________________| (1-32 octal) / Unit Word Format - Floppy Disk Handler --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ ^ ^ ^ ^ | | | | | Hard error _______| | | | | | | | | Deleted data _________________________| | | | | | | INIT done ____________________________________________| | | | | Parity error ______________________________________________| | | CRC error ______________________________________________________| Status Word Format - Floppy Disk Handler 4-17 RTS/8 SYSTEM TASKS The largest legal OS/8 block number on a floppy disk is 755 octal. If block 756 is referenced, an error is generated. Use of larger block numbers may produce unpredictable results. Specifying an illegal track or sector may produce an error with STATUS = 4000. The standard OS/8 Interleave Scheme is as follows: OS/8 Logical Block (octal) Floppy Sectors (track/sector in decimal) 0 1/1, 1/3, 1/5, 1/7 1 1/9, 1/11, 1/13, 1/15 2 1/17, 1/19, 1/21, 1/23 3 1/25, 1/2, 1/4, 1/6 4 1/8, 1/10, 1/12, 1/14 5 1/16, 1/18, 1/20, 1/22 6 1/24, 1/26, 2/1, 2/3 7 2/5, 2/7, 2/9, 2/11 10 2/13, 2/15, 2/17, 2/19 11 2/21, 2/23, 2/25, 2/2 12 2/4, 2/6, 2/8, 2/10 13 2/12, 2/14, 2/16, 2/18 14 2/20, 2/22, 2/24, 2/26 15 3/1, 3/3, 3/5, 3/7 . . . Track 0 is not used by OS/8, and cannot be accessed in the 12-bit mode. 4.4.2 LINCtape Handler The LINCtape Handler supports both OS/8 and DIAL format LINCtapes. The format of messages to the LINCtape Handler is: ZBLOCK 3 MODE+UNIT RW+PAGES+FIELD BUFADD BLOKNO STATUS where: UNIT= Specifies the LINCtape unit number in range 0 to 7. MODE=0 Specifies OS/8 Mode. A LINCtape is presumed to contain 200 or 201 (octal) words per physical block. =4000 Specifies DIAL Mode. A LINCtape is presumed to contain 400 (octal) words per physical block. 4-18 RTS/8 SYSTEM TASKS Note: The LINCtape used is not checked to see if it is properly formatted for the specified mode. Use of a LINCtape with improper physical format will produce unpredictable results. RW =0 Read data from LINCtape =4000 Write data to LINCtape PAGES Specifies the number of 128-word pages to transfer (times 100 octal). For example, PAGES=2000 transfers 20 octal pages or 2048 words; if pages=0, 40 octal pages or 4096 words are transferred. FIELD Specifies the PDP-8 field in which the transfer takes place (times 10 octal). (For example, FIELD=30, the transfer takes place in field 3). BUFADD Is the starting address of the buffer to be transferred. BLOKNO Is the block number on the device from which the transfer will begin. All devices are assumed to have 256-word blocks. On OS/8 LINCtapes, two consecutive physical blocks comprise one OS/8 logical block. Only the first 128 words in each physical block contain meaningful data. When running in DIAL mode, BLOKNO represents a physical LINCtape block number. In this case, PAGES must be even because an even number of pages is transferred. If PAGES is (incorrectly) odd, the last page is not transferred, except if PAGES=1 which will result in one block (2 pages) being transferred. STATUS is the ones complement of tape check (checksum). The value 0 means no error. STATUS is always 0 on a Write operation. Three software retries are attempted on a checksum read error. Note that the hardware performs infinite retries on most errors (write-lock-out, tape not mounted, bad spot on tape) and does not return control to RTS/8 until successful. CAUTION In the OS/8 mode, the word following the end of the buffer is temporarily destroyed while a LINCtape operation is in progress. The location is then restored upon completion of the operation. However, since RTS/8 is a 4-19 RTS/8 SYSTEM TASKS real-time system, code may be executing while the tape operation is in progress. The user must make sure that this word is never referenced while the LINCtape is being used. Under no circumstances should the word following the end of the buffer belong to another task. --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ \___________/ 0: OS/8 mode \___| | 1: DIAL model / | | Unit number _______________________________________________| Unit Word Format - LINCtape Handler 4.4.3 Example of Mass Storage Handler Call CAL SENDW DTA /SEND A MESSAGE TO THE DECTAPE /HANDLER DTAMSG /AND WAIT FOR COMPLETION TAD STATUS /CHECK THE STATUS OF THE OPERATION SZA CLA JMP ERR /BAD - GO TO ERROR ROUTINE /OK - CONTINUE PROCESSING . . . DTAMSG, ZBLOCK 3 /MESSAGE HEADER 4 /DECTAPE UNIT 4 4210 /WRITE 256 WORDS FROM FIELD 1 BUFFER /ADDRESS OF BUFFER 55 /INTO BLOCK 55 (RECORDS 132 & 133) STATUS, 0 /STATUS OF OPERATION STORED HERE 4.5 POWER FAIL TASK The Power Fail Task provides the mechanism by which the system recovers from power failure. If the power-fail/auto-restart hardware option is present and if the system parameter PWRFAL was equated to a nonzero value, the SPL (Skip on Power Low) instruction is included in the interrupt skip chain. If a power low condition occurs, the processor state is saved and the processor is halted. When power comes back, the processor state is restored and an Event Flag is POSTed which wakes up the Power Fail Task. The Power Fail Task restores the clock, console terminal, and OS/8 terminal if they are 4-20 RTS/8 SYSTEM TASKS present, and also performs an action for each task in the system based on the contents of an internal table. Each task has a one-word entry in this table, which contains: 0 If nothing should be done for this task (default value) -1 If the EFWT (Event Flag Wait) bit should be cleared in the Task Flags Table entry for this task (i.e., this task should be taken out of Event Flag Wait) ADDR If the task should be DERAILed to location ADDR in the field in which it is executing as well as having its EFWT bit cleared. Each task in the system may alter its entry in the Power Fail Task's table by sending a message to the Power Fail Task. The format of the message is: PWRMSG, ZBLOCK 3 WORD where: WORD is the new contents of the Power Fail Task's table entry for the sending task. 4.6 OS/8 SUPPORT TASK The OS/8 Support Task supports the execution of the OS/8 operating system as a task under RTS/8. OS/8 is run in the top two or more memory fields under control of the KM8-E memory extension and timeshare option (standard on PDP-8/E, 8/F, or 8/M with 8K or more of core memory) or TSS-8 time sharing hardware option. NOTE A jumper on the KM8-E module is used to select the timeshare function. The module is shipped with this jumper in place (timeshare function disabled). The PDP-8A utilizes the memory extension and timeshare option provided by the KM8-A extended option board. A switch on the KM8-A module is used to enable the timeshare function. The OS/8 Support Task is configured at system startup time to establish a correspondence between OS/8 devices and RTS/8 handler tasks. Terminal input and output from OS/8 are ring-buffered by several characters to minimize input loss due to the usurpation of the CPU by tasks of higher priority. Because of the large number of trapped CDF instructions in OS/8 and its Commonly Used System Programs 4-21 RTS/8 SYSTEM TASKS (CUSPs), response time is slower than a stand-alone OS/8 system but still quite reasonable. The background OS/8 task must have the same system device that was used by the OS/8 system to load RTS/8. The OS/8 Support Task cannot run on a stand-alone PDP-8 without OS/8. Several parameters in the system parameter file control the assembly of the OS/8 Support Task. The parameters and their meanings are as follows: OSFLDS Defined as the number of fields to be dedicated to OS/8. Example: OSFLDS=2 specifies two fields or 8K of memory for OS/8. OSKBDV Set equal to the keyboard IOT code of the OS/8 terminal. Example: OSKBDV=03 specifies the use of the console terminal keyboard of OS/8. Note: OS/8 requires its own dedicated terminal. OSTTDV Set equal to the teleprinter IOT code of the OS/8 terminal. Example: OSTTDV=04 specifies the use of the console teleprinter for OS/8. OSFILL Specifies how many null characters must follow a line-feed character on the OS/8 terminal. This allows high-speed VT05 terminals to be used as OS/8 terminals. For standard Teletypes and DECwriter terminals, this parameter should be set to zero. Example: OSFILL=4 allows the use of a 2400 baud VT05. OSSYSD Specifies the OS/8 system device driver task. Example: OSSYSD=DTA specifies DTA0 as the OS/8 system device. NOTE The user does not need to include a terminal driver for the OS/8 terminal device (it is built into OS8SUP). The OS/8 system that runs under the OS/8 Support Task runs all OS/8 CUSPs except BUILD, BOOT, PIP10, INDUSTRIAL BASIC, and BASIC and FORTRAN LAB runtime functions. All references to the keyboard and teleprinter are diverted to the specified OS/8 keyboard and teleprinter. References in OS/8 to the LEO, LS8E, LP8 or LV8 line printers are diverted to the RTS/8 line printer handler if the system parameter LPT is defined; otherwise they are executed directly by the Support Task. References to the following OS/8 device names will be diverted to the corresponding RTS/8 handler if one is defined: 4-22 RTS/8 SYSTEM TASKS DTA0-DTA7 LTA0-LTA7 RKA0-RKA3 RKB0-RKB3 RXA0-RXA7 If one is not defined, OS/8 will perform the I/O directly using the standard OS/8 handler. In addition, the OS/8 handlers SYS and DSK are diverted to the handler specified by the parameter OSSYSD. Other references to I/O under the supported OS/8 system may cause the OS/8 support task to hang in a loop. References to a handler called RTS8 are diverted to OS8COM (see Section 4.7). 4.6.1 Mapping of Fields with OS/8 Support Task The parameter HGHFLD in the parameter file must specify the highest field available to the entire RTS/8-OS/8 system. This is usually the highest field available in memory (e.g., 30 for a 16K machine). The OS8SUP task maps OS/8 fields into real fields as follows. The field which OS/8 uses as field 0 is actually HGHFLD. OS/8 fields 1, 2, 3, etc. are mapped into consecutive fields beginning with field HGHFLD-OSFLDS+1, proceeding upward. If an OS/8 program references a field greater than HGHFLD, unpredictable results will occur, as these fields are mapped over the lower OS/8 fields. The software core size is correctly set to OSFLDS and should be used by multi-field OS/8 programs. 4.7 OS/8 - RTS/8 COMMUNICATION (OS8COM) The OS/8 Support Task contains a mechanism by which OS/8 can talk to an RTS/8 task. To perform this communication, the OS/8 system must be configured with a handler called RTS8. This handler can be a dummy; it need not do anything. In fact, it can be some other handler to which the name RTS8 has been assigned. The OS/8 Support Task traps all calls to this handler. The arguments that are passed to the RTS8 handler by an OS/8 program will be passed to an RTS8 task called OS8COM. The user is responsible for writing this OS8COM task. The OS8COM task performs an RTS/8 RECEIVE ER. The task can then receive a message any time an OS/8 program reads or writes to the RTS8 handler. This message looks like any other message to a mass storage device. OS8SUP does make one change to the arguments. Bits 6 through 8 of the function word originally contain the field of the buffer. This is the field where OS/8 expects the buffer to be. When OS8COM gets control, these bits identify the actual field that contains the buffer. OS8COM can return information to OS/8 through these arguments. 4-23 RTS/8 SYSTEM TASKS 4.7.1 Using the OS8COM Task An OS/8 program that runs an RTS/8 task as specified by the OS/8 user is shown in the following example. Example: USR=7700 /LOCATION OF OS/8 USER SERVICE ROUTINE JMS PRINT /PRINT MESSAGE "WHAT TASK WOULD YOU /LIKE TO RUN?" ON THE OS/8 TERMINAL JMS READ /READS RESULT FROM OS/8 KEYBOARD /RETURNS TASK NUMBER IN RANGE 1-77 / IN AC DCA TASKNUM /STORE IT AWAY CIF 10 JMS I (USR /CALL USR 1 /TO DO A FETCH DEVICE RTS8 /OF DEVICE 'RTS8' ENTRY, ADDR /DUMMY ADDRESS (HANDLER WILL ALREADY /BE RESIDENT HLT /ERROR (HANDLER NOT FOUND) /NOTE THAT THIS CODE IS NOT REUSABLE AND THAT LOCATION /' ENTRY ' IS SET TO THE ENTRY POINT FOR THIS HANDLER CIF 0 JMS I ENTRY /CALL HANDLER 0 /DUMMY READ TASKNUM, 0 /TASK NUMBER ZBLOCK 2 /DUMMY JMP I (7605 /RETURN TO OS/8 It should be noted that TASKNUM is being passed as the second argument instead of the first because OS8SUP automatically modifies bits 6-8 of the first argument, presuming that a mapped field number is located there. OS8COM expects three arguments after the handler call plus an error return. These must be specified by the user. Where the OS/8 portion of the program has been written, the OS8COM task that handles the RTS/8 side of the communication must be written. OS8COM is written like any other RTS/8 user task, and an example of what it might look like is as follows: TASK=OS8COM /OS8COM IS ASSIGNED A PRIORITY IN THE /PARAMETER FILE INIWT=0 /COMES UP RUNNING CUR=40 /SPECIFY FIELD HERE FIELD CUR%10 *200 /STARTING ADDRESS START, CAL RECEIVE /IMMEDIATELY GO INTO RECEIVE WAIT MADDR, 0 /ADDRESS OF MESSAGE LEFT HERE DCA MSGFLD /CDF TO MESSAGE FIELD LEFT IN AC MSGFLD, HLT ISZ MADDR /POINT TO FUNCTION WORD ISZ MADDR /POINT TO BUFFER ADDRESS /(SECOND OS/8 ARGUMENT) 4-24 RTS/8 SYSTEM TASKS TAD I MADDR /GET TASK NUMBER CAL RUN /RUN THIS TASK /OS8COM WANTS TO BE HIGHER /PRIORITY THAN TASK IT IS RUNNING TAD MSGFLD DCA EFCDF TAD (-5 TAD MADDR /GET ADDRESS OF EVENT FLAG /FOR MESSAGE CAL POST /POST MESSAGE EFCDF, HLT JMP START /GET ANOTHER MESSAGE In this example, the task number was put in the second argument of the OS/8 call. However, it became the third word of the RTS/8 message because OS8SUP always adds a word to the mass storage call argument list, namely the unit number. For a description of the OS/8 standard handler call format, see Section 4.1 of the OS/8 Software Support Manual. For a description of the standard message format for mass storage devices, see Section 4.4 of this manual. 4.7.2 Other Techniques Other techniques which can be employed by the user are as follows: 1. If the RTS/8 handler STATUS word (word 5) of the message posted by OS8COM is nonzero, then return is taken to OS/8 at the error return of the handler call. 2. Arguments may be passed back to OS/8 through the argument list. 3. If more than three words of data need to be passed to OS8COM from OS/8, the user can pass a CDF and address of the area where the data resides. If the CDF occurs as the first argument to the handler call, it automatically will be relocated before being passed to OS8COM. 4.8 OS/8 FILE SUPPORT TASK The OS/8 File Support Task (OS8F) allows other tasks to look up, create, and delete files in OS/8 directories. This task is included in the same source file as the OS/8 Support Task, but the user can assemble it independently of that task (depending on which tasks are defined in the system parameter file). The format of messages to OS8F is: 4-25 RTS/8 SYSTEM TASKS OSFMSG, ZBLOCK 3 DEVHND^10+UNIT+FUNCT FILPTR STATUS BLOKNO LENGTH where: DEVHND Is the task number of the handler for the desired device. UNIT Is the unit number on which the operation is to be performed. FUNCT Represents the function to be performed. It can have the following values: 0 Looks up the specified filename and returns its starting block number in BLOKNO, and its length in LENGTH (as a two's complement number). 2000 Enters the specified filename into the first empty space (on the device) whose length is equal to or exceeds the value in LENGTH. Returns the starting block number of the new file in BLOKNO. If a file of the same name previously existed on the device it is deleted. The value of LENGTH is unchanged. 4000 Deletes the specified filename. FILPTR Is a pointer to a 4-word filename in the same field as the message. The PAL8 pseudo-op FILENAME can be used to generate these filenames. STATUS Describes the final status of the operation as follows: 0 Operation successful. 1 File not found on Lookup or Delete. 2 No room for file on Enter. >2 I/O error occurred. The value is the hardware error status of the device. -1 Invalid directory on device. 4-26 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_____/ ^ \_____________________/ \___________/ | | | | Function: __________| | | | O Lookup | | | 1 Enter | | | 2 Delete | | | 3 Unused | | | | | | Unused ___________________| | | | | Task number ____________________________| | | Unit ______________________________________________________| OS8F Call Function Word If both OS8F and the OS/8 Support Task are present in a system, an interlock is set up to prevent simultaneous updating of directory blocks by both systems. Because OS/8 tends to leave directory blocks in memory for long periods of time, this interlock scheme causes lengthy delays for the OS8F task. Before a Delete or Enter operation is performed, OS8F waits until OS/8 is in a state in which: 1. There is no active temporary file on the OS/8 device corresponding to DEVHND and UNIT. 2. OS/8 has just loaded the Keyboard Monitor, Command Decoder, or USR into core. Look up operations are not interlocked since they do not modify the directory. 4.9 UNIVERSAL DIGITAL CONTROLLER/INDUSTRIAL CONTROLLER SUBSYSTEM (UDC/ICS) HANDLER The UDC/ICS handler gives the user the capability to control the various types of UDC/ICS functional devices. This handler performs two types of action: immediate and associated. Immediate actions include reading and sending analog and digital values to appropriate UDC/ICS functional devices. Associated actions can be linked to specified events within the UDC/ICS (counters overflowing, switches being thrown). The associated actions can do the following: 1. Run a specified task when the event occurs 2. Set the Event Flag when the event occurs 3. DERAIL a specified task when the event occurs The number of associated requests that can be pending simultaneously is determined by the size of the buffer, which is specified by the assembly parameter RINGBUF. 4-27 RTS/8 SYSTEM TASKS The UDC/ICS handler permits the following operations: 1. Analog Output - send a 10-bit value to an analog channel 2. Analog Input - accept input from analog subchannel 3. Digital Output - send a 12-bit value to a digital channel 4. Digital Input - read a digital channel 5. Get Generic Code - determine the generic code for a specified channel 6. Enable Counter - permit interrupts from a counter channel 7. Read Counter - read current value of the counter channel 8. Disable Counter - disable interrupts from a counter channel 9. Enable Contacts - permit interrupts from a contact channel 10. Change Of State - find the current COS value for a contact channel 11. Disable Contacts - ignore interrupts from a contact channel Each operation is discussed in detail below, including the format of the message for specifying the operation. The first three words are required for use by the Executive. Word 4 specifies one of the 11 UDC/ICS operations which are as follows: AO=0; DO=1; DI=2; GC=3; EC=4; RC=5; DC=6; ECT=7; CS=10; DCT=11; AI=12. Word 5 designates the channel being used for the indicated operation. Words 6 through 8 may be required to completely specify the operation, and the number used is dependent upon the operation. The word that follows the last word specifying the desired operation is used for the value read or the value returned. Word 10 of all UDC/ICS messages contains the error state. The general format for a UDC/ICS message is: ZBLOCK 3 OPERATION CHANNEL OPWORD1 OPWORD2 OPWORD3 VALUE STATUS 4-28 RTS/8 SYSTEM TASKS 4.9.1 AO Analog Output Format: AO channel number subchannel & value Channel number is the analog output channel. The subchannel and value word is formed by the subchannel (0-3) in bits 0 and 1 and the 10-bit value in bits 2-11. For example, a message for an analog output operation: AOEX, ZBLOCK 3 AO /ANALOG OUTPUT 23 /CHANNEL 23 4614 /SUBCHANNEL 2, VALUE 614 ZBLOCK 3 AOER, 0 /ERROR INDICATOR --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_____/ \_______________________________________/ ^ ^ Subchannel _________| | | Value ______________________________________| Subchannel and Value Word Format - UDC/ICS Handler 4.9.2 AI Analog Input Format: AI channel subchannel & gain answer where channel is the analog input channel. The subchannel and gain word need only specify the gain in bits 1-3 and the subchannel in bits 9-ll for UDC, and 5-11 for ICS. The handler automatically sets bit 0 (enable conversion) and read control register (UDC bit 8; ICS bit 4). The ICS analog converters must have addresses which are less than 20 (octal) since all converter modules must be located in the first 16 slots of the ICS unit. After conversion, the digitized value is placed in the answer word. 4-29 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ \_________/ ^ \___________________________/ | | | | Enable conversion _| | | | | | | Gain ______________________| | | | | ICS read control register; ________| | (for UDC, bit 8) | | ICS subchannel; ___________________________________| (for UDC, bits 9-11) Subchannel and Gain Word Format - UDC/ICS Handler An example of a message for an analog input operation is as follows: AIEX, ZBLOCK 3 AI /ANALOG INPUT 17 /CHANNEL 17 3 /SUBCHANNEL 3, GAIN 1 AIANS, 0 /RESULT HERE ZBLOCK 2 AIERR, 0 /ERROR INDICATOR The user should ensure that for each major channel there is sufficient time (approximately 250 microseconds for UDC; 5 milliseconds for ICS) for each subchannel conversion to be completed before another is indicated. In general, it may be helpful if all A/D conversions for a major channel are initiated from the same task. 4.9.3 DO Digital Output Format: DO channel value Channel is a legal digital output channel and value is the number to be output. For example: DOEX, ZBLOCK 3 DO /DIGITAL OUTPUT 20 /CHANNEL 20 7777 /VALUE = 7777 ZBLOCK 3 DOER, 0 /ERROR INDICATOR 4-30 RTS/8 SYSTEM TASKS 4.9.4 DI Digital Input Format: DI channel result Channel is the appropriate digital input channel and result will contain the value of the channel when read. For example: DIEX, ZBLOCK 3 DI /DIGITAL INPUT 27 /CHANNEL 27 DIANS, 0 /VALUE OF CHANNEL 27 WILL BE PUT /HERE ZBLOCK 3 DIER, 0 /ERROR INDICATOR 4.9.5 GC Generic Code Format: GC channel result The generic code of the specified channel is put in result. For example: GCEX, ZBLOCK 3 GC /DETERMINES GENERIC CODE 27 /CHANNEL 27 GCANS, 0 /GENERIC CODE PUT HERE ZBLOCK 3 GCER, 0 /ERROR INDICATOR Generic codes are as follows: 0 - No interrupt; 1 - Controller error; 2,3 - Contact Interrupt Modules; 4 - Counter Module; 7 - A/D converter. 4.9.6 EC Enable Counter Format: EC channel initial value reload value event action address Channel is the counter channel to be enabled, initial value is the first value to be loaded into that channel, and reload value is the value with which to reload the channel after every event. If the reload value is 0, the counter is not reloaded. The event action and address words specify what happens when the counter interrupts. There are three mutually exclusive possibilities, indicated by setting the appropriate bit in the event action word as follows: 4-31 RTS/8 SYSTEM TASKS Bit 0 = 1 - Set Event Wait Flag of this job; continue execution of this job when the event occurs. Address word not used. Bit 1 = 1 - Run a task that sent the message; run task specified by bits 4-11 of event action word. Address word not used. Bit 2 = 1 - DERAIL the task that sent the message; the address word is only used by the DERAIL operation and specifies the address of the DERAIL subroutine. The subroutine must be in the same field as the calling task. Bit 3 = 1 - Do action just once. If bit 3 = 0, specified action is performed after each interrupt. Bit 3 indicates whether action is to occur once or repeatedly. Several enable counter examples follow: ECEX1, ZBLOCK 3 EC /ENABLE COUNTER 4 /CHANNEL 4 7700 /INITIAL VALUE OF 7700 7710 /RESET TO 7710 AFTER EACH EVENT 4000 /POST EVENT FLAG ON EVENT EVERY TIME /IT OCCURS 0 /UNUSED ECER1, 0 /ERROR INDICATOR ECEX2, ZBLOCK 3 EC /ENABLE COUNTER 4 /CHANNEL 4 1205 /INITIAL VALUE OF 1205 0 /DON'T RESET 2016 /RUN TASK 16 ON EVENT EVERY TIME IT /OCCURS 0 /UNUSED ECER2, 0 /ERROR INDICATOR ECEX3, ZBLOCK 3 EC /ENABLE COUNTER 5 /CHANNEL 5 10 /INITIAL VALUE OF 10 7700 /RESET TO 7700 1015 /DERAIL TO TASK 15 EVERY TIME IT /OCCURS 5620 /AT LOCATION 5620 ECER3, 0 /ERROR INDICATOR 4-32 RTS/8 SYSTEM TASKS 4.9.7 RC Read Counter Format: RC channel result where channel is the counter channel whose current value is to be read. That value is placed in result. For example: RCEX, ZBLOCK 3 RC /READ COUNTER 6 /CHANNEL 6 RCANS, 0 /VALUE OF CHANNEL 6 PUT HERE ZBLOCK 3 RCER, 0 /ERROR INDICATOR 4.9.8 DC Disable Counter Format: DC channel where channel is the counter channel from which interrupts are to be ignored. For example: DCEX, ZBLOCK 3 DC /DISABLE COUNTER 6 /CHANNEL 6 DCER, ZBLOCK 4 0 /ERROR INDICATOR 4.9.9 ECT Enable Contacts Format: ECT bit & channel event action address where the bit & channel word specifies the bit on the contact channel from which to enable interrupts. Channel is specified in bits 4-11 and the contact bit is packed in bits 0-3 as a value from 0-13(octal). Event action and address are specified in the same manner as in the enable counter function. For example: ECTEX1, ZBLOCK 3 ECT /ENABLE CONTACTS 5401 /FROM BIT 13(OCTAL) OF CHANNEL 1 2013 /RUN TASK 13 AFTER AN EVENT OCCURS ZBLOCK 3 ECTElR, 0 /ERROR INDICATOR ECTEX2, ZBLOCK 3 4-33 RTS/8 SYSTEM TASKS ECT /ENABLE CONTACT 1001 /FROM BIT 2 OF CHANNEL 1 4000 /ON 1ST OCCURRENCE OF EVENT, POST /EVENT FLAG ZBLOCK 3 ECTE2R, 0 /ERROR INDICATOR Twelve messages are required to enable the entire channel. 4.9.10 CS Change of State Format: CS channel result where channel is the contact channel whose current change of state value is to be placed in result. For example: COSEX, ZBLOCK 3 CS /READ COS 1 /CHANNEL 1 COSANS, 0 /RESULT HERE ZBLOCK 3 COSER, 0 /ERROR INDICATOR 4.9.11 DCT Disable Contacts Format: DCT bit & channel where bit & channel is specified as in enable contact. That is, bits 0-3 specify the bit (0 - 13 octal) and bits 4-11 specify the channel to be disabled. For example: DCTEX, ZBLOCK 3 DCT /DISABLE CONTACTS 5401 /FROM CHANNEL 1, BIT /13(OCTAL) ZBLOCK 4 DCTANS, 0 /ERROR INDICATOR 4.9.12 UDC/ICS Assembly Parameters The UDC/ICS handler has several assembly parameters that the user must specify to indicate the UDC/ICS configuration. The number and address is required only for those modules that perform interrupts. They are as follows: RINGBF Number of interrupts that can be stored in the ring buffer. NCNTR Number of counter modules. 4-34 RTS/8 SYSTEM TASKS NCNTC Number of contact modules. NAD Number of analog input converter modules. FCTR Address of the first counter module. The modules must be at contiguous module addresses. FCT Address of the first contact interrupt module. Interrupt modules must be at contiguous module addresses. FAD Address of the first A/D converter module. Analog input modules must be at contiguous module addresses. NMPLX Number of multiplexer modules per analog converter (ICS only). These parameters are used mainly to specify the sizes of several tables in the UDC/ICS handler, allocated as 30 (octal) words per contact module, 3(octal) words/counter module, and 16(octal) words per analog module. The UDC/ICS handler currently assumes that the handler and all its tables are entirely within the same data field (although the user could easily reprogram this). The user must keep in mind when establishing RINGBF size that if the buffer is full, UDC/ICS interrupts are disabled until there is room in the buffer. Also, each interrupt requires two entries in the buffer; that is, the actual buffer size is 2 * RINGBF. 4.9.13 UDC/ICS Error Conditions To indicate error conditions, the UDC/ICS handler places a value in the tenth word of the task's message. The values and meanings are: Value Meaning 1 Illegal generic code for specified channel and operation 2 Channel or subchannel value not valid 3 Illegal function code 5 UDC/ICS control not responding (power off or hardware error) The user should initialize and check the error word. A no error condition puts a 0 in this location. Only errors encountered at noninterrupt time are returned in this manner, thus they may also indicate a faulty UDC/ICS hardware functional device. Generic codes of 0 or 1 encountered at interrupt time are ignored. 4-35 RTS/8 SYSTEM TASKS 4.10 CASSETTE HANDLER The Cassette Handler (CSA) allows the user to read and write variable-length records on DEC cassettes, as well as to perform various special functions (such as rewind and write end-file). One copy of the Cassette Handler can operate eight units. There are two general categories of cassette operation: 1. Handler functions - read and write 2. Utility functions - rewind, backspace file gap, write file gap, backspace block gap, and skip to file gap The user should call these functions in a meaningful sequence. The first word of the message defines the cassette unit and either the handler or utility call. 4.10.1 Handler Function The format of a message to the Cassette Handler when using a handler call is: ZBLOCK 3 CALL + UNIT RW + FIELD + NONSTORE BUFADD SIZE STATUS For a handler function, the words after the RTS/8 message header are defined as follows: Word 1 bit 0 = 0 Utility call 0 = 1 Handler call bits 9-11 Cassette unit Word 2 bit 0 = 0 Read 0 = 1 Write bits 6-8 Field of buffer bit 11 Do not store data (applicable to read only) Word 3 Buffer address Word 4 Record size in bits 4-11 Word 5 Status return 4-36 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ \___________/ | | 0: Handler call \____| | 1: Utility call / | | Unit _________________________________________________________| Unit Word Format - Cassette Handler --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ \_________/ ^ | | | 0: Read \___________| | | 1: Write / | | | | Field ___________________________________________| | | 0: Read into memory \______________________________________________| 1: Check data / Function Word Format - Handler Call Cassette conventions specify a record size of 200 bytes, but the user can use any size up to 377 (8 bits are transferred). The buffer specified by the message cannot cross field boundaries. For a read operation, the buffer is optional (although its word in the message must be included), according to bit ll of word 2. The nonstore capability can be used for advancing through a long file. Word 5 contains the contents of status register B, which is defined by the bit setting as follows: Bit Meaning 4 = CRC /block error 5 = Timing 6 = EOT/BOT 7 = EOF 8 = Drive empty 9 = Read/write 10 = Write lockout ll = Ready 4-37 RTS/8 SYSTEM TASKS --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- ^ ^ ^ ^ ^ ^ ^ ^ CRC/block error __________________| | | | | | | | | | | | | | | Timing _______________________________| | | | | | | | | | | | | EOT/BOT __________________________________| | | | | | | | | | | EOF __________________________________________| | | | | | | | | Drive empty ______________________________________| | | | | | | Read/write ___________________________________________| | | | | Write lookout _____________________________________________| | | Ready __________________________________________________________| Status Return Word Format - Cassette Handler At the end of each cassette operation, the user should examine Word 5 to check for errors encountered. An example of a cassette handler message to write l00 bytes from a buffer starting at 21200 to cassette unit 3 is as follows: MSG1, ZBLOCK 3 4003 /HANDLER OPERATION ON UNIT 3 4020 /WRITE FROM FIELD 2 THE 1200 /BUFFER AT 1200 WHICH IS 0100 /100 BYTES LONG 0000 /STATUS RETURN To read and not store 200 bytes from unit 2, the message is: MSG2, ZBLOCK 3 4002 /HANDLER OPERATION ON UNIT 2 0001 /READ AND DON'T STORE 0000 /UNUSED 0200 /200 BYTES 0000 /STATUS RETURN 4.10.2 Utility Function The format of a message to the Cassette Handler when using a utility call is: ZBLOCK 3 CALL+UNIT FUNCTION STATUS 4-38 RTS/8 SYSTEM TASKS For a utility function, the words after the RTS/8 message header are defined as follows: Word 1 bit 0 = 0 Utility call bit 0 = 1 Handler call bits 9-11 Cassette unit Word 2 (function in bits 6-8): 10 = Rewind 30 = Backspace file gap 40 = Write file gap 50 = Backspace block gap 70 = Skip to file gap Word 3 Status return --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_________/ | Function: ____________________________________| 1 Rewind 3 Backspace file gap 4 Write file gap 5 Backspace block gap 7 Skip to file gap Function Word Format - Utility Call For example, to request a rewind on unit 1, the message is: MSG3, ZBLOCK 3 0001 /UTILITY OPERATION ON UNIT 1 0010 /REWIND 0000 /STATUS RETURN If an error is encountered, the operation is retried 3 times, except when a write lock out is placed on a write operation or an error occurs while reading CRC. The CAPS-8 User's Manual (DEC-8E-OCASA-A-D) is suggested reading for ____________________ users who are unsure of cassette conventions. 4.11 CASSETTE FILE SUPPORT HANDLER The Cassette File Support Handler (CSAF) supports the DEC standard cassette format and allows the calling task to look up and enter files on cassettes in that format. This handler requires the cassette handler (CSA) to perform the actual I/O operations involved. The cassette operations ENTER, LOOKUP and CLOSE are performed by the 4-39 RTS/8 SYSTEM TASKS Cassette File Support Handler (CSAF) which in turn calls the cassette handler (CSA). ENTER and LOOKUP require the user to put appropriate information in a record header area with which CSAF performs the file operations. The header area must be at least 40(octal) words long and cannot cross field boundaries. Word definitions for a CSAF message are as follows: Word 1 bit 0 = 1 - ENTER bit 1 = 1 - LOOKUP bit 2 = 1 - CLOSE bits 9-11 - unit Word 2 Address of header for ENTER and LOOKUP; status return for CLOSE Word 3 Field of header for ENTER and LOOKUP (bits 6-8) Word 4 Status return for ENTER and LOOKUP In all cases, the status return is the contents of Status Register B. --------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------- \_________/ \___________/ | | Function: ____________| | 1 Close | 2 Lookup | 4 Enter | | Unit ______________________________________________________| Unit Word Format - Cassette File Support Handler For ENTER and LOOKUP, the format of the header area must conform with cassette standards (and therefore is compatible with CAPS-8). This format is as follows: Byte Use 0-5 Filename 6-10 Filename extension 11 File type 1 = ASCII 0 = undefined 12-13 File record length. Currently word 12 must be 0 4-40 RTS/8 SYSTEM TASKS 14-15 Unused 16-23 Date (ASCII) specified as ddmmyy 24-35 Unused Reference is to 8-bit bytes, one per word, right justified For an ENTER operation, if a file with the name specified in the header area is found on the specified unit, it is deleted. For a LOOKUP operation, the record size of the specified file is returned in location header+l3 (byte 13). If the file is not found or if an error occurs, this location contains 0. The CLOSE operation is automatically followed by a REWIND. Examples of messages follow. MSG4, ZBLOCK 3 4000 /ENTER ON UNIT 0 6400 /INFORMATION IN HEADER STARTING AT /6400 0010 /OF FIELD 1 0000 /STATUS RETURN MSG5, ZBLOCK 3 1003 /CLOSE ON UNIT 3 0000 /STATUS RETURN 4.12 PDP-8A NULL TASK The PDP-8A Null Task counts from 1 to 9999 in decimal in the AC display. It also counts from 1 to 7777 in octal in the MQ display. The source which is called NULL8A, takes up a page. The user can configure the null task into an RTS/8 system by inclusion in the parameter file of its task name and the statement NULL8A = NTASKS+1 4.13 KL8-A SUPPORT The KL8-A is a 4-serial line asynchronous multiplexer for the PDP-8/A that has three lines with partial modem control and one line with full modem control. KL8-A support is available to the RTS/8 Executive, the TTY task, and the OS/8 Support Task. To use KL8-A support, the user should perform the procedures that are described in the following sections. 4-41 RTS/8 SYSTEM TASKS 4.13.1 Executive KL8-A Support The symbol KL8A in the parameter file is set to a value equal to the number of KL8-A units being employed by the user. If one KL8-A is being used, then KL8A=1 is specified. If the symbol 'KL8A' is set to 0 or undefined in the parameter file, no KL8-A support will be provided by RTS/8. KL8-A support is provided by the RTS/8 Executive. The source file KL8ASR.PA must be assembled as follows: .PAL KL8ASR on the system console terminal. An MCR command consists of a command word followed by arguments and terminated by either a carriage return or an ALTMODE. Only the first two characters of the command are significant except for the EXIT command. Commands can be a maximum of 40 characters long. If a carriage return terminates the command line, the MCR returns to the terminal for another command when it finishes processing the current command. If an ALTMODE terminates the command line, the MCR puts itself in a wait state when it finishes processing the command. The MCR is brought out of this wait state by typing ^C (CTRL C) on the console terminal. When the MCR prompts with its > and is waiting for input, no other RTS/8 task can use the terminal. Therefore, if the terminal is used for something other than an exclusive MCR terminal (for instance, error logging), type C, type the MCR command and terminate it with an ALTMODE character. This procedure prevents the MCR from tying up the terminal. 5.1 MCR COMMAND ARGUMENTS Certain syntactic constructions are used as arguments to several MCR commands. The definitions of these arguments follow. A single comma or a single space may be used interchangeably to separate arguments to MCR commands. Task-ID A Task-ID is either an octal number or a name. If it is a number, it represents the internal RTS/8 Task Number. This number also designates the priority of a task. If it is a name, the first 4 characters of the name are looked up in the MCR's Task Name table to produce a Task Number. Time-of-day A time-of-day is of the form hh:mm, where hh represents hours past midnight and mm represents minutes past hh:00. Address An Address is an octal number from 1 to 5 digits that represents a PDP-8 memory 5-1 MONITOR CONSOLE ROUTINE address. If the address is less than five digits long it is assumed the high order digits are 0. Word A Word is an octal number from 1 to 4 digits long. 5.2 MCR COMMANDS In the MCR command descriptions that follow, the significant portion of the command word is capitalized. Optional arguments are enclosed in square brackets ([]) and choices are embedded in parentheses, separated by exclamation points (!). Commands preceded by asterisks (*) are not present if the user did not define the symbol CLOCK in the RTS/8 parameter file (indicating that a clock is not in the system), or if the symbol MCRCLK is set to 0 (in order to shorten the MCR code length). 5.2.1 * DAte [mm/dd/yyyy [,Time-of-day]] The date mm/dd/yyyy, if specified, becomes the system date. For the year portion of the date, only the last digit is significant; the others are ignored since 197 assumed. The RTS/8 system date is automatically incremented at midnight, but all months are treated as being 31 days in length. The second argument, if specified, is set equal to the system time-of-day. If no arguments are specified, the current system date is printed on the console terminal in the form mm/dd/yy. >DATE 07/31/76 >DATE 07/31/76 5.2.2 * TIme [Time-of-day] If a Time-of-day command is specified, it becomes the system time-of-day. If no argument is specified the current system time-of-day is printed out on the console terminal in the form hh:mm. >TIME 14:00 >TIME 14:00 5.2.3 NAme Task-ID,Newname The character string Newname becomes the new name of the task if specified by this command. The old name of that task (if any) is lost. Newname can be any length, but only the first 4 characters are stored. Newname should not be the name of any other task or an error message results. 5-2 MONITOR CONSOLE ROUTINE Examples: >NAME 7 REPORT Task number 7 is given the name REPO. >NAME REPORT,FOO Task number 7, which is known as REPO, is now known as FOO. NOTE The system initializes the MCR name table at assembly time to contain the names of any DEC-supplied tasks that are listed in the parameter file (e.g., if the symbol CLOCK is defined in the parameter file as CLOCK=2, task number 2 gets the name CLCK). By editing the file MCR.PA after the label NMTBL, user task names can be permanently included by modifying the MCR name table. 5.2.4 REquest Task-ID [,(@Time-of-day ! Interval)[,Interval]] The REquest Task-ID command requests a task to run immediately (if only Task-ID is specified), at a given time-of-day, after a given interval, or at a given interval. Interval is of the form: nH n hours nM n minutes nS n seconds nT n system ticks Requesting a task clears the RUNWT bit in the Task Flags Table entry for that task. The interval, given in the third argument, specifies the period at which the task is rerun. If the parameter CLOCK in the RTS/8 parameter file is not defined, the second and third arguments of this command are ignored and the given task runs immediately. In the examples given below, three different formats are used for the REquest command, but only the first two characters are significant except when using the EXIT command. Examples: >REQUEST X runs task X immediately. >RE FOO,@2:00 5-3 MONITOR CONSOLE ROUTINE runs task FOO at 2:00 am (if it is after 2 am, FOO will run tomorrow at 2 am). >RE 5,10M,5M runs task number 5 ten minutes from now and every five minutes thereafter. >REQ HIPR,1T,6T On a machine with a 60 Hz clock, this command runs the task HIPR immediately (that is, .016 seconds from now, and 10 times per second thereafter). NOTE If, at the time the REquest command is executed, (which may be several hours after it is typed in) the task specified by Task-ID does not have the RUNWT bit set in its Task Flags Table entry, then the REquest command is a no-op (no operation), that is, the command has no effect. Similarly, the task will not run upon execution of the REquest command if it had other bits set beside RUNWT; the task will run only when the other blocking bits are cleared. 5.2.5 STop Task-ID The STop Task-ID command suspends execution of the task specified by Task-ID by turning the RUNWT bit on in the Task Flags Table entry for that task. A task that has been stopped can be restarted by using the REquest MCR command (in this instance it is easier to think of it as the REsume MCR command). 5.2.6 DIsable Task-ID The DIsable Task-ID command disables future execution of the specified task by setting the ENABWT bit on in the Task Flags Table entry for that task. 5.2.7 ENable Task-ID The ENable Task-ID command clears the ENABWT bit in the Task Flags Table entry for the specified task, thus enabling it to run. If the ENABWT bit was not set, the command is a no-op. 5.2.8 * CAncel Task-ID The CAncel Task-ID command cancels any clock queue entries involving 5-4 MONITOR CONSOLE ROUTINE the task specified by Task-ID. This includes l)any entries made by the MCR (from previous timed Request commands), 2)entries involving the specified task made by other tasks (e.g., a timed DERAIL) and 3)entries made by the specified task involving itself (e.g., a timed POST). In the case of the timed POST, the event flag is not POSTed and the task may hang up forever waiting for it. 5.2.9 SYstat [Task-ID] The SYstat command, depending on whether an argument is specified, prints either a general system status report or a status report in greater detail on a single task. If no argument is specified, the SYstat command prints a system status report. Each line of the report describes an existent task in the system. For each task the report prints the task number/priority, task name (if it has one), and what blocking bits are on in its Task Flags Table entry. Each blocking bit is printed as a one-letter code, preceded by a space. The one letter codes and their meanings are: E Waiting for event flag M Waiting for a message O Waiting for an event flag or a message R Waiting to be REquested or RUN S Waiting to be swapped in D Disabled U USERWT bit set N Nonresident wait In addition, an asterisk printed at the end of the line means the task has messages waiting in its input queue. A more detailed status report on a single task is obtained by specifying the Task-ID of that task as an argument to the SYstat command. The detailed report contains all the information in the general status report, followed by five octal words: WORD 1 The location of the Task State Table entry containing words 2-5; this word is followed by a colon WORD 2 Task Link in sign bit, IF in bits 6-8, DF in bits 9-11 (PDP-8/E and 8/A Flags Register) WORD 3 Task PC WORD 4 Task AC WORD 5 Task MQ Examples: A general SYstat command might produce the following sample output line: 13 CARD E * This line means task number 13, named CARD, is in Event Flag Wait and 5-5 MONITOR CONSOLE ROUTINE has input messages pending. The command: >SYSTAT CARD might produce the single line: 13 CARD E * 1320: 0022 1741 0000 2525 This line indicates that CARD is stopped at location 21741 with its AC and Link zero and 2525 in its MQ. The user can leave the SYstat facility out of the MCR assembly by setting the system parameter MCRSYS to 0 in the RTS/8 parameter file. Leaving it out saves one page of code. 5.2.10 OPen Address [,Count] The OPen Address command displays the Count locations in octal starting at Address on the console terminal in the form: lllll/ cccc The range of locations displayed may cross a field boundary. If Count is not specified, it is assumed to be 1. 5.2.11 EXamine Address [,Count] The EXamine command is identical to the OPen command. 5.2.12 DEposit Address,Word [,Word] [,Word].... The DEposit Address command deposits the second through nth arquments into core at consecutive locations starting at Address. As in the OPen Address command, field boundaries can be crossed. For example, >DEPOSIT 26132 7700,7200,50 deposits 7700 into location 26132, 7200 into location 26133, and 0050 into location 26134. Note that the command to the MCR can contain only 40 characters, and any characters beyond this limit are lost; an error message is generated for commands larger than 40 characters, hut part of the deposit will have been done. 5.2.13 POst Address The POst Address command POSTs the Event Flag at the specified address. This command is useful when the user debugs a system since it can simulate the effects of nonexistent tasks or devices. 5-6 MONITOR CONSOLE ROUTINE 5.2.14 EXIT The EXIT command causes the MCR to terminate RTS/8 execution (after pausing approximately one second for pending I/O to complete) and returns to the OS/8 monitor at location 07600. The user must type out this command completely or it will be regarded as an EXamine command. If the Exit Task is included in the system, this command runs the Exit Task before going to 7600. 5.3 MCR ERRORS The MCR checks each command line for errors and, if one is found, issues one of the following messages and reprompts on the terminal for a corrected command: BAD CHAR Character was not expected where it occurred BAD NUMBER Number is out of legal range or is missing BAD DELIM No space or comma is where one was expected BAD NAME Task name is not in name table or duplicate 5.4 NONRESIDENT MCR The MCR has a resident portion and a nonresident portion. The user can make the MCR nonresident by defining the appropriate symbols in the parameter file. If the symbols are undefined, the MCR runs as a completely-resident task. The MCR is made nonresident by defining the symbol MCRPRT in the parameter file. This symbol is set to the partition number of the partition into which it is desired to swap the MCR. For example, MCRPRT=2 means that the MCR will swap into partition 2. The procedure for specifying this partition is described in Section 7.4. The partition size must be big enough to hold the entire MCR except for one page. The length of the MCR varies depending on other parameters and the number of tasks. The size of the MCR can be determined from the MCR component size table in Appendix B. Regardless of the size of the MCR, the first page is always resident, while the remainder is the nonresident portion. The nonresident portion of the MCR must start at a location that is a multiple of 400. Therefore, the MCR resident portion must start at an odd-block boundary. The MCR can be made writeable, but not checkpointable. It frees its partition whenever it is using the terminal or while waiting for a CTRL/C. The symbol MCRORG is used to specify the starting location of the MCR. If this symbol is not defined in the parameter file, RTS/8 locates the 5-7 MONITOR CONSOLE ROUTINE MCR so that it fits up against the end of the field in which it is located. If MCRORG is defined, it specifies the initial loading address of the MCR. For example, MCRORG=2400 means that the MCR begins loading at location 2400. The user can leave out the clock functions in the MCR by setting MCRCLK to 0. 5-8 CHAPTER 6 ASSEMBLING AND LOADING TASKS FOR RTS/8 The user assembles RTS/8 tasks with parameter files, using the OS/8 PAL8 assembler. RTS/8 parameter files are all edited versions of a master parameter file (PARAM.PA) that is included in the distributed sources. Appendix A lists the RTS/8 source files. All definitions in the master file which are to be supplied by the user are left blank in the file. For example, a sample line in the file is: PDP8E= /1 IF PDP 8/E OR PDP 8/A, ELSE 0 If this parameter is set to 1, the specified machine is a PDP-8/E or a PDP-8/A. If either machine is not used, this parameter is set to 0. Thus, a unique parameter file is created for the particular RTS/8 environment, where environment is a combination of the available hardware and the set of tasks being run. The structure of the parameter file is discussed in the next section. Other sections in this chapter describe 1) the OS/8 BITMAP program which allows the user to construct a map showing the memory locations used by given binary files, 2) a sample RTS/8 program 3) a general procedure for creating an RTS/8 system, and 4) a listing of parameters and their functions that affect the individual RTS/8 system tasks. 6.1 PARAMETER FILE STRUCTURE The parameter file contains the parameters that the user must define to specify a particular RTS/8 system configuration. A parameter file that has been modified for the demonstration program is shown in Section 8.1. This file also contains user-defined symbols for DECNET/8. For further information on DECNET/8, see RTS/8 DECNET/8 _______________ Programmer's Guide and Reference Manual (DEC-08-LDPRA-A-D). _______________________________________ The parameter file is divided into the following five sections. These sections are labeled as follows: 1. Executive Specifications 2. Task Definitions 3. System Task Specifications 4. System Wide Definitions 5. Task Setup 6-1 ASSEMBLING AND LOADING TASKS FOR RTS/8 6.1.1 Executive Specifications The parameters in the Executive Specification section control the assembly of the Executive, and therefore are essential to the RTS/8 system. The parameters in this section and their meaning are as follows: Symbol Meaning PDP8E Set to 1 if PDP-8/E, PDP-8F, PDP-8M or PDP-8/A is the machine being used; if not, this symbol must be set to 0. PDP12 Set to 1 if PDP12 is the machine being used; if 0 or undefined, the PDP-12 is not being used. EAE Set to 1 if the system should save contents of the MQ during an interrupt or task switching. PWRFAL Set to 1 if power fail/restart is enabled in the hardware. KL8A Set to a nonzero if KL8-A support routines should be loaded into system. HGHFLD Set to a value designating the highest field used; for example, HGHFLD = 30 specifies field 3 when using a machine with 16K core memory. NTASKS Set to an octal value that specifies the total possible number of tasks in the system. It also represents the highest number that can be assigned to any task in the system. Not all possible task numbers need be assigned to actual tasks; this symbol merely sets the length of system tables. CHECKP Set to 1 if any nonresident task is checkpointable. PARTNS Set to the number of memory partitions allocated in the system. Set to zero if there are no memory partitions defined in the system. For example, PARTNS = 2 indicates that there are two memory partitions defined, that is, partition number 0 and partition number 1. 6.1.2 Task Definitions The Task Definitions section defines symbolic names for the various system tasks. The names of all system tasks which are to be included in the system are defined here. Any system task not included should have the line which defines it deleted from this section. Perform this deletion by inserting a slash (/) character at the beginning of the line, which makes the entire line a comment. Symbolic definitions 6-2 ASSEMBLING AND LOADING TASKS FOR RTS/8 of the user's own tasks can be added to this section. The user is reminded that the assignment of task numbers in octal indicates task priority, that is, the lower the number, the higher the priority of the task. The Task Definitions section, as it initially appears to the user, is shown below. /COMMON TASK NUMBERS - EDITED BY USER /IT IS ADVISABLE TO DEFINE ALL TASKS HERE. NAMES GIVEN BELOW /ARE USED BY SOME SYSTEM TASKS AND SHOULD REMAIN COMMENTED OUT /IF THE CORRESPONDING TASK IS NOT INCLUDED IN THE SYSTEM /PWRF= /POWER FAIL HANDLING TASK /CLOCK= /CLOCK HANDLER - SHOULD BE HIGH PRIORITY /SWAPPER= /NONRESIDENT TASK SWAPPER TASK /TTY= /TELETYPE DRIVER TASK /LPT= /LINE PRINTER DRIVER TASK /MCR= /MONITOR CONSOLE ROUTINE /DTA= /DECTAPE DRIVER TASK /LTA= /LINCTAPE DRIVER TASK /RK8= /RK8 OR RK8E DISK DRIVER TASK /RF08= /RF08 DISK DRIVER TASK /DF32= /DF32 DISK DRIVER TASK /CSA= /CASSETTE DRIVER TASK /CSAF= /CASSETTE FILE SUPPORT TASK /UDC= /UNIVERSAL DIGITAL CONTROLLER TASK /RX8A= /FIRST FLOPPY CONTROLLER /RX8B= /SECOND FLOPPY CONTROLLER /RX8C= /THIRD FLOPPY CONTROLLER /RX8D= /FOURTH FLOPPY CONTROLLER /OS8= NTASKS /OS/8 SUPPORT - NORMALLY LOWEST PRIORITY /OS8F= /OS/8 FILE SUPPORT /DDCMP= /DDCMP TASK FOR DECNET /NSP= /NETWORK SERVICES PROTOCOL TASK /NIP= /NETWORK INFORMATION PROGRAM /TLK= /NETWORK TERMINAL COMMUNICATIONS TASK TRANSMITTER /LSN= /NETWORK TERMINAL COMMUNICATIONS TASK RECEIVER /NULL8A= /NULL JOB FOR PDP-8/A /EXIT= /EXIT TASK /DKC8A= /AUXILIARY DKC8A HANDLER This section of the parameter file is shown in Section 8.1 after it has been modified for the demonstration program. It also shows the addition of the two nonresident tasks used in the demonstration program. 6.1.3 System Task Specifications The parameters in the System Task Specifications section control the assemblies of the various RTS/8 system tasks. The set of parameters controlling a specific task are all grouped to-tether and assembled conditionally only if that task name is defined in the Task Definitions section of the parameter file. The user edits the 6-3 ASSEMBLING AND LOADING TASKS FOR RTS/8 parameters in this section. The parameters and their meanings are listed in Section 6.4. 6.1.4 System Wide Definitions The System Wide Definitions section includes the definitions of the symbols that RTS/8 uses to describe Executive Requests and Task Status Flag bits. It also contains useful definitions such as instruction equivalences, monitor call values, UDC/ICS functional values and system locations. The user should not alter this section. 6.1.5 Task Setup The Task Setup section uses five symbols that the user defines in the body of this task to initialize the RTS/8 table entries needed to put that task in the system. These five symbols and their definitions are: TASK Defines the task number of the task by a statement of the form: TASK=symbol where "symbol" is the symbolic name for the task that the user has defined in the RTS/8 parameter file. CUR Defines the field of the task's starting address in bits 6-8 (e.g., CUR=10). NOTE The user must place the task's starting code in the field specified by CUR. This is done by using the PAL8 assembler pseudo-op FIELD. For example, FIELD CUR%10 places the task's starting code in field 1. START Defines the task's starting address (not necessarily the lowest address in the task) INIWT Defines the initial wait bits in the Task Flags Table entry for this task. For example, INIWT = 0 means the task is runnable when the system starts up; INIWT = RUNWT (1000 octal) specifies that this task is not runnable initially and is in a Run Wait condition. This task becomes runnable when another task issues a RUN ER or when the operator types a Request command to the MCR. If 6-4 ASSEMBLING AND LOADING TASKS FOR RTS/8 INIWT is undefined, the task starts up being runnable. VERS Defines the task's version number, this is an optional parameter. By convention, the task's version number becomes the task's initial MQ value. The user can define up to three tasks in one assembly. The corresponding symbols for the other tasks are TASK2 and TASK3, CUR2 and CUR3, etc. The task setup section places its data into the RTS/8 tables by origining into them; no executable code is generated. If desired, more than three tasks can be created in one assembly by adding the code for any additional tasks at the end of the PARAM.PA file. It should be noted that only one task is defined in the demonstration program in Chapter 8. 6.2 CREATING AN RTS/8 SYSTEM An RTS/8 System can be created by using the general procedure that is described in this section. It is assumed that the user has physically mounted a copy of the distribution medium, and has bootstrapped the development system. Although nonresident tasks are treated in this procedure, greater detail on employing nonresident tasks is given in Chapter 7. The general procedure for creating an RTS/8 System is as follows: 1. Layout on paper the system and user tasks required for the particular RTS/8 configuration to be employed. Utilize the tables and memory map given in Appendix B that show the RTS/8 components, their sizes, and their default origins to determine where the tasks are to be loaded into memory. 2. Assign task names and task priorities. If nonresident tasks are used, assign the Swapper Task a higher priority than any of the nonresident tasks. Remember that the lower the value assigned to a task, the higher its priority. 3. When large programs are involved, a documentation file should be created as a user convenience to maintain a directory of the system configuration. This file can contain information such as the tasks employed in the system, task names, task priorities, and control files. 4. Obtain a listing of the master parameter file (PARAM.PA). Use the OS/8 command .LIST PARAM.PA to get a listing from a line printer, or .TYPE PARAM.PA 6-5 ASSEMBLING AND LOADING TASKS FOR RTS/8 to get a listing from a terminal. 5. Use an editor (EDIT or TECO under OS/8) to establish the values of the parameters in the parameter file (PARAM.PA). The structure of the parameter file is described in Section 6.1, and the parameters affecting the individual RTS/8 system tasks are described in Section 6.6. PARAM.PA should be read in as an input file, edited, and then renamed as an output file. This procedure maintains the integrity of DIGITAL-supplied sources. 6. Create and edit any control files that are used (See Section 6.5). 7. Assemble the tasks with the parameter file after all the required parameters are defined. This can be accomplished by individually assembling each task with the parameter file as follows: .PAL RTS8RE 5($) /REQUEST SAMPLE FROM MCR _______ HELLO /TASK EXECUTES AND SAYS 'HELLO' ^C /RETURNS CONTROL TO MCR __ >SYSTAT /SYSTEM STATUS COMMAND ______ 03 MCR /MCR TASK 04 TTY /TERMINAL TASK 05 R /TASK 5 WAITING TO BE RUN >RE 5($) /RUN TASK AGAIN _______ HELLO /TASK SAYS 'HELLO' AGAIN ^C /RETURN CONTROL TO MCR __ >EXIT /RETURN TO OS/8 ____ . /OS/8 MONITOR NOTE ($) is the ALTMODE character; all other input lines are terminated by a Carriage Return. 6.5 USE OF CONTROL FILES UNDER RTS/8 There are times when a user may want to assemble a given source module in more than one way and use the results under RTS/8. For example, suppose there are three terminals that a user wants to service under RTS/8. Each terminal has its own characteristics, and each copy of the TTY task needs to have its own set of parameters. The user must load three copies of the TTY task into memory at different locations, and possibly in different fields. This cannot be accomplished efficiently when using a single parameter file. With a single parameter file, three copies of the file TTY.PA must be made and each one edited to produce three individual tailored copies of the TTY task. This procedure is not convenient or modular. A better way to do this is to use a control file that contains all the equates necessary to define the parameters needed by a particular TTY task. The control file then is assembled together with and placed between the parameter file and the TTY module. For example, .PAL TTY1 > /FLAG WARNING IF UNDEFINED FIELD SEEN NTASKS=23 CHECKP=1 PARTNS=1 /COMMON PARTITIONS ARE NUMBERED FROM 0 TO N-l) /COMMON TASK NUMBERS - EDITED BY USER /IT IS ADVISABLE TO DEFINE ALL TASKS MERE, NAMES GIVEN BELOW /ARE USED BY SOME SYSTEM TASKS AND SHOULD REMAIN COMMENTED OUT /IF THE CORRESPONDING TASK IS NOT INCLUDED IN THE SYSTEM /PWRF= /POWER FAIL HANDLING TASK CLOCK=1 SWAPPER=16 TTY=2 LPT=3 MCR=4 /DTA= /DECTAPE DRIVER TASK /LTA= /LINCTAPE DRIVER TASK RK8=7 /RF08= /RF08 DISK DRIVER TASK /DF32= /DF32 DISK DRIVER TASK /CSA= /CASSETTE DRIVER TASK /CSAF= /CASSETTE FILE SUPPORT TASK /UDC= /UNIVERSAL DIGITAL CONTROLLER TASK /RX8A= /FIRST FLOPPY CONTROLLER /RX8B= /SECOND FLOPPY CONTROLLER /RX8C= /THIRD FLOPPY CONTROLLER /RX8D= /FOURTH FLOPPY CONTROLLER OS8=NTASKS OS8F=15 NR20=20 NR22=22 /DDCMP= /DDCMP TASK FOR DECNET /NSP= /NETWORK SERVICES PROTOCOL TASK /NIP= /NETWORK INFORMATION PROGRAM /TLK= /NETWORK TERMINAL COMMUNICATIONS TASK TRANSMITTER /LSN= /NETWORK TERMINAL COMMUNICATIONS TASK RECEIVER /NULL8A= /NULL JOB FOR PDP-8/A /EXIT= /EXIT TASK /DKC8A= /AUXILIARY DKC8A HANDLER /SOFTWARE PARAMETERS - EDITED BY USER 8-2 DEMONSTRATION PROGRAM XLIST 1 IFDEF OS8 < XLIST LSTFLG OSFLDS=2 OSTTDV=31 OSKBDV=30 /DEFAULT IS OSTTDV-I OSSYSD=RK8 OSFILL=0 /(EG 4 FOR 2400 BAUD VT05) /OS8ORG= /ORIGIN (IN FIELD 0) XLIST 1> IFDEF MCR < XLIST LSTFLG /MCRCLK= /0 IF MCR TOO FACILITIES TO BE OMITTED (DEFAULT =1) MCRSYS=1 /1 IF DESIRED (DEFAULT) /MCRFLD= /FIELD OF MCR /MCRPRT= /PARTITION NUMBER OF MCR (IF NON-RESIDENT) /MCRCDV= /CONSOLE TO BE USED BY MCR, E.G. TTY /DEFAULT IS TTY XLIST 1> IFDEF CLOCK < XLIST LSTFLG CLKTYP=0 CLKQLN=20 /MAY BE CHANGED BY USER DECIMAL HERTZ=l000 SHERTZ=1 IFNZRO CLKTYP&1 /FORCE DK8EP,KW12 TO 1 KHZ OCTAL XLIST 1> IFDEF LPT < /LPTLOC= /LPTFLD= > IFDEF DTA < /DTALOC= /DTAFLD= > TBLLST= 0 /SET TO 'LSTFLG' IF YOU DON'T DESIRE /TO SEE TABLES WHEN PARAMETER FILE IS /NOT LISTED. /SYSTEM LOCATIONS: MSGTBL= 1200-2 /TASK MESSAGE TABLE TSTABL= NTASKS+2^2+MSGTBL-4 /TASK STATE TABLE - HOLDS /TASK LINK,UM,DF,IF,PC,AC,MQ TFTABL= NTASKS+2^4+TSTABL-1 /TASK FLAGS TABLE - HOLDS /TASK STATUS FLAGS XLIST 1 IFDEF SWAPPER XLIST LSTFLG 8-3 DEMONSTRATION PROGRAM SYS=RK8 SUNIT=0 IFNDEF SUNIT /DEFAULT SWAP UNIT IS 0 FIELD 0 / /PARTITION TABLE (PARTBL) ENTRIES: /MUST BE INITIALIZED BY USER AS EXPLAINED IN THE COMMENTS /DON'T FORGET TO REMOVE LEADING "/" FROM LINES USED / RESTBL= TFTABL+NTASKS+2 /RESIDENCY TABLE PARTBL= NTASKS-SWAPPER^2+RESTBL+3&7774 /PARTITION TABLE *PARTBL XLIST 1 IFNZRO PARTNS < XLIST TBLLST MFLD00=1 ADDR00=00 SIZE00=1 SIZE00^10+MFLD00^10+4000 ADDR00 ZBLOCK 2 XLIST IFNZRO PARTNS-1 < XLIST TBLLST MFLD01= /MEMORY FIELD OF PARTITION #1 ADDR01= /LOWEST ADDRESS IN PARTITION #1 SIZE01= /SIZE OF PARTITION #1 (CORE PAGES) SIZE01^10+MFLD01^10+4000 ADDR01 ZBLOCK 2 XLIST IFNZRO PARTNS-2 < XLIST TBLLST MFLD02= /MEMORY FIELD OF PARTITION #2 ADDR02= /LOWEST ADDRESS IN PARTITION #2 SIZE02= /SIZE OF PARTITION #2 SIZE02^10+MFLD02^10+4000 ADDR02 ZBLOCK 2 XLIST IFNZRO PARTNS-3 < XLIST TBLLST MFLD03= /PARTITION #3 ADDR03= SIZE03= SIZE03^l0+MFLD03^10+4000 ADDR03 ZBLOCK 2 XLIST IFNZRO PARTNS-4 < XLIST TBLLST MFLD04= /PARTITION #4 ADDR04= SIZE04= SIZE04^10+MFLD04^10+4000 8-4 DEMONSTRATION PROGRAM ADDR04 ZBLOCK 2 XLIST IFNZRO PARTNS-5 < XLIST TBLLST MFLD05= /PARTITION #5 ADDR05= SIZE05= SIZE05^l0+MFLD05^10+4000 ADDR05 ZBLOCK 2 XLIST IFNZRO PARTNS-6 XLIST TBLLST MFLD06= /PARTITION #6 ADDR06= SIZE06= SIZE06^10+MFLD06^10+4000 ADDR06 ZBLOCK 2 XLIST IFNZRO PARTNS-7 XLIST TBLLST MFLD07= /PARTITION #7 ADDR07= SIZE07= SIZE07^10+MFLD07^10+4000 ADDR07 ZBLOCK 2 XLIST 1>>>>>>>> / /ADDITIONAL PARTITIONS MAY BE DEFINED BY THE USER AS SHOWN ABOVE /FURTHERMORE, THE PARTITION TABLE MAY RESIDE ANYWHERE IN FIELD ZERO / PRTEND=. /NOTE END OF PARTITION TABLE XLIST 1> IFDEF TTY < XLIST LSTFLG / TTDEV= /PRINTER DEVICE CODE - DEFAULT IS 4 / KBDEV= /KEYBOARD DEVICE CODE - DEFAULT IS TTDEV-1 / CONSOL= /1 MEANS CONSOLE TTY (DEFAULT) / VT50= /1 ENABLES CTRL/S AND CTRL/Q / SCOPE= /1 MEANS TTY CAN DO A BACKSPACE / FILL= /NUMBER OF FILL CHARACTERS, I.E. 4 / WIDTH= /TTY LINE WIDTH (0 MEANS INFINITE), / DEFAULT IS 120 / TAB= /1 IF TTY HAS HARDWARE TABS / OLDTTY= /1 TO USE OLD 2-PAGE TTY HANDLER / LSBOT= /1 LISTS BOTH HANDLERS (DEFAULT 0) / TTFLD= /FIELD OF TTY TASK (TIMES 10) / TTLOC= /LOCATION OF TTY TASK XLIST 1> IFNZRO KL8A < XLIST LSTFLG 8-5 DEMONSTRATION PROGRAM /KL8ADV= /KL8A DEVICE CODE - DEFAULT IS 40 /KL8ACT= /KL8A CONNECT ROUTINE PAGE - DEFAULT IS 7400 XLIST 1> IFDEF EXIT < XLIST LSTFLG /EXITFLD= /FIELD OF EXIT TASK (TIMES 10) /EXITLOC= /LOCATION OF EXIT TASK XLIST 1> XLIST LSTFLG IFNDEF PDP8E IFNDEF PDP12 IFNDEF EAE IFNDEF PWRFAL IFNDEF KL8A XLIST 1 IFDEF NSP < XLIST LSTFLG MAXCCB= /NUMBER OF LOGICAL CHANNELS (CCB'S) BEING USED /E.G. 3 FOR 3 CHANNELS /THESE ARE NUMBERED 1,2,3 MAXNOD= /NUMBER OF NODE NAMES IN NODE TABLE NSPFLD= /FIELD OF NSP TASK AND MOST NETWORK TABLES (E.G. 30) /(TABLES INCLUDE CCBTAB, LNKTAB, NODTAB AND NETTAB) NSPLOC= 2600 /ORIGIN OF NSF TASK, MUST BE .LE. 3200 /THE DEFAULT IS CURRENTLY 3200 NODNUM= /NODE NUMBER OF THIS NODE /IMPORTANT RELATIVE ORIGINS WITHIN NETWORKS TASKS DRLXIT= NSPLOC+4400 /ADDRESS OF AST DE-QUEUER CCBTAB= DRLXIT+200 /ADDRESS OF CCB TABLE NODTAB= CCBTAB+100 /ADDRESS OF NODE TABLE NETTAB= NODTAB+50 /ADDRESS OF NETWORK 'INFORMATION' / TABLE /THE DEFAULT NETWORKS TASKS USE CORE AS FOLLOWS: /DDCMP: PAGE 0, 0200-3577 (l LINE, 2 PAGE NODE POOL) /NSP: PAGE 0, 3200-7577 /NETWORK TASKS USE PAGE 0 AS FOLLOWS: /DDCFLD: 10-12, 30-77 /NSPFLD 15-17, 77-177 /NODE TABLE ENTRIES /EACH ENTRY HAS THE FORM /WORDS 1-3 NODE NAME (6-BlT, 0-PADDED) /WORD 4 LINE NUMBER /WORD 5 BIT 0=1 IF ADJACENT NODE / BITS 4-11 CONTAIN NODE NUMBER 8-6 DEMONSTRATION PROGRAM IFDEF TASK < IFZERO TASK-NSP < FIELD NSPFLD%10 *NODTAB NODTAB, TEXT /NAME/ 0 /LINE NUMBER 0 /NODE NUMBER *NETTAB+4 NODNUM /OUR NODE NUMBER TEXT /NAME/ /OUR NODE NAME FIELD 0 >> > XLIST 1 IFDEF DDCMP XLIST LSTFLG MAXLIN= /NUMBER OF PHYSICAL LINES BEING USED /E.G. 3 FOR 3 LINES /THESE ARE NUMBERED 0,1,2 MAXPKT= 24 /SET TO NUMBER OF NODE POOL PACKETS TO ALLOW /THE NODE POOL EXISTS AT THE END OF DDCMP /JUST BEFORE THE LCB TABLE (SIMILAR TO THE CLOCK QUEUE) /EACH PACKET REQUIRES 14 WORDS OCTAL, (ABOUT 10. PER /PAGE) (THE DEFAULT REQUIRES 2 PAGES CORE) /KG8E= /SET TO IOT SKELETON IF KG8E IS PRESENT (E.G. 6110) UDCFLD= /FIELD OF DDCMP TASK,LCBTAB AND 'NODE POOL' (E.G. 20) /THIS FIELD MUST BE DIFFERENT FROM NSPFLD DDCLOC= 0200 /ORIGIN OF DDCMP TASK /THE ABOVE MUST BE BELOW 5000-SIZE OF NODE POOL AND /LCBTAB. THE DEFAULT IS CURRENTLY 200 LCBSIZ= 32 /GLOBAL DEFINITION OF LCB SIZE (DO NOT ALTER) PKSIZE= 14 /GLOBAL DEFINITION OF PACKET SIZE (DO NOT ALTER) DDCFNC= DDCLOC /ADDRESS OF DDCMP 'FUNCTION CALL' ROUTINE HEADPK= DDCLOC+3020 /ADDRESS OF START OF PACKET FREELIST LCBTAB= MAXPKT^PKSIZE+HEADPK /ADDRESS OF LINE CONTROL BLOCK TABLE /IMPORTANT NETWORKS PAGE 0 GLOBALS DDCEF= 46 /DDCMP I/O EVENT FLAG FREHD= 47 /LOCATION OF I/O PACKET FREELIST HEAD DDCTL= 50 /POINTS TO TAIL OF DDCMP INPUT QUEUE DDCHD= 51 /POINTS TO HEAD OF DDCMP INPUT QUEUE ATNINP= 52 /POINTS TO TRANSMIT COMPLETE RING BUFFER OHDR= 55 /LOCATION OF HEADER BUFFER FOR TRANSMITS OCRCL= 63 /HEADER CRC FOR TRANSMITS ODCRCL= 65 /DATA CRC FOR TRANSMITS OUTCDF= 67 /DATA DESCRIPTOR FOR TRANSMITS DDCUSR= NSP /DEFAULT USER OF DDCMP TASK XLIST 1> 8-7 DEMONSTRATION PROGRAM XLIST 1 IFDEF NIP < XLIST LSTFLG /NIPFLD= /FIELD OF NIP (TIMES 10) /NIPLOC= /LOCATION OF NIP /NIPART= /PARTITION FOR NIP /SKIMP= /SET TO 1 TO GET SHORT NIP /NIPLOG= /DEVICE NIP OUTPUTS TO /DEFAULT IS LPT IF IT EXISTS (OTHERWISE TTY) /NIPRES= /LOCATION FOR RESIDENT PORTION OF NIP /REQUIRED ONLY IF NIPART DEFINED /DEFAULT IS NIPLOC-200 XLIST 1 > IFDEF TLK < XLIST LSTFLG /TLKFLD= /FIELD OF TLK TASK /TLKLOC= /START Of TLK TASK TLKCHN= /CCB CHANNL TO ASSIGN TO TLK TASK XLIST 1 > IFDEF LSN < XLIST LSTFLG /LSNFLD= /FIELD OF LSN TASK (TIMES 10) /LSNLOC= /START OF TLK TASK LSNCHN= /CCB CHANNL TO ASSIGN TO LSN TASK XLIST 1 > XLIST LSTFLG /EQUIVALENCES AC7776= CLL STA RAL AC7775= CLL STA RTL AC4000= CLA STL RAR AC3777= CLL STA RAR AC2000= CLA STL RTR AC0002= CLA STL RTL /MONITOR CALL VALUES: CAL= JMS 20 /CALL THE EXECUTIVE POSTDS= JMP I 24 /DISMISS AN INTERRUPT WAITM= JMS I 25 /WAIT FOR MULTIPLE EVENTS /NOTE "**" MEANS CRITICAL VALUE MAY NOT /BE CHANGED WITHOUT MODIFYING SYSTEM CODE!! SEND= 0 /SEND MESSAGE RECEIV= 1 /RECEIVE MESSAGE WAITE= 2 /WAIT FOR EVENT FLAG RUN= 3 /CONTINUE TASK EXECUTION SUSPND= 4 /SUSPEND TASK EXECUTION POST= 5 /POST AN EVENT FLAG SKPINS= 6 /INSERT CODE INTO INTERRUPT SKIP CHAIN DERAIL= 7 /INITIATE END-ACTION 8-8 DEMONSTRATION PROGRAM BLKARG= 10 /BLOCK TASK FOR REASON SPECIFIED IN ARG SENDW= 11 /SEND MESSAGE AND WAIT UNBARG= 12 /UNBLOCK TASK FOR REASON SPECIFIED IN ARG RESCHD= 13 /FORCE A RESCHEDULE WAITX= 14 /WAIT FOR EXACTLY THIS EVENT FLAG FREE= 4000 /**FREE PARTITION XLIST 1 IFDEF UDC < XLIST LSTFLG AO=0;DO=1;DI=2;GC=3;EC=4;RC=5 DC=6;ECT=7;CS=10;DCT=11;AI=12 XLIST 1> XLIST LSTFLG /TASK STATUS FLAGS: NONRWT= 4000 /**NONRESIDENT TASK WAIT EFWT= 2000 /EVENT FLAG WAIT RUNWT= 1000 /SCHEDULE WAIT SWPWT= 0400 /**SWAPPER WAIT EFRMWT= 0200 /EVENT FLAG OR MESSAGE WAIT USERWT= 0100 /USER SPECIFIED WAIT ENABWT= 0040 /ENABLE WAIT MSGWT= 0020 /MESSAGE WAIT NETWT= 0010 /NETWORK WAIT (RESERVED FOR POSSIBLE FUTURE USE) DNEWT= 0001 /**DOES NOT EXIST WAIT IFNZRO KL8A > TSWFLG= 35 /TASK SW INHIBIT FLAG IN FIELD 0 TODL= 36 /LOW ORDER TIME OF DAY IN FIELD 0 TODH= 37 /HIGH ORDER TIME OF DAY IN FIELD 0 DATE= 40 /DATE IN OS8 FORMAT IN FIELD 0 MCREF= 41 /MCR START EVENT FLAG IN FIELD 0 /SOME USEFUL EQUATES FOR TTY AND LPT MESSAGES: NOPACK=4000 /TEXT IS NOT PACKED IN 6-BIT NOCRLF=2000 /OUTPUT SHOULD NOT BE FOLLOWED BY CR/LF IND=1000 /OUTTXT PTS TO FIRST WORD OF TEXT NOLINE=400 /INPUT IS IN CHARACTER MODE ASSGN=200 /ASSIGNS DEVICE KL8ALINE=100 /USED TO SPECIFY A LINE OF A KL8A XLIST 1 IFDEF CLOCK < XLIST LSTFLG /SOME USEFUL EQUATES FOR STANDARD CLOCK MESSAGES: 8-9 DEMONSTRATION PROGRAM MARKTIME= 0 /POST EVENT FLAG AFTER SPECIFIED INTERVAL SCHEDULE= 1000 /RUN TASK AFTER SPECIFIED INTERVAL TIMOUT= 2000 /DERAIL TASK AFTER SPECIFIED INTERVAL PERIODICALLY= 2000 /USED AS MODIFIER TO 'SCHEDULE' /RE-QUEUES RUN REQUEST AFTER SPECIFIED /INTERVAL E.G. 'SCHEDULE FOO PERIODICALLY' CANCEL= 7000 /DELETE ALL REQUESTS FROM SPECIFIED TASK /FROM QUEUE XLIST 1> XLIST 1 /FORCE LISTING OFF IFDEF TASK < XLIST /TASK TABLE SETUP - "TASK", "CUR","INIWT", AND "START" /MUST BE DEFINED BY TASK: IFNDEF INIWT IFNDEF INIWT2 IFNDEF INIWT3 *TASK^2+MSGTBL ZBLOCK 2 /MESSAGE BUFFER INITIALLY CLEAR *TASK^4+TSTABL CUR%l0+CUR /INITIAL FLAGS START 0 /INITIAL AC 0 XLIST; IFDEF VERS < XLIST VERS /INITIAL MQ XLIST > XLIST *TASK+TFTABL INIWT XLIST > IFDEF TASK2 < XLIST *TASK2^2=MSGTBL ZBLOCK 2 /MESSAGE BUFFER INITIALLY CLEAR *TASK2^4+TSTABL CUR2%10+CUR2 /INITIAL FLAGS2 START2 0 /INITIAL AC 0 XLIST; IFDEF VERS2 < XLIST VERS2 /INITIAL MQ XLIST > XLIST *TASK2+TFTABL INIWT2 XLIST > 8-10 DEMONSTRATION PROGRAM IFDEF TASK3 < XLIST *TASK3^2+MSGTBL ZBLOCK 2 /MESSAGE BUFFER INITIALLY CLEAR *TASK3^4+TSTABL CUR3%10+CUR3 /INITIAL FLAGS3 START3 0 /INITIAL AC 0 XLIST; IFDEF VERS3 < XLIST VERS3 /INITIAL MQ XLIST > XLIST *TASK3+TFTABL INIWT3 XLIST > IFDEF TASK < IFDEF PARTNO < XLIST /RESIDENCY TABLE (RESTBL) ENTRY: /INITIALIZED FOR NONRESIDENT TASKS ONLY *TASK-SWAPPER-1^2+RESTBL PARTNO^4+PARTBL+CPABLE+CPABLE+WRITE XLIST IFNDEF SWAPPER /SWAPPER MISSING IFNZRO TASK-SWAPPER&4000 /NON-RESIDENT TASK /HAS PRIORITY HIGHER THAN SWAPPER >> IFDEF PARTNO < IFNDEF TASK /PARTITION BUT NO TASK IFNDEF SWAPPER /PARTITION BUT NO SWAPPER IFNDEF PARTNO /MISSING PARTITIONS IFZERO PARTNO-PARTNS&4000 /PARTNO.GE.PARTNS > XLIST 0 8-11 DEMONSTRATION PROGRAM 8.2 NONRESIDENT TASK LISTINGS The following are listings of nonresident tasks (NR20 and NR22): 8.2.1 Nonresident Task NR20 TASK=20 0020 TASK=20 0020 TASK=20 0400 START=400 0001 WRITE=1 0001 CPABLE=1 0010 CUR=10 5000 INIWT=RUNWT+NONRWT 0000 PARTNO=0 0001 FIELD CUR%10 0400 *400 10400 4020 CAL 10401 4011 SENDW+FREE 10402 0001 CLOCK 10403 0600 SLPMSG 10404 4020 CAL 10405 4011 SENDW+FREE 10406 0003 LPT 10401 0606 LPTMSG 10410 5200 JMP START 0600 *600 10600 0000 SLPMSG, ZBLOCK 3 10603 0000 0 10604 0000 0;SHERTZ 10605 0001 10606 0000 LPTMSG, ZBLOCK 3 10611 0000 0 10612 0000 0 10615 2401 TEXT /TASK 20 RUNNING/ 10614 2313 10615 4062 10616 6040 10617 2225 10620 1616 10621 1116 10622 0700 8-12 DEMONSTRATION PROGRAM 8.2.2 Nonresident Task NR22 TASK=22 0022 TASK=22 0022 TASK=22 0400 START=400 0001 WRITE=1 0001 CPABLE=1 0010 CUR=10 5000 INIWT=RUNWT+NONRWT 0000 PARTNO=0 0001 FIELD CUR%10 0400 *400 10400 4020 CAL 10401 4011 SENDW+FREE 10402 0001 CLOCK 10403 0630 SLPMSG 10404 4020 CAL 10405 4011 SENDW+FREE 10406 0003 LPT 10407 0636 LPTMSG 10410 5200 JMP START 0630 *630 10630 0000 SLPMSG, ZBLOCK 3 10633 0000 0 10634 0000 0;SHERTZ 10635 0001 10636 0000 LPTMSG, ZBLOCK 3 10641 0000 0 10642 0000 0 10643 2401 TEXT /TASK 22 RUNNING/ 10644 2313 10645 4062 10646 6240 10641 2225 10650 1616 10651 1116 10652 0700 8-13 DEMONSTRATION PROGRAM 8.3 ASSEMBLY AND LOAD PROCEDURE The assembly and load procedure for the demonstration program is as follows: .PAL RTS8SY 01 CLCK O 02 TTY M 03 LPT M 04 MCR 07 RK8 M 15 OS8F M 16 SWAP R 20 R N 22 R N 23 OS8 E >RE 20 RE> 22 >EXIT . In the above example, the user terminates the installation of nonresident tasks with an ALTMODE, and returns to the MCR. A SYstat command is executed which prints a system status report (see Section 6.2.9). The REquest command is then used to run tasks NR20 and NR22. Shown below is output from tasks NR20 and NR22 on the line printer. TASK 20 RUNNING TASK 20 RUNNING TASK 20 RUNNING TASK 20 RUNNING TASK 22 RUNNING TASK 20 RUNNING TASK 22 RUNNING TASK 20 RUNNING The EXIT command is typed to terminate RTS/8 execution and return to the OS/8 monitor. 8-15 CHAPTER 9 ADVANCED RTS/8 PROGRAMMING TECHNIQUES 9.1 PERFORMING A RESCHEDULE 9.1.1 Writing Delicate Code Frequently, a task needs to manipulate data in another task or a common area. Since tasks are running 'simultaneously', problems will arise if two tasks want to access the same data at the same time. Consequently, delicate code wants to run with interrupts disabled while accessing data in another task. NOTE Interrupts may be disabled temporarily using either a IOF/ION pair or, on machines with memory extension, a CIF instruction which inhibits interrupts until the execution of the next JMP or JMS instruction. For example, suppose Task A increments location COUNT occasionally and Task B decrements location COUNT from time to time during program execution. The code might look like the following: /TASK A LOOPA, . . . X, ISZ COUNT . . . JMP LOOPA COUNT, 0 /TASK B LOOPB, . . . STA Y, TAD COUNT Z, DCA COUNT 9-1 ADVANCED RTS/8 PROGRAMMING TECHNIQUES . . JMP LOOPB If Task A increments COUNT the same number of times that Task B decrements COUNT, it would be assumed that COUNT would be 0 at the end of the program. However, this is not necessarily so since a race condition can occur. Suppose that Task A has a higher priority than Task B, and Task A is waiting for an event to occur with COUNT currently containing a 6. Task B is ready to decrement COUNT. However, an interrupt occurs after location Y has been executed. The AC contains a 5 and Task B is ready to store a 5 back into COUNT. The interrupt service routine, noting that the event Task A was waiting for has just occurred, now suspends Task B and resumes Task A. Task A now bumps COUNT from 6 to 7, and then goes back to sleep. Task B then resumes with the AC containing a 5 and stores a 5 into COUNT which is incorrect for proper program execution. This situation is prevented from happening by disabling interrupts around the delicate code. Either of the following two solutions can be employed: Solution 1 Solution 2 /TASK B /TASK B LOOPB, . LOOPB, . . . . . STA CIF CUR IOF STA Y, TAD COUNT Y, TAD COUNT Z, DCA COUNT Z, DCA COUNT ION . . . . JMP LOOPB JMP LOOPB Solution 2 (only usable on machines with memory extension) uses the CIF instruction since it temporarily inhibits interrupts until the next JMP or JMS instruction is executed. 9.1.2 Inhibiting Task Switching Although the procedure in the previous section can be used, it at times can be very inefficient. If it is desired to perform a lot of manipulation on data which could be accessed by other tasks, it may be inappropriate to turn off interrupts. Inhibiting interrupts for long periods of time could affect other portions of the system where timed events are very important. Also, an interrupt can be lost (for example, clock interrupts) if interrupts are turned off for a significant amount of time. 9-2 ADVANCED RTS/8 PROGRAMMING TECHNIQUES For this case, another solution is possible. A task can inform the RTS/8 Executive that it wants to continue to run, and that while it is executing a certain piece of code, no other task should run even if a task of higher priority becomes runnable. This process is known as inhibiting task switching. Task switching should be inhibited only under unusual circumstances and performed with care. While task switching is inhibited, interrupts may still occur and the interrupt service routine will get control. However, if task switching is inhibited, the interrupt service routine will always return control to the interrupted task after the interrupt has been serviced even if higher priority tasks are now runnable. NOTE If the user wishes to manipulate data which is accessed by an interrupt-level routine, interrupts must be inhibited since inhibiting task switching alone will not be sufficient in this case. There are two methods of inhibiting task switching which are as follows: Method 1: Task switching is automatically inhibited whenever a task's PC is less than 100. Thus, delicate code could be placed in the bottom of page 0 of any field. Method 2: A task may inhibit task switching by zeroing location 35 in field 0. This location is symbolically referred to as TSWFLG (task switching flag) and is defined as such in the parameter file. In either case, after the task is through with its delicate code, it may not be sufficient for the task to reset TSWFLG to its original value(l). This is due to the fact that there may be some other higher-priority task that is entitled to run but did not run because task switching was inhibited. The user can find this out by interrogating location TSWFLG. If another task became runnable while task switching was inhibited, the RTS/8 executive sets the task switching flag to -1. When a task is ready to allow task switching again, it must examine this flag before resetting it to 1. If it was -1, the task returns control to the RTS/8 scheduler. This is performed by using the RESCHD ER as follows: CAL RESCHD This ER causes RTS/8 to perform a reschedule that allows the runnable task of highest priority to be executed. If a user does not perform a RESCHD after re-enabling task switching, then a higher priority task which is entitled to run might not run until the next interrupt occurs. The interrupt may never occur, or if it does, it may be too late for proper program execution. 9-3 ADVANCED RTS/8 PROGRAMMING TECHNIQUES The preferred code for inhibiting task switching for Task B which was described previously is shown below: /TASK B LOOPB, . . . CDF 0 DCA I (TSWFLG /INHIBIT TASK SWITCHING STA Y, TAD COUNT Z, DCA COUNT ISZ I (TSWFLG /ALLOW TASK SWITCHING JMP .+3 /SHOULD WE RESCHEDULE? CAL /YES RESCHD CDF CUR /NO . . . JMP LOOPB NOTE Interrupt level routines should not look at or set the TSWFLG. A summary of TSWFLG states is shown in Table 9-1. Table 9-1 Summary of Task Switching Flag (TSWFLG) States -------------------------------------------------------- | TSWFLG State | Value | |--------------------------------|---------------------| | Task switching allowed | 1 | | Task switching inhibited | 0 | | Task switching inhibited; | | | reschedule as soon as possible | -1 | -------------------------------------------------------- 9.2 EXECUTIVE REQUESTS FOR ADVANCED APPLICATIONS 9.2.1 WAITM - Waiting for Multiple Event Flags Sometimes it is desirable to wait for a logical combination (AND or OR) of Event Flags. Waiting for the logical AND of two Event Flags is quite simple. The sequence: 9-4 ADVANCED RTS/8 PROGRAMMING TECHNIQUES CAL WAITE A /WAIT FOR EVENT FLAG A CAL WAITE B /AND THEN WAIT FOR EVENT FLAG B waits until both A and B have been POSTed. Waiting for the logical OR of several event flags is more difficult since there is a possible race condition between the various tests and the interrupts (or task executions) which POST the Event Flags involved. The key to waiting for an OR of several Event Flags successfully is not to allow any interrupts to occur between the testing of the first Event Flag and the placing of the task in a Wait state if none of the flags were POSTed. This is accomplished by using a special sequence of instructions and a special RTS/8 call named WAITM. WAITM is defined as JMS I 25. It must be executed with interrupts off, the Instruction Field set to 0 and the Data Field set to the current field, and it must be followed by a word containing the blocking bit(s) to be set in the Task Flags Table. The action of WAITM is equivalent to the action of the RTS/8 BLKARG ER except that a fast path through the RTS/8 Executive is taken and interrupts remain off until the blocking bits are on in the Task Flags Table. For an example of the use of WAITM, assume that a task "TASK" wants to test two Event Flags A and B. If A is POSTed, control should go to location ADONE; if B is POSTed control should go to location BDONE. If neither is POSTed, the task must wait until one of them is POSTed. The code to perform this function is: TESTAB, IOF /INTERRUPTS OFF - DELICATE CODE TAD A SNA CLA JMP ADONE /ADONE MUST TURN INTERRUPTS ON TAD (4000+TASK /SET A TO "WAITING" STATE /INDICATING DCA A /THAT THIS TASK IS WAITING ON IT TAD B SNA CLA JMP BDONE /BDONE MUST TORN INTERRUPTS ON TAD (4000+TASK /SET B TO "WAITING" STATE /INDICATING DCA B /THAT THIS TASK IS WAITING ON IT CIF 0 CDF CUR WAITM EFWT /BLOCK TASK ON EVENT FLAG WAIT JMP TESTAB /WE'RE BACK - ONE OF THE TWO /EVEMT FLAGS HAS BEEN POSTED. /GO BACK TO FIND OUT WHICH ONE 9-5 ADVANCED RTS/8 PROGRAMMING TECHNIQUES 9.2.2 WAITX - Wait for Exactly This Event Flag The WAITX ER is similar to the WAITE ER. The exception is that if the Event Flag is not FINISHED, the task goes into EORMWT (instead of EFWT), and the task's PC in the TSTABL points back to the location containing the CAL of this ER. Thus, when the task resumes execution, it will re-execute the WAITX. If the EORMWT bit was cleared for some reason other than the Posting of the Event Flag in question, the task will immediately go back into EORMWT. Consequently, control will never flow past this ER unless the Event Flag specified is actually posted (see discussion of DERAIL, Section 9.2.3). If a WAITE had been used and if the task was waiting on multiple Event Flags (which can happen using WAITM), then control conceivably could start up after the WAITE ER because some other Event Flag, and one that is no longer cared about, was posted. This situation can not occur with a WAITX. 9.2.3 DERAIL - Derail a Task's Execution The DERAIL ER modifies the execution of a specified task and transfers control to a special subroutine of the task to process some exceptional condition. It does not cause any wait bits to get set or cleared. Format: TAD TASKNUM CAL DERAIL ADDR This ER simulates a "JMS ADDR" for the task whose number is contained in TASKNUM (the "derailed" task). ADDR is assumed to be in the same field in which the derailed task is executing. The derailed task's PC (from its Task State Table entry) is stored in ADDR; the PC entry in its Task State Table entry is then set to ADDR-~1. Two important points concerning the operation of the DERAIL ER are as follows: 1. The derailed task's AC, Link, and Data Field settings are not saved by the DERAIL ER; therefore they must be saved and restored by the derail subroutine. In this sense, a derail subroutine is very much like an interrupt at the task level. 2. The contents of the derailed task's Task Flags word are not affected by the DERAIL ER. If the derailed task is not runnable, the derail subroutine will not be executed until the task becomes runnable. The DERAIL ER is generally used by a high priority task to signal an emergency condition to lower priority tasks. An example would be a process-control environment where it is sometimes necessary to abort all operations if the room temperature exceeds some critical value. This can be checked by a task which measures room temperature every 10 seconds. It is inefficient and unmodular to include shutdown code in this "watchdog task" for all machinery being controlled. A better 9-6 ADVANCED RTS/8 PROGRAMMING TECHNIQUES solution is to provide a location to which each equipment-controlling task can be DERAILED in order to shut down its own piece of equipment. The RTS/8 Power-Fail task uses the DERAIL ER to provide a similar facility on power-fail recovery (see Section 4.5), which can be used to reinitialize a task. Example: An example of a DERAIL routine is as follows: DENTRY, 0 /DERAIL ROUTINE ENTRY POINT DCA SAVAC /SAVE AC RAR DCA SAVLNK /SAVE LINK RDF TAD (CDF DCA DFRESET /SAVE DATA FIELD CDF CUR . /HANDLE EMERGENCY CONDITION . . /BRANCH TO 'RESUME' IF YOU WANT /TO RESUME WHERE YOU LEFT OFF /BRANCH TO 'NORESUME' IF NOT . RESUME, TAD SAVLNK /RESTORE LINK CLL RAL TAD SAVAC /RESTORE AC DFRESET, HLT /RESTORE DF JMP I DENTRY /RESUME (SAME FIELD) NORESUME, CLA CLL CDF CUR JMP RESTART /RESTART TASK SAVAC, 0 SAVLNK, 0 9.2.3.1 Dangers of DERAIL - A task can get into serious trouble if it is derailed while already in a derail routine. If this happens, the original PC, AC, link, etc., will be lost. There is no simple solution. Turning off interrupts in the derail routine may be too late to prevent this - the second derail could have already occurred before the derail routine was even entered the first time. Consequently, a user doing a DERAIL should make sure that not more than one DERAIL is done at a time. Alternatively, before doing a DERAIL, a task can check an interlock flag (which it must maintain) to see whether the target task has been derailed or not. The test and set of such a flag should be performed with interrupts inhibited. 9.2.3.2 Restrictions Using DERAIL - If a task is not runnable, derailing it will not make it runnable. If the task is in Event Flag Wait, it will remain in Event Flag Wait until the event occurs. When the Event Flag is POSTed, the task will wake up and begin to run in 9-7 ADVANCED RTS/8 PROGRAMMING TECHNIQUES its derail routine rather than in the mainline routine. Thus, derailing a task to get it to perform some important job immediately may not always work. The task might be in one of the Wait states and may not be able to run for some time. For example, if the task were in Receive Wait at the time, the derail routine would not run until a message came in for that task. A partial solution around this restriction is to code the task to be derailed so that it always waits on events using WAITX instead of WAITE. Then, if the user wants to derail this task, the task is first taken out of MSGWT or EORMWT and then derailed. An example of the code for this situation is as follows: TAD TASKNUM CAL UNBARG /UNBLOCK THE TASK MSGWT!EORMWT /FROM MESSAGE-RELATED WAITS TAD TASKNUM CAL DERAIL DENTRY This will work because both the RECEIVE and the WAITX Executive Requests bump the PC back to the CAL before going into a Wait state. Thus, no harm is done if the task is taken out of that wait state for an incorrect reason. When the task resumes running at that point, it will re-execute the CAL (RECEIVE or WAITX) and go back into the Wait state as necessary. This method will not work if the task was in EFWT due to a WAITE ER because the task would resume running thinking the Event Flag had been posted when in fact it had not. A way to circumvent this (other than WAITX) is for the task to do WAITM instead of a WAITE, and poll the Event Flag upon waking up. 9.3 STARTING PARTITIONS AT AN ARBITRARY BOUNDARY The advanced user can start a partition at an arbitrary boundary by using the following assembly and loading procedure. The example given assumes that the partition in which the user writes the nonresident portion of the task to run is three pages long (11200-11777). The PAL8 pseudo-operators FIELD and RELOC are used, and described in detail in the OS/8 handbook. /TASKX FIELD 1 /SET FIELD *1000 /LOAD THIS CODE AT 11000-11577 RELOC 1200 /BUT ASSEMBLE IT TO RUN AT 11200-11777 . . . . PAGE . 9-8 ADVANCED RTS/8 PROGRAMMING TECHNIQUES . . . RELOC The assembly, load and save procedures for the code are: .R PAL8 *TASKX| | V | ------------------ | | INHIBIT TASK | | | SWITCHING. | | | CLEAR RESCAN | | | FLAG | | ------------------ | | | |<---------- V ------------------ | ION | ------------------ | V ------------------ | SAVE CALLING | | FIELD | ------------------ | V ------------------ | SAVE RETURN | | ADDRESS | ------------------ | V To page C-3 C-2 RTS/8 FLOWCHARTS From page C-2 | ------------------ | GET FUNCTION | | CODE | ------------------ | V SW designates an operation that ------------------ is performed only when using | SAVE | nonresident operations. | COMMAND | ------------------ EAE designates an operation that SW | is performed only when the Extended | Arithmetic Element is used. --------- | V ------------------ | EXECUTE | | DISPATCH JUMP | | THRU COMMAND | | TABLE. IGNORE | | FREE BIT | ------------------ | Function | Code V **** | ------------------ * * V | JMP I .+FUNC+1 |<----------------------* CMDJMP * ------------------ * * 0 | XSEND | Pg. C-5 **** ------------------ 1 | XRECEIV | Pg. C-17 ------------------ 2 | XWAITE | Pg. C-10 ------------------ 3 | XRUN | Pg. C-28 ------------------ 4 | XSUSPND | Pg. C-28 ------------------ 5 | XPOST | Pg. C-20 ------------------ 6 | XSKPINS | Pg. C-21 ------------------ 7 | XDERAL | Pg. C-22 ------------------ 10 | XBLKARG | Pg. C-19 ------------------ 11 | XSENDW | Pg. C-5 ------------------ 12 | XUNBARG | Pg. C-18 ------------------ 13 | XTSTOP | Pg. C-13 ------------------ 14 | XWAITX | Pg. C-10 ------------------ C-3 RTS/8 FLOWCHARTS ***** * * * EXRET * * * ***** | | V ----------------- | SET UP | | RETURN FIELD | ----------------- | | | | V ////// \\\\\\ TSWFLG = -1 --------------- TSWFLG=1 / \ Yes | KEEP TASK | ------------ / TASKSWITCHING \ | SWITCHING | | Cannot |<-------------\ NEEDS RESCAN /----------->| INHIBITED | | Happen | \ ? / --------------- ------------ \\\\\\ ////// | | V | TSWFLG = 0 ***** | No * * | * TSTOP * V * * ----------------- ***** | ALLOW TASK- | (Pg. C-13) | SWITCHING | | JMP I 20 | | RETURN TO | | CALLING TASK | ----------------- C-4 RTS/8 FLOWCHARTS --------- --------- | SEND | | SEND | | SENDW | | SENDW | --------- --------- **** *** * * * * * XSENDW * * XSEND * * * * * **** *** | | V V --------------- --------------- Calling Sequence | SET | | CLEAR | p+1 SEND (W) | WAIT FLAG | | WAIT FLAG | p+2 TASK # (Sending to) --------------- --------------- p+3 MSGADR | | P+4 RETURN --------------------- | | V ----------------- | GET TASK | | NUMBER TO | | SEND MSG TO | ----------------- | | V ----------------- | GET MESSAGE | | ADDRFSS | ----------------- | | V To page C-6 Initial Values | Becomes -------------------------|-------------------- | p | MSGADR, 0000 | Sending Task # | -------------------------|-------------------- | p+1 | 0000 | CDF to next | | | | msg, if any | -------------------------|-------------------- | p+2 | 0000 | Addr of next | | | | msg (0 if none) | -------------------------|-------------------- | p+3 | Start of Message | ---------------------------------------------- C-5 RTS/8 FLOWCHARTS From page C-5 | V //////////\\\\\\\\\\ / \ / MESSAGE \ Yes / ALREADY IN QUEUE \ ---------------\ (FIRST WORD OF MESSAGE / | \ =0) ? / | \ / | \\\\\\\\\\////////// | | | | No V | **** ------------------- | * * | BACKUP RETURN | |<----------* MSGFRE * | TO CAL | | * * | ADDRESS | | **** ------------------- V | ------------------- **** | | BUMP RETURN | * * | | TO | * MSEFWT *--------->| | CAL+4 | * * | ------------------- **** | | V | ------------------- V | AC= | ------------------- | MESSAGE | | FIND RECEIVING | | ADDRESS | | TASK #'s | ------------------- | ENTRY IN | | | MSGTBL | | ------------------- V | *** | * * V * WAITS * ------------------- * * | GET DATA | *** | FIELD OF | (Pg. C-10) | MESSAGE | ------------------- | | V **** * * * ADDTOQ * * * **** (Pg. C-7) C-6 RTS/8 FLOWCHARTS **** * * * ADDTOQ * * * **** | | V ------------------ | GET FIRST | | QUEUE WORD | | (CDF TO NEXT) | ------------------ | | ////\\\\ Yes / \ -----------------------/ EMPTY \ | \ (=0) ? / | \ / | \\\\//// | | | | No | V | ------------------ | | CDF INTO | | | NEXT | | | MESSAGE | | ------------------ | | | | | V | /////////\\\\\\\\\\ | / \ | / IS \ | / SENDING TASK \ No --------------- | / NUMBER LESS THAN TASK \------>| FIND NEXT | | \ NUMBER IN THIS / | MESSAGE IN | | \ QUEUE MSG / | QUEUE | | \ ? / --------------- | \ / | **** \\\\\\\\\////////// | * * | V * ENDOFQ *---------------------->| Yes **** * * | * * **** | * ADDTOQ * | * * V **** To Page C-8 (Pg. C-7) C-7 RTS/8 FLOWCHARTS From Page C-7 | V ------------------ | PUT CDF TO | | MSG AND PC OF | | MSG INTO | | QUEUE WORDS | ------------------ | | V ------------------ | IOF | ------------------ | | V ------------------ | GET TASK # | | TO SEND | | MESSAGE TO | ------------------ | | V ------------------ | FREE MSG WAIT | | AND/OR EVENT | Via call to FREEJ | WAIT BITS IN | | STATUS TABLE | ------------------ | | V -------------------- | L=1 IF REVEIV- | | ING TASK IS | This will be tested if | RUNNABLE & OF | this CAL was a SEND | HIGHER PRIORITY | and not a SENDW. | THAN SENDER; | | L=0 IF NOT | -------------------- | | V To Page C-9 C-8 RTS/8 FLOWCHARTS From Page C-8 | D **** | O * * | * MSGCDF *----------->| N * * | O **** V T ------------------- | STORE SENDING | T | TASK NUMBER | O | IN MSG HEADER | U ------------------- C | H Link indicates | whether a new V L task should be ------------------- I run or not. | STORE CDF TO | N | NEXT MSG IN | =0 if none K The link status | MSGHDR | will be checked ------------------- I later on in | N POSTEX. | V T ------------------- H | STORE PC OF | I | NEXT MSG IN | =0 if none S | MSGHDR | ------------------- Message is now C | linked into the O | message queue D | E V ////\\\\ **** ! / \ No * * ! / CAL WAS \---------->* POSTEX * ! \ SENDW / * * ! \ ? / **** ! \\\\//// (Pg. C-18) | | Yes V **** * * * MSEFWT * * * **** (Pg. C-6) C-9 RTS/8 FLOWCHARTS --------- --------- | WAITE | | WAITE | | WAITX | | WAITX | --------- --------- **** **** * * * * * XWAITE * * XWAITX * * * * * **** **** | | | | V V Calling Sequence: ------------- --------------- | CLEAR | | SET ACARG | p CAL | ACARG | | TO -1 | p+1 WAITE ------------- --------------- p+2 EVENT FLAG ADDR | | p+3 RETURN -------------------->| | V ------------------- Enter Here From | GET ADDRESS | SEND or SENDW | OF EVENT FLAG | (Pg. C-6) ------------------- **** | * * | * WAITS *-------------------->| * * | **** V ------------------- ACARG /= -1 | SAVE ADDRESS | | OF EVENT FLAG | ------------------- | | V ------------------- | IOF | ------------------- | | V ////\\\\ **** / \ Yes * * / EVENT \---------->* EXRET * \ FLAG = 0 / * * \ / **** \\\\//// | No Restart caller if | TASKSW allows V (Pg. C-4) To Page C-11 C-10 RTS/8 FLOWCHARTS From Page C-10 | V ------------------- | EVTFLG = | Give it waiting | 4000 + TASK # | status ------------------- | V ////\\\\ Yes / \ ------------------/ WAS THIS \ | \ A WAITX / | \ ? / | \\\\//// V | No ----------------- | | PUSH PC BACK | V | TO POINT TO | --------------- Store Event Flag | CAL | | AC = EFWT | Wait in Flag Table ----------------- --------------- | | | | V V ----------------- **** Jump with link clear | AC = EORMWT | * * (tested at TSTOP) ----------------- * TSWAIT * (Pg. C-12) | * * | **** V **** * * * TSWAIT * * * **** (Pg. C-12) C-11 RTS/8 FLOWCHARTS (Pg. C-17) **** * * Wait for mesasge. * WAITM3 * Enter here from RECEIVE. * * **** | | V ----------------------- | BACKUP CALLING PC | | TO DO CALX AGAIN | ----------------------- | V ------------------- | SET LINK | Message Wait Status | AC = MSGWT | ------------------- **** | * * | * TSWAIT *-------------------->| * * | **** V ------------------- | SAVE AC IN MASK | (Pg. C-19) ------------------- **** | * * | * TSWATX *-------------------->| * * | **** V ----------------------- | STORE IN TASK #'s | | FLAG TABLE ENTRY | ----------------------- | V ------------------- Interrupts were off | ION | here if we came from ------------------- XWAITE. | V To Page C-13 C-12 RTS/8 FLOWCHARTS From Page C-12 | V ///\\\ / \ Yes / LINK \------------ \ SET ? / | \ / | \\\/// | | No | V | ------------------- | | CLEAR TASK AC | | ------------------- | **** | | * * | | * TSTOP *-------------------->| | * * | | **** V | ---------------------- | | SAVE AC IN ACARG | | ---------------------- | | | |<---------------- V ----------------------------- | GET TASK NUMBER'S ENTRY | | IN STATUS TABLE | ----------------------------- | V ------------------- | SAVE RESTART | | FLAGS, PC, AC | ------------------- | V ------------------- | SAVE MQ | ------------------- EAE | V --------------------------- | FREE PARTITION IF FREE | | BIT WAS SET IN COMMAND | --------------------------- SW | **** | * * |<----------------* FINDJ * | * * | **** V RTS/8 Scheduler To Page C-14 (Pg. C-30) C-13 RTS/8 FLOWCHARTS From Page C-13 | V Schedule next ------------------- runnable task | TASK # = 1 | (start scan ------------------- from top) | V ------------------- | ENABLE | | TASKSWITCHING | ------------------- | V ------------------------- | SET 'MACHINE STATUS | | UNIMPORTANT' FLAG | ------------------------- **** | * * | * FINDJL *-------------------->| * * ^ | **** | V | ----------------------- | | GET TASK #'s ENTRY | | | IN FLAG TABLE | | ----------------------- | | | | Interrupts temporarily | | inhibited here. | | | V | /////\\\\\ **** | / \ Yes * * | / FLAGS = 0 \--------->* STARTJ * | \ (RUNNABLE) / * * | \ ? / **** | \\\\\///// (Pg. C-15) | | No | | | | Note no end of table | | check - there must be | | a runnable task. | | (Null task is always | | runnable.) | V | ---------------------- | | BUMP TASK NUMBER | | ---------------------- | | | | --------------------- C-14 RTS/8 FLOWCHARTS **** * * Here from FINDJ * STARTJ * (Scheduler) * * Found a runnable task **** | V ------------------- | ION | ------------------- | V ----------------------- | GET TASK #'s ENTRY | | IN STATUS TABLE | ----------------------- | V ------------------- | IOF | ------------------- | V ----------------------- | SAVE OLD STATUS IN | | TEMP LOCS OF | | INTERRUPT ROUTINE | ----------------------- | Interrupt | Dismiss code | | | **** | * * | * DISMIS *-------------------->| * * | **** | V /////\\\\\ **** / \ Yes * * This is tested on / PENDING \--------->* USERSK * an 8/E or 8/a only \ INTERRUPTS / * * \ ? / **** \\\\\///// (Pg. C-23) | No V --------------------------- | SWEEP OLD STATUS INTO | | DF, IF, AC, PC, ETC. | --------------------------- | V To Page C-16 C-15 RTS/8 FLOWCHARTS From Page C-15 | V ------------------- | RESTORE MQ | ------------------- EAE | V ------------------- | ION | ------------------- | V --------------------------- | JMP I 0 | | RETURN FROM INTERRUPT | --------------------------- C-16 RTS/8 FLOWCHARTS ---------- ---------- | RECEIV | | RECEIV | ---------- ---------- ***** Calling Sequence: * * * XRECEIV * p-1 TAD ARG * * p CAL ***** p+1 RECEIV | p+2 MADDR, 0 | p+3 RETURN V ------------------- | GET ENTRY IN | | MESSAGE QUEUE | ------------------- | V ------------------- | GET FIRST WORD | | OF QUEUE ENTRY | ------------------- | V /////\\\\\ **** / \ Yes * * ------------------->/ EMPTY \--------->* WAITM3 * | \ (NO MSGS) / * * | \ ? / **** | \\\\\///// (Pg. C-12) | | No | V | /////\\\\\ ----------------- | / \ No | UNLINK THIS | | / ARG = 0 \--------->| MESSAGE FROM | | \ ? / ^ | THE QUEUE | | \ / | ----------------- | \\\\\///// | V | | Yes | ----------------- | V | | STORE ADDR | | /////\\\\\ | | OF MESSAGE | ----------------- / \ | | IN CAL+2 | | ADVANCE TO | No / SENDING \ Yes | ----------------- | NEXT MESSAGE |<---------/ TASK OF MSG \----| V | ON THE QUEUE | \ = ARG / ----------------- ----------------- \ / | AC = CDF TO | \ ? / | MESSAGE | \\\\\///// ----------------- V **** * * * EXRET * * * **** (Pg. C-4) C-17 RTS/8 FLOWCHARTS ---------- ---------- | UNBARG | | UNBARG | ---------- ---------- ***** * * * XUNBARG * * * ***** | V ------------------- | GET BIT MASK | | FROM ARG LIST | ------------------- | **** | * * |<-----------------* UNBLOK * | * * V **** ------------------- | IOF | ------------------- | Call FREEJ V --------------------- L=1 if clearing mask | CLEAR MASK BITS | bits makes task | IN FLAG TABLE | runnable and it is --------------------- higher priority; | L=0 otherwise. V ------------------- | ION | (Pg. C-9) ------------------- **** | * * | * POSTEX *-------------------->| * * | **** V /////\\\\\ **** / \ No * * / RUN NEW \--------->* EXRET * \ TASK / L = 0 * * \ ? / **** \\\\\///// (Pg. C-4) | Yes L = 1 | V **** * * * TSTOP * * * **** (Pg. C-13) C-18 RTS/8 FLOWCHARTS ---------- ---------- | BLKARG | | BLKARG | ---------- ---------- ***** Calling Sequence: * * * XBLKARG * p-1 TAD TASK # * * p CAL ***** p+1 BLKARG | p+2 WAITBITS | p+3 RETURN V ------------------- | GET WAIT BITS | | FROM ARG. LIST | (Pg. C-28) ------------------- **** | * * | * BLOK *-------------------->| * * | **** V /////\\\\\ / \ **** / CALLING \ Yes * * / TASK TO BE \-------->* TSWATX * \ BLOCKED / * * \ (TASK# = 0)/ **** \ ? / (Pg. C-12) \\\\\///// | No V ----------------------- | SET MASK BITS IN | | FLAG TABLE ENTRY | | OF SPECIFIED TASK | ----------------------- | V ***** * * * EXRET * * * ***** (Pg. C-4) C-19 RTS/8 FLOWCHARTS ---------- ---------- | POST | | POST | ---------- ---------- ***** * * * XPOST * * * ***** | Calling Sequence: V ------------------- p-1 TAD EFPTR | SAVE ORIGINAL | p CAL | EVENT FLAG | p+1 POST ------------------- p+2 ECDF, CDF EFFLD | p+3 RETURN V ---------------------- | CLEAR EVENT FLAG | ---------------------- | V /////////\\\\\\\\\ / \ **** / WAS SOMEONE \ No * * / WAITING FOR THIS TO \------------>* EXRET * \ HAPPEN (OLD FLAG / * * \ NEGATIVE) / L=0 **** \ ? / (Pg. C-4) \\\\\\\\\///////// L=1 | Yes V ------------------------- | GET WAITING TASK'S # | | FROM LOW ORDER BITS | | OF THE OLD FLAG | -------------------------- | V --------------------------- | CLEAR BOTH EVENT FLAG | | WAIT AND EVENT OR | | MESG WAIT | --------------------------- | V ***** * * * UNBLOK * * * ***** (Pg. C-18) C-20 RTS/8 FLOWCHARTS ---------- ---------- | SKPINS | | SKPINS | ---------- ---------- ***** Calling Sequence: * * * XSKPINS * p CAL * * p+1 SKPINS ***** p+2 MODULE ADDR | p+3 RETURN | V ------------------- | GET FIRST | | MODULE NAME | ------------------- | V /////\\\\\ / \ No ------------------- / IS IT 0 \-------->| ALREADY IN THE | \ ? / | SKIP CHAIN !!! | \ / ------------------- \\\\\///// | | Yes V V ***** ----------------------- * * | PUT DISMIS ROUTINE | * EXRET * | ADDR IN 1st WORD | * * ----------------------- ***** | (Pg. C-4) V --- ------------------- | PUT CDF, CIF OF | | DISMIS IN 2nd WORD | ----------------------- | V ------------------------- | PUT MODULE ADDRESS | | AND CDF, CIF IN LAST | | MODULE OF INTERRUPT | | SKIP CHAIN | ------------------------- | V ***** * * * EXRET * * * ***** (Pg. C-4) C-21 RTS/8 FLOWCHARTS ---------- ---------- | DERAIL | | DERAIL | ---------- ---------- **** * * * XDERAL * * * **** | V ------------------- Calling Sequence: | GET TASK #'s | | STATUS TABLE | p-1 TAD TASK # | POINTER | p CAL ------------------- p+1 DERAIL | p+2 SUBROUTINE V p+3 RETURN ------------------- | STORE RESTART | | PC IN SUBR | ------------------- | V ------------------- | STORE SUBR+1 | | IN RESTART PC | ------------------- | V ***** * * * EXRET * * * ***** (Pg. C-4) C-22 RTS/8 FLOWCHARTS ********* * * * INTERRUPT * * ROUTINE * * * ********* | | V /////\\\\\ / \ ******* / TIME \ Yes * GO TO * / SHARING \--------->* OS/8 * \ INTERRUPT / * SUPPORT * \ ? / ******* \ / if present \\\\\///// | No | V ------------------- | SAVE THE | | MACHINE STATUS | (Pg. C-15) ------------------- **** | * * | * USERSK *-------------------->| * * | **** V --------------------- | USER-INSERTED | | SKIPS FOR ANY | | CRUCIAL DEVICES | --------------------- | | V ***** /////\\\\\ * * / \ * GO TO * Yes / KL8A \ * APPROPRIATE *<---------\ INTERRUPT / * INTERRUPT * \ ? / * MODULE * \\\\\///// ***** | No | V To Page C-24 C-23 RTS/8 FLOWCHARTS From Page C-23 | V /////\\\\\ ------------------- / \ Yes | SET UP LOC 0 | / POWER \-------->| FOR POWER FAIL | \ FAILURE / | RESTART | \ ? / ------------------- \\\\\///// | | No V V ******** /////\\\\\ * * ******* / \ * HALT * * GO TO * Yes / CLOCK \ * * * CLOCK *<-----------\ / ******** * HANDLER * \ ? / ******* \\\\\///// as CPU restarts if present | No ************ V * * ********* * POWER-UP * * * * RESTART * * GO TO FIRST * * * * USER INTER- * ************ * RUPT MODULE * | * * V ********* ------------------- | AC = POWER-UP | | EVENT FLAG | | ADDRESS | ------------------- | V **** * * * DSPOST * * * **** (Pg. C-25) C-24 RTS/8 FLOWCHARTS ---------- ---------- | POSTDS | | POSTDS | ---------- ---------- (Pg. C-24) ***** * * * DSPOST * * * ***** | Come here from user V issusing POSTDS /////\\\\\ **** / \ p-3 CDF EFFLD * * Yes / AC = 0 \ p-2 TAD EFPTR * DISMIS *<--------------\ ? / p-1 COF 0 * * \ / p POSTDS **** \\\\\///// (Pg. C-15) | No V ---------------------- | SAVE THE OLD | | EVENT FLAG VALUE | ---------------------- | V --------------------- | ZERO EVENT FLAG | --------------------- | V ////////\\\\\\\\ / \ **** / WAS A \ Yes * * / TASK WAITING \------------->* DISMIS * \ ON THIS FLAG? (OLD / * * \ VALUE NEGATIVE) / **** \ ? / (Pg. C-15) \\\\\\\\//////// | No V -------------------------- | CLEAR EVENT FLAG AND | | EVENT OR MESSAGE | Call FREEJ | WAIT BITS IN TABLE | | ENTRY OF WAIT TASK | -------------------------- | V To Page C-26 C-25 RTS/8 FLOWCHARTS From Page C-25 | V /////\\\\\ Run the waiting task if / \ **** its flag word is now / RUN \ No * * zero and it is higher / WAITING \--------->* DISMIS * priority than the \ TASK / * * current user. \ ? / **** \ / (Pg. C-15) \\\\\///// | Yes V /////\\\\\ / \ ----------------- / TASK \ Yes | SET RESCAN | / SWITCHING \--------->| FLAG | \ INHIBITED / | CTSFWLG = -1 | \ ? / ----------------- \ / | \\\\\///// V | No **** V * * /////\\\\\ * DISMIS * / \ * * No / IS SAVE \ **** -----------------\ STATE FLAG / (Pg. C-15) | \ -1 / | \\\\\///// | | Yes | V | ------------------------ | | SAVE CURRENT TASK'S | | | PC, AC IN ITS | | | STATUS TABLE ENTRY | | ------------------------ | | | V | ------------------- | | SAVE TASK'S MQ | | ------------------- | EAE | |--------------------->| V ------------------- | ION | ------------------- | V To Page C-27 C-26 RTS/8 FLOWCHARTS From Page C-27 | V ------------------- | PREPARE TO | | START NEW TASK | ------------------- | V /////\\\\\ **** / \ No * * / IS IT \----------------->* FINDJ * \ RESIDENT / * * \ ? / **** SW \\\\\///// (Pg. C-30) | Yes V **** * * * STARTJ * * * **** (Pg. C-15) C-27 RTS/8 FLOWCHARTS --------- --------- | RUN | | RUN | --------- --------- ***** * * * XRUN * * * ***** | Calling Sequence: V ------------------- p-1 TAD TASK # | AC = RUNWT | p CAL ------------------- P+1 RUN | Run Wait p+2 RETURN V ***** * * * UNBLOK * Go and set the * * flag bits. ***** (Pg. C-18) ---------- ---------- | SUSPND | | SUSPND | ---------- ---------- ***** * * * XSUSPND * * * ***** | Calling Sequence: V ------------------- p-1 TAD TASK # | AC = RUNWT | p CAL ------------------- p+1 SUSPND | p+2 RETURN V ***** * * * BLOK * * * ***** (Pg. C-19) C-28 RTS/8 FLOWCHARTS --------- --------- | WAITM | | WAITM | --------- --------- ***** * * * XWAITM * * * ***** | V ------------------- | SAVE AC IN | | 'COMMAND' | ------------------- SW | V ------------------- | CLEAR AC, L | ------------------- | V ------------------- | FAKE A CAL | ------------------- | V ------------------- | DISABLE TASK | | SWITCHING | ------------------- | V ------------------- | PUT WAIT | | BITS IN AC | ------------------- | V ***** * * * TSWAIT * * * ***** (Pg. C-12) C-29 RTS/8 FLOWCHARTS ***** * * RTS/8 SCHEDULER * FINDJ * FIND A TASK TO RUN * * ***** | V ------------------- | ENABLE TASK | | SWITCHING | ------------------- | V ----------------------- | GET SET TO | | EXAMINE FIRST TASK | ----------------------- | V ------------------- | ZERO SAVE | | STATE FLAG | ------------------- | ---------------------->| | V | ------------------- | | ION | | ------------------- | | | V | ------------------- | | BUMP TO | | | NEXT TASK | | ------------------- | | | V | ------------------- | | IOF | | ------------------- | | | V | ------------------- | | GET TASK FLAGS | | ------------------- | | ^ V From Page C-31 To Page C-31 C-30 RTS/8 FLOWCHARTS To Page C-30 From Page C-30 ^ | | V | //////\\\\\\ | / \ | / ANY \ | Yes / BLOCKING \ |--------------\BITS OTHER THAN / \ NRWT / \ ? / \\\\\\////// | No V /////\\\\\ **** / \ Yes * * / IS TASK \----------------->* STARTS * \ RESIDENT / * * \ ? / **** \\\\\///// Start task SW | No (Pg. C-15) V ------------------- | PUT TASK | | INTO SWPWT | ------------------- SW | V ------------------- | TAKE SWAPPER | | OUT OF RUNWT | ------------------- SW | V ***** * * * FINDJ * * * ***** (Pg. C-30) C-31 APPENDIX D RTS/8 ASSEMBLY ERROR MESSAGES Certain user errors are caught at assembly time. They produce standard PAL8 error diagnostics on the terminal of the form IC US tag IC where the tag specified indicates the type of error as described below. Tag Module Possible Error MCRBLK MCR.PA MCR was declared nonresident (MCRPRT defined) and MCR origin was incorrectly a multiple of 400. Nonresident portion of MCR is second page which must start on a block boundary. Fix: Redefine MCRORG. SYSERR several System error; should not occur unless user modified RTS/8 sources. Fix: See comments on source line which generated the error. TBLERR RTS8.PA Internal Executive tables were generated incorrectly. See source. CURBIG PARAM.PA User task specified a value for CUR which was larger than HGHFLD. Fix: Redefine CUR. RATERR CLOCK.PA HERTZ is not a multiple of SHERTZ. Fix: Redefine HERTZ or SHERTZ in parameter file. TODERR CLOCK.PA SHERTZ is too large. SHERTZ must be less than 192 (decimal). Fix: Redefine SHERTZ in parameter file. D-1 RTS/8 ASSEMBLY ERROR MESSAGES Tag Module Possible Error NOKL8A KL8ASR.PA The symbol KL8A was not defined in the parameter file. Fix: Set symbol KL8A in parameter file equal to number of physical KL8-A's present. KLOERR. KL8ASR.PA The symbol KL8A was set equal to 0 yet the file KL8ASR.PA was assembled. Fix: Do not assemble KL8ASR.PA if KL8-A support is not desired or redefine KL8A in the parameter file. HITMON. KL8ASR.PA The KL8-A service overlaid location 7600 in field 0. Ignore this error if you do not want to preserve OS/8 resident code. Fix: Redefine KL8ACT in parameter file. NOSWAP PARAM.PA A nonresident task was assembled in a system with no swapper. Fix: Define SWAPPER in parameter file or undefine PARTNO in user task. SWPRIO PARAM.PA A nonresident task was given higher priority than the swapper. Fix: Change priority of swapper or user task. FLDERR PARAM.PA Some parameter representing a field number times 10 was not in the correct form (e.g. HGHFLD, MCRFLD, etc.) Fix: Correct value of parameter in parameter file. CURERR PARAM.PA One of the symbols CUR, CUR2, or CUR3 was not of the proper form. Fix: Correct value in user task to 10 times field of task. D-2 APPENDIX E EXECUTIVE INTERNAL TASK TABLES The Executive uses five internal tables to maintain information about the tasks in the system. Each task's task number is used as an index into the first four tables to retrieve and update information for that task. The internal tables are as follows: 1. The Task State Table (TSTABL) - contains 4-word entries holding the most recent contents of CPU registers for each task as follows: Word 1 - contains the link (bit 0) the Greater Than Flag (bit 1) -if flag exists on machine being used the User Mode Flag (bit 5) -if flag exists on machine being used the Instruction Field (bits 6-8) the Data Field (bits 9-11) Word 2 - contains the contents of the Program Counter (PC) Word 3 - contains the contents of the Accumulator (AC) Word 4 - contains the contents of the Multiplier Quotient (MQ) register if the system has been assembled to save the MQ. Whenever the system executes a task, it loads the contents of the task's Task State Table entries into the corresponding CPU registers. Whenever a task stops executing, its Task State Table entries are set to the new contents of these registers. The Task State Table is located after the Message Table, that is, at location NTASKS+2^2+MSGTBL-4 in field 0. Example: Consider the following TSTABL entries for a task. 4012 3376 1234 0211 The task is interrupted just as it is about to execute the instruction at location 3376 (entry 2) of field 1 (bits 6-8 of entry 1). At this point, the contents of the CPU registers for this task are entered in the TSTABL. The AC is 1234 (entry 3), and the MQ is 0211 (entry 4). The link is set (bit O of entry 1), and the data field is 2 (bits 9-11 of entry 1). E-1 EXECUTIVE INTERNAL TASK TABLES 2. The Task Flags Table (TFTABL) - contains 1-word entries holding various flags (bits) for each task to determine whether the task is runnable. A task is runnable only if its Task Flags Table entry contains zero. Each flag (bit) which is set in a nonzero word indicates a reason why the task cannot run. The currently defined flags, if set, and their meanings are as follows: Octal Symbolic Meaning 4000 NONRWT Nonresident Wait - This task cannot run because it is not in memory. 2000 EFWT Event Flag Wait - This task is waiting for an Event Flag (which contains a WAITING value corresponding to this task) to be POSTed. 1000 RUNWT Run Wait - This task is waiting for a RUN ER to be executed with its number in the AC, or for the operator to type "Request task" to the Monitor Console Routine (see Chapter 6). 0400 SWPWT Swap Wait - This task cannot run because it is in the process of being brought into memory. 0200 EORMWT Event or Message Wait - This task is waiting for an Event Flag to be set or a message to arrive, whichever happens first. 0100 USERWT User Wait - This bit is reserved for use by user-written tasks. RTS/8 does not use this bit. 0040 ENABWT Enable Wait - This task is waiting to be Enabled. Use of this bit is restricted to the Monitor Console Routine for the "ENable task" and "DIsable task" commands. (See Chapter 6). 0020 MSGWT Message Wait - This task is waiting to be sent a message. 0010 NETWT Reserved for future use. 0001 DNEWT Does Not Exist Wait - This task cannot run because it is nonexistent. 0000 - Task is runnable. The Task Flags Table is located after the Task State Table, that is, at location NTASKS+2^4+TSTABL-1 in field 0. Examples: E-2 EXECUTIVE INTERNAL TASK TABLES 1. If the TFTABL entry for a task is 1000 the task is waiting to run. 2. If the TFTABL entry for a task is 0440 the task was disabled from running by the operator at the MCR terminal while the nonresident portion of the task was waiting to be swapped in. 3. If the TFTABL for a task is 0000 the task is runnable. However, this task may not run if a task of higher priority has precedence. 3. The Task Input Message Queue Header Table (MSGTBL) - contains 2-word entries that represent the "head" (start) of the input message queue for each task: Word 1 - if zero, there are no messages in the queue; if non-zero, the word is a CDF to the field of the first message in the queue. Word 2 - if word 1 was not zero, this word is a pointer to the address of the first message in the queue. The Message Table is located at the end of the RTS/8 Executive in field 0. Example: Consider the following MSGTBL entries for a task. 6211 2044 Since the first entry is a nonzero, there are messages in the input queue waiting for this task to receive them. The first entry is a CDF instruction to field 1. The second entry is a pointer indicating that the first message begins at location 2044 in field 1. 4. The Residency Table (RESTBL) - contains 2-word entries for each nonresident task. Word 1 - contains a pointer to the task's Partition Table entry in bits O through 9. Bit 10 is set a task is checkpointable, and bit 11 is set E-3 EXECUTIVE INTERNAL TASK TABLES if a task is writeable. Checkpointable and writeable tasks are defined in Section 5.1. Word 2 - contains the absolute block address (plus 1 to allow for the core control block) of the task's core image on the swap device. The Residency Table is located after the Task Flags Table, that is, at location TFTABL+NTASKS+2 in field 0. Example: Consider the following RESTBL entries for a task. 1611 0124 This task has a nonresident portion. The 4-word partition table entry used by this task begins at location 1610. The task is not checkpointable (bit 10 of entry 1 is a 0), but it is writeable (bit 11 of entry 1 is a 1). The disk-resident portion of this task begins at block 124 on the swap device. (The save image begins at block 123.) 5. The Partition Table (PARTBL) - contains a 4-word entry for each partition. It is indexed into via a partition number. Word 1 - contains the length (size) in bits 1-5 and field (bits 6-8) argument of the mass storage device driver call that reads an occupant into the partition with the "WRITE" bit set. Bit 11 of this word is the partition busy flag. Word 2 - contains the memory address of the partition. Word 3 - contains a pointer to word 1 of the occupant's RESTBL entry. Word 4 - unused The Partition Table must begin at an address that is a multiple of four. It is located after the Residency Table, i.e., at location NTASKS-SWAPPER^2+RESTBL+3&7774 in field 0. Example: Consider the following PARTBL entries for a particular partition. 5421 1400 1553 0000 E-4 EXECUTIVE INTERNAL TASK TABLES This partition is currently in use (bit 11 of entry 1 is a 1) by a task whose 2-word RESTBL entry begins at location 1553 (entry 3). The partition begins at location 1400 (entry 2) of field 2 (bits 6-8 of entry 1). The partition is 14 (octal) pages long (bits 1-5 of entry 1). Figure E-1 summarizes the internal task table structure of the Executive. The Residency Table and Partition Table are optional in that they are used only when nonresident tasks are employed. The exact location of these tables in memory depends on the number of tasks and other parameters in the parameter file. They can be found for a particular assembly under the "System Locations:" heading at the end of the parameter file assembly listing. TASK STATE TASK FLAGS TABLE (TSTABL) TABLE (TFTABL) --------------------------- ----------------------------- Word 1 | Instruction Data | | Bits determine if task is | | Field Field | | runnable | | | | | | Link GT UM (IF) (DF) | | | | 0 1 5 6-8 9-11 | | | |-------------------------| ----------------------------- Word 2 | Contents of Program | | Counter (PC) | Task runnable if entry |-------------------------| contains zero Word 3 | Contents of Accumulator | | (AC) | |-------------------------| Word 4 | Contents of Multiplier | | Quotient (MQ) | --------------------------- Upon task execution, TSTABL loaded into corresponding CPU registers Upon task interruption, TSTABL entry set to new contents of CPU registers Figure E-1 Executive Internal Task Table Structure E-5 EXECUTIVE INTERNAL TASK TABLES TASK INPUT MESSAGE RESIDENCY QUEUE HEADER (MSGTBL) TABLE (RESTBL) --------------------------- ----------------------------- Word 1 | If zero, no messages in | | Contains pointer to task | | queue. If nonzero, word | | PARTBL entry in bits 0-9; | | is CDF to the field of | | bit 10 - ckeckpointable; | | first message | | bit 11 - writeable | |-------------------------| ----------------------------- Word 2 | If nonzero, this word | | Block address plus 1 of | | is pointer to the first | | the task's core image on | | message in the queue | | swap device | --------------------------- ----------------------------- Represents the "head" of bit 10 of word 1 is set if the input message queue task checkpointable for each task bit 11 of word 1 is set if task writeable PARTITION TABLE (PARTBL) -------------------------------------- Word 1 | Contains the length (size) and | | Field argument (bits 1-8) of the | | mass storage device driver call | | that reads occupant into partition | | with 'write' bit set (bit 0). | |------------------------------------| Word 2 | Contains starting address of the | | partition | |------------------------------------| Word 3 | Contains pointer to word 1 of the | | occupant's RESTBL entry | |------------------------------------| Word 4 | Unused | | | -------------------------------------- Bit 0 is always set (write) Bit 11 of word 1 is the partition memory flag Figure E-1 Executive Internal Task Table Structure (cont.) E-6 GLOSSARY Accumulator The register in which the arithmetic operations are performed (abbreviated AC). Analog Representation of information by continuous variables. Analog Channel An UDC/ICS functional device. Argument A variable or constant which is given in the call of a subroutine as information to it; a variable upon whose value the value of a function depends; the known reference factor necessary to find an item in a table or array (i.e. the index). Assembler A program which translates symbolic op-codes into machine language and assigns memory locations for variables and constants. Auto-index register Whenever one of the absolute locations from, 0010 through 0017 in any memory field is addressed indirectly, the contents of that location is incremented by one, rewritten in the same location, and used as the effective address of the current instruction. Auto-restart The ability to start the CPU automatically on power-up. Baud A unit of measure of data flow (one bit per second). Bit A binary digit (each PDP-8 word is compose of 12 bits). Bit Map A method of keeping track of used and unused entities by assigning one bit in a table to each entity. Block A set of consecutive machine words characters or digits handled as a unit particularly with reference to input an output; an OS/8 block is 400 octal contiguous words; also to inhibit a process from continuing. Block Gap The blank space between blocks on a recording medium. Blocking Bits Bits in an RTS/8 Monitor Table which specify why a given task is blocked. Glossary-1 Byte A group of binary digits usually operated upon as a unit. Cassette A magnetic tape device used for program a data storage. Central Processing Unit The unit of a computing system that includes the circuits controlling the interpretation and execution of instructions (abbreviated CPU). Checkpointable Task A task is checkpointable if it may be swapped out of memory automatically, without its consent, to make room for higher priority tasks. Clear To erase the contents of a storage location by replacing the contents, normally with zeros. Clock A time keeping or measuring device within the computer system; provides periodic interrupts. Communication Region Locations 20-27 of every field, used to simplify passing executive request across field boundaries. Compute Bound Requiring extensive (or total) use of the CPU relative to other hardware elements (such as I/O devices). Configuration The number and types of hardware present on a system. Contact Channel A UDC/ICS functional device. Contiguous Code which resides in memory immediately adjacent to other sections of code. Controller The circuitry that controls a device. Core Image File A file in core image format (i.e., a 'picture' of core); also known as SAVE file. Core Storage The main high-speed storage of a computer in which binary data is represented by the switching polarity of magnetic cores. Counter Channel A UDC/ICS functional device. CPU Registers High-speed circuitry used to store information affecting the operation of the CPU (e.g., PC, IF, DF). Glossary-2 Data A general term used to denote any or all facts, numbers, letters and symbols. It connotes basic elements of information which can be processed or produced by computer. Data Field A 3-bit register which determines the memory field from which operands are taken in indirectly addressed instructions (abbreviated DF). Debug To detect, locate and correct mistakes in a program. Deferred Actions Actions which are considered low-priority and are not performed until higher-priority actions are serviced. Deferred Requests Requests which are considered low-priority and are serviced after high-priority requests. Derail To transfer control or execution of a specified task to a subroutine. Device Codes Numbers assigned to each device in the system. Device Status Register A register which contains the current status of a device. Digital Representation of information by discrete units. Digital Channel A UDC/ICS functional device. Driver See Handler. Dynamic Pertaining to a quantity that is affected by some condition (such as time) and is therefore relative to the condition; also refers to features at system run-time. Entry Point The location in a routine to which control can be transferred and execution begun. Event Flag The location which contains the status of an event (event being either a result of some operation, or a physical occurrence). Executive The program which controls the execution of other programs or routines. Executive Requests Means of communication between tasks and the RTS/8 Executive. Glossary-3 Field A division of memory on a PDP-8 computer referring to a 4K section of memory. File Gap A fixed length of blank tape separating files on a recording medium; generally several times the size of a block gap. Functional Devices The devices available for use under the UDC/ICS handler. Gain An increase in signal power. Generic Codes Codes used to identify which type of UDC/ICS functional device caused an interrupt and to direct program control to service routines. Handler A routine which is designed to control the operation of a device. I/O Bound A condition in which a process is performing much I/O but using very little CPU time. Indirect Address An address in a computer instruction which indicates a location where the address of the referenced operand is to be found. Initialization Code Code which sets counters, switches, and addresses to zero or other starting values at the beginning of or at prescribed points in a computer routine. Input Buffer A section of memory used for storage of input data. Instruction Field A register which holds the contents determining from which field the operand of a directly addressed instruction should be taken (abbreviated IF). Interactive Highly responsive to real-world inputs. Interface The common hardware and/or software boundary between two devices or systems. Interlock Scheme Arranging the control of devices so that their operation is interdependent. Interrupt A break in execution caused by some external event; execution is usually resumed at a later time. Interrupt Processing Module A routine which acts upon the external event which caused an interrupt. Glossary-4 Interval Queue A list of actions to perform, each accompanied by the interval of time which is to elapse from the previous action to the current one. Line-frequency Clock A clock whose ticking occurs at a multiple of the power line frequency. Link A one-bit register in the PDP-8; an address pointer generated automatically by the PAL8 assembler to indirectly address an off-page symbol. Logical OR A logical function of two or more inputs which is true whenever either input is true. Loop A sequence of instructions that is executed repeatedly until a terminal condition prevails. Mass Storage Device A device such as disk or DECtape which stores large amounts of data readily accessible to the central processing unit. Master Parameter File A file included in the distributed sources of RTS/8 which the user can edit to indicate parameters specific to his system configuration. Memory Address A register which holds the address specified by a memory reference instruction. Message A contiguous area of memory which contains information about execution of tasks. Message-driven An RTS/8 task is called message-driven if it only executes in response to messages received from other tasks. Mnemonic Alphabetic representation of a function or octal machine instruction. Module A routine which handles a particular function. Monitor Console Routine The Monitor routine which provides the user with functions which allow him to control, inspect, and debug his system. Multiplier Quotient A 12-bit register used in conjunction with the accumulator to perform mathematical operations (abbreviated MQ). Glossary-5 Multi-programming Two or more programs (tasks) in memory at the same time which execute alternately depending on the current state of the system. Nonresident Task A nonresident task is a task or a portion of a task that is swapped into memory when it becomes executable. No-op No operation occurs; control proceeds to the next instruction in sequence. Null Characters Characters with ASCII code 000. Overflow A condition that occurs when a mathematical operation yields a result whose magnitude is greater than the data presentation is capable of storing. Pack To conserve memory by combining information. Page A 128-word (decimal) section of PDP-8 core memory beginning at an address which is a multiple of 200(octal). Parameter file A file used to record arguments which may be assigned different values. Parity Bit A bit which indicates whether the total number of binary one digits in a word is even or odd. Pointer A word containing the address of another word in memory. Post To post an Event Flag means to set it to a FINISHED state via an RTS/8 Executive Request. Posted One of the states of an event flag, indicating that the event is complete; same as "FINISHED". Power-fail An interruption of power to the computer. Priority Scheme A scheme by which certain operations or the execution of a set of instructions is given preference over other operations. Program Counter A register which contains the address of the next instruction to be executed (abbreviated PC). Promptinq Character A character which prints on the console terminal and cues the user to perform some action. Glossary-6 Queue A waiting list (e.g., a queue of programs waiting for processing time). Ready Flag A bit which a device controller sets when it is ready to accept commands from the CPU. Real-time System A system in which computation is performed while a related physical process is occurring so that the results of the computation can be used in guiding or measuring the physical process. Receiver The task which has received a message from another task (sender). Record A collection of related items of data treated as a unit. Record Header Area An area of at least 40(octal) words in length which contains information necessary to perform cassette operations. Ring-buffer A storage area for data accessed on a first-in, first-out basis. Similar to Queue, but usually involves storage of character codes. Scheduling The operation of sharing resources among computing tasks. Sender The task which has sent a message to another task (receiver). Sign Bit The bit which contains the sign of a number. Simulate To represent the function of a device, system or program with another device, system or program. Skip Chain An instruction sequence which determines the source of an interrupt request on a PDP-8; contains one or more tests for each possible (hardware) interrupt condition. State A complete description of the condition of a piece of hardware or of a task. Status That portion of the state which other devices or tasks might be interested in. Subchannel One of the 4 channels of a UDC/ICS analog functional device. Suspend To temporarily halt execution of a task while another task of higher priority runs. Glossary-7 Symbols Names which can be assigned values or which can be used to indicate specific locations in a program. Synchronization A means of coordinating tasks (through event flags) so that one task executes while others wait. System Ticks An RTS/8 convention designed to obviate the tasks in the system from knowing the frequency of the clock. Task A task is a routine which performs a specific function. A task may be "resident" or "nonresident". A resident task is permanently located in memory. A nonresident task is loaded into memory as it is needed and can be overlaid after its completion. Task Flags Table A table of 1-word entries in the RTS/8 Executive whose contents determine whether or not a task is runnable. Task Input Message Queue Header Table A table of 2-word entries which represent the head of the input message queue for each task. Task Number A unique number between 1 and 63 (decimal) assigned to each task in an RTS/8 system. Task State Table A table of 4-word entries which contains the most recent contents of CPU registers for each task. Task Switching The act of stopping execution of one task and continuing execution of another from the point that it was last stopped. Terminal A peripheral device in a system through which data can enter or leave the computer. Utilities Routines to perform non-Monitor related functions. Word In the PDP-8, a 12-bit unit of data which may be stored in one addressable location. Glossary-8 INDEX ALTMODE, 4-5, 5-1 DECtape handler system parameters, Analog input UDC/ICS operation, 6-15 4-29 Demonstration program, 8-1 Analog output UDC/ICS operation, DEposit command, 5-6 4-29 DERAIL ER, 9-6 Arbitrary boundaries, 9-8 Digital input UDC/ICS operation, Assembling nonresident tasks, 4-31 7-7 Digital output UDC/ICS operation, Assembling tasks, 6-5, 8-14 4-30 Assembly, DIsable command, 5-4 nonresident tasks, 7-8 Disable contacts UDC/ICS operation, Assembly error messages, D-1 4-34 Assembly parameters, UDC/ICS, Disable counter UDC/ICS operation, 4-34 4-33 Distributed source files, A-1 Batch control, nonresident tasks, 7-9 Editing parameter file, 6-6, 6-9 Batch stream, 6-6, 6-9 ENable command, 5-4 BLKARG ER, 3-7 Enable contacts UDC/ICS operation, Buffers, 7-6 4-33 Enable counter UDC/ICS operation, 4-31 CAL instruction, 3-1 Error conditions, CAncel command, 5-4 UDC/ICS, 4-35 Cassette file support handler, Event flag states summary, 2-3 4-39 Event flags, 2-2 Cassette file support system EXamine command, 5-6 tasks, 4-40 Executive internal task tables, Cassette handler, 4-36 2-5, E-1 Change of state UDC/ICS opera- Executive KL8-A support, 4-42 tion, 4-34 Executive request wait states, Character mode, 4-5 3-14 Checkpointable tasks, 7-3 Executive requests, Clock handler, 4-2 BLKARG, 3-7 Clock handler system parameters, DERAIL, 9-6 6-11 POST, 3-5 CTRL/C, 4-5, 5-1 RECEIVE, 3-4 Communication region, 3-1 RUN, 3-9 Component sizes, B-1 SEND, 3-2 Control files, SENDW, 3-3 use of, 6-10 SKPINS, 3-11 Core image, 7-7, 7-8 SUSPND, 3-8 Creating an RTS/8 system, 6-5 UNBARG, 3-8 Creating SAVE image file, 6-7, WAITE, 3-3 7-7 WAITX, 9-6 EXIT command, 5-7 EXIT task, 4-44 DAte command, 5-2 EXIT task system parameters, 6-16 Debugging, nonresident task, 7-9 Index-1 INDEX (CONT.) Field mapping, 4-23 MCR Commands (cont.) FINISHED state, 2-2 ENable, 5-4 Floppy disk control file, 6-11 EXamine address, 5-6 Floppy disk handler, 4-14 EXIT, 5-7 Flowcharts, C-1 NAme, 5-2 FREE command, 7-4 OPen address, 5-6 POst address, 5-6 REquest, 5-3 Generic code UDC/ICS operation, STop, 5-4 4-31 SYstat, 5-5 TIme, 5-2 MCR component size, B-6 Inhibiting task switching, 9-2 MCR error messages, 5-7 Instructions, MCR system parameters, 6-14 CAL, 3-1 Memory partitions, 7-3 POSTDS, 3-11 Message header, 2-3 Instructions (cont.), Message table, E-3 WAITM, 9-4 Interrupt module restrictions, 3-11 NAme command, 5-2 Interrupt skip chain, 3-10 Nonresident MCR, 5-7 Intertask messages, 2-3 Nonresident task debugging, 7-9 Nonresident task implementation, 7-8 KL8-A support system parameters, Nonresident task initialization, 6-15 7-5 OS/8 support task, 4-43 Nonresident task parameters, 7-6 TTY task, 4-42 Nonresident tasks, 7-1 User task, 4-43 Nonresident tasks, assembly, 7-8 batch control, 7-9 LINCtape handler, 4-18 loading, 7-9 Line mode, 4-5 SAVE image file, 7-9 Line printer handler, 4-11 starting, 7-9 Line printer system parameters, 6-15 Loading, Obtaining listings, 6-5 nonresident tasks, 7-9 OPen command, 5-6 Loading tasks, 6-7, 8-14 OS/8 file support task, 4-25 OS/8 operating system, 4-21 OS/8 support task, 4-21 Mass storage handlers, 4-12 OS/8 support task system param- MCR command arguments, eters, 6-14 address, 5-1 OS/8-RTS/8 communication, 4-23 comma, 5-1 sinqle space, 5-1 task-ID, 5-1 Parameter file, time-of-day, 5-1 task definitions, 6-2 word, 5-2 task setup, 6-4 MCR commands, task specifications, 6-3 CAncel, 5-4 Parameter fide structure, 6-1 DAte, 5-2 Partition parameter initializa- DEposit address, 5-6 tion, 7-8 DIsable, 5-4 Partition table, E-4 Index-2 INDEX (CONT.) PDP-8A null task, 4-41 System tasks (cont.) PENDING state, 2-2 EXIT, 4-44 Performing a reschedule, 9-1 floppy disk handler, 4-14 POst address command, 5-6 LINCtape handler, 4-18 POST ER, 3-5 Line printer handler, 4-11 POSTDS instruction, 3-11 mass storage handler, 4-12 Power fail task, 4-20 OS/8 file support, 4-25 OS/8 support, 4-21 PDP-8A null, 4-41 Read counter UDC/ICS operation, power fail, 4-20 4-33 terminal handler, 4-5 Real-time system operation, 1-2 UDC/ICS handler, 4-27 RECEIVE ER, 3-4 REquest command, 5-3 Residency table, E-3 Task communication, 2-1 RTS/8 description, 1-1 Task flags table, E-2 RTS/8 task. structure, 2-1 Task number, 2-1 RUBOUT, 4-5 Task state table, E-1 RUN ER, 3-9 Task status report, 5-5 Task synchronization, 2-2 Terminal handler, 4-5 Sample task program, 6-8 Terminal handler system param- SAVE image file, eters, 6-12 creating, 6-7, 7-7 Terminal parameter default values, nonresident tasks, 7-9 4-10 Saving the system, 6-7, 8-14 TIme command, 5-2 SEND ER, 3-2 Timeshare function disabled, 4-21 SENDW ER, 3-3 TTY control file, 6-10 SKPINS ER, 3-11 TTY task KL8-A support, 4-42 Starting, nonresident tasks, 7-9 STop command, 5-4 UDC/ICS assembly parameters, 4-35 SUSPND ER, 3-8 UDC/ICS error conditions, 4-35 Swap device, 7-1, 7-6 UDC/ICS handler, 4-27 Swapper system parameters, 6-12 UDC/ICS handler system tasks, 4-27 Syntaetic constructions, 5-1 UDC/ICS operation, SYstat command, 5-5 analog input, 4-29 System parameters, analog output, 4-29 clock handler, 6-11 change of state, 4-34 DECtape handler, 6-15 digital input, 4-31 EXIT task, 6-16 digital output, 4-30 KL8-A support, 6-15 disable contacts, 4-34 line printer, 6-15 disable counter, 4-33 MCR, 6-14 enable contacts, 4-33 OS/8 support task, 6-14 enable counter, 4-31 swapper, 6-12 generic code, 4-31 terminal handler, 6-12 read counter, 4-33 System status report code, 5-5 UNBARG ER, 3-8 System tables direct references, Use of control files, 6-10 9-9 User task KL8-A support, 4-43 System task summary, 4-1 Using BITMAP program, 6-8, 7-5 System tasks, Using interrupts, 3-10 cassette file support, 4-39 cassette handler, 4-36 clock handler, 4-2 WAITBITS symbolic names, 3-9 Index-3 INDEX (CONT.) WAITE ER, 3-3 WAITING state, 2-2 WAITM instruction, 9-4 WAITX ER, 9-5 Writeable tasks, 7-3 Writing delicate code, 9-1 Index-4