Skip to main content

Full text of "dec :: pdp11 :: dos-batch :: DosBatchHandbook v9 Apr74 :: 05"

See other formats


PART 5 



DOS/BATCH DEVICE DRIVERS 



PART 5 

CHAPTER 1 

USING DEVICE DRIVERS OUTSIDE DOS/BATCH 

S\abroutines to handle I/O transfers between a PDP-11 and each of Its peripheral 
devices are developed as required for use within the Disk Operating System DOS /BATCH. 
These subroutines are made available within an I/O Utilities Package for the benefit 
of PDP-11 users who have configurations unable to support DOS/BATCH or who wish to 
run programs outside DOS/BATCH control. 

All the subroutines associated with one peripheral device form an entity known as a 
device driver. This part provides a general description of a driver and shows how 
it can be used in a stand-alone environment. The unique properties of each driver 
are discussed in separate docviments, which are made available as part of the Device 
Driver Package. The I/O utilities package for any system is determined by the 
peripherals of that system. Thus, the full documentation for a particular package 
consists of this document and applicable supplements. 



5-1 



PART 5 

CHAPTER 2 

DRIVER FORMAT 



2.1 STRUCTURE 



The basic principle of all drivers under the DOS/BATCH Monitor is that they must 
present a common interface to the routines using them in order to provide device- 
independent operation. The subroutines are structured to meet this end. Moreover, 
a driver can be loaded anywhere in memory under Monitor Control. Its code is always 
position-independent (PIC) . 

A detailed description of a driver is found in Chapter 5-4. This section describes 
driver interfaces. 

2.1.1 Driver Interface Table 

The first section of each driver is a table which contains, in a standard format, 
information on the nature and capabilities of the device it represents and entry 
points to each of its subroutines. The calling program can use this table as 
required, regardless of the device being called. See Section 5-4.1 for a detailed 
description of the table. 

2.1.2 Setup Routines 

Each driver is expected to handle its device under the PDP-11 interrupt system. 
When called by a program, therefore, a driver subroutine merely initiates the required 
action by setting the device hardware registers appropriately. It returns to the 
calling program by a standard subroutine exit. 

The main setup routines prepares for a data transfer to or from the device, using 
parameters supplied by the calling program. Normally, blocks of data are moved at 
each transfer. The driver returns control to the program only when the whole 
block has been transferred or when it is unable to continue because there is no 
more data available. 



^See Part 6 for information on PIC. 



5-2 



The driver can also contain subroutines by which the calling program can request 
(1) start-up or shut-dovm action, sych as leader or trailer functions for a paper 
tape punch, or (2) some special function provided by the device hardware (or a 
software simulation of that for some similar device), e.g., rewind of a magnetic 
tape or DECtape. 

2.1.3 Interrupt Servicing 

The driver routine to service device interrupts is particularly dependent upon the 
device hardware provisions for controlling transfers. In general, the driver 
determines the cause of the interrupt and checks whether the last action was 
performed correctly or was prevented by some error condition. If more device 
action is needed to satisfy the program request, the driver again initiates that 
action and takes a normal interrupt exit. If the program request has been fully 
met, control is returned to the program at an address supplied at the time of the 
request. 

2.1.4 Error Handling 

Device errors can be handled in two ways. There are some errors for which recovery 
can be programmed; the driver, if appropriate, attempts this itself (as in the case 
of parity or timing failure on a bulk-storage device) or recalls the program with the 
error condition flagged (as at the end of a physical paper tape) . Other errors 
normally require external action, perhaps by an operator. The driver calls a DOS/ 
BATCH error handler via an lOT call, with supporting information on the processor 
stack. 

2.2 INTERFACE TO THE DRIVER 

2.2.1 Control Interface 

The principal link between a calling program and any driver subroutine is the first 
word of the driver table (link word) . In order to provide the control parameters 
for a device operation, the calling program prepares a list in a standardized form 
and places a pointer to the list in the link word. The called driver uses the 
pointer to access the parameters. The driver can place return status information 
(if needed) in the list area via the link word. The first word of the driver table 
can also act as a busy indicator; if it is 0, the driver is not currently performing 
a task, but if it contains a listpointer, the driver can be assumed to be busy. 
Since most drivers support only one job at a time, the link word state is significant. 



5-3 



2.2.2 Interrupt Interface 

Although the driver expects to use the interrupt system, it does not itself ensure 

that its interrupt vector in the memory area below 400 has been set up correctly; 

8 

the Monitor takes care of this. However, the driver table contains the information 
required to initialize the appropriate vector. 



5-4 



PART 5 

CHAPTER 3 

STAND-ALONE USE 

Because each driver is designed for operation within the device-independent frame- 
work of the Monitor, it can be similarly used in other applications. Since the 
easiest way to use the driver is to assemble it with the program that requires 
it, this method will be described first. Other possible methods will be discussed 
later. 

3.1 DRIVER ASSEMBLED WITH PROGRAM 

■3.1.1 Setting Interrupt Vector 

As noted in Section 5-2.2.2, the calling program must initialize the device 
transfer vect9r within memory locations 0-377. The address of the driver's interrupt 
entry point can be identified on the source listing by the symbolic name which appears 
as the contents of the Driver Table Byte, DRIVER+5. The priority level at which the 
driver expects to process the interrupt is at byte DRIVER+6. For a program which 
can reference position-dependent code, the setup sequencer might be: 



MOV 

MOVB 

CLRB 



#DVRINT, VECTOR ;SET INT. ADDRESS 

DRIVER+6 ,VECT0R+2 ;SET PRIORITY 

VECTOR+3 ; CLEAR UPPER STATUS BYTE 



where the Driver Table Byte (at DRIVER+5) shows the follwing instruction: 

.BYTE DVRINT-DRIVER 

If the program must be position-independent, it can take advantage of the fact that 
the Interrupt Entry address is stored as an offset from the start of the driver, as 
illustrated above. In this case, a sample sequence might be: 



MOV 

ADD 

MOV 

CLR 

MOVB 

ADD 

CLR 

MOVB 



PC,R1 . 

#DRIVER-.,R1 

#VECT0R,R2 

(aR2 

5(R1),@R2 
R1,(R2) + 
@R2 
6(Rl),(aR2 



;GET DRIVER START 

... & VECTOR ADDRESSED 

SET INT. ADDRESS 

. . .AS START ADDRESS+OFFSET 

SET PRIORITY 



5-5 



3.1.2 Parameter Table for Driver Call 

For any call to the driver the program must provide a list of control arguments 
mentioned in Section 5-2.2.1. This list must adhere to the following format:^ 

[SPECIAL FUNCTION POINTER]'^ 

[BLOCK NO.]^ 

STARTING MEMORY ADDRESS FOR TRANSFER 

NO. OF WORDS to be transferred {2's complement) 

STATUS CONTROL showing in Bits: 

0-2 Function (octally 2=WRITE, 4=READ) ** 

8-lJZf Unit (if Device can consist of several units, e.g., DECtape) 

11 Direction for DECtape -travel (0=Forward) 

ADDRESS for RETURN ON COMPLETION 
[RESERVED FOR DRIVER USE] ® 



The list can be assembled in the required format since its content will not vary. 
The driver can return information in this area; this will not corrupt the program 
data . 

On the other hand, most programs will probably use the same list area for several 
tasks or even for different drivers. In this case, the program must contain 
the necessary routine to set up the list for each task before making the driver 
call. The driver may refer to the list again when it is recalled by an interrupt 
or when returning information to the calling program. Therefore, the list must not be 
changed until any driver has completed a function requested; for concurrent opera-t 
tions, different list areas must be provided. 



'^In some cases, it can be further extended as discussed in later sections. 

^Required only if Driver is being called for Special Function; addresses a Special 

Function Block. 

^Required only if the device is bulk storage (e.g.. Disk or DECtape). 

**Most devices transfer words regardless of their content, i.e., ASCII or Binary. 

Some devices (e.g.. Card Reader) may be handled differently depending on the mode 

for these. Bit must also be set to indicate ASCII=0, Binary =1. In these cases, 

the driver always produces or accepts ASCII even though the device itself uses some 

other code. 

'This word may be omitted if the device is bulk storage. 



5-6 



3.1.3 Calling the Driver 

To enable the driver to access the parameter list/ the program must set the first 
word of the driver to an address six bytes less than that of the word containing the 
MEMORY START ADDRESS. It can then directly call the required driver subroutine 
by a normal JSR PC,xxxx call, where xxxx is the address of the driver subroutine. 

As an example, the following position-independent code might appear in a program 
which wishes to read Blocks #100-103 backward from DECtape unit 3 into a buffer 
starting at address BUFFER. 



WAIT: 



TABLE! 



MOV 


PC,R0 


ADD 


#TABLE+12-.,R0 


MOV 


PC,@R0 


ADD 


#RETURN-.,@R0 


MOV 


#5404,- (R0) 


MOV 


#^1024., ~(R0) 


MOV 


PC,-(R0) 


ADD 


#BUFFER-.,@R0 


MOV 


#l)2i3,-(R0) 


CMP 


-(R0),-(R0) 


MOV 


' R0,DT 


JSR 


PCDT.TFR 



•WORD 
.WORD 
.WORD 
.WORD 
.WORD 
.WORD 



;GET TABLE ADDRESS 

GET AND STORE... 

...RETURN ADDRESS 

SET READ REV. UNIT 3 

4 BLOCKS REQUIRED 

GET AND STORE 

. ..BUFFER ADDRESS 

START BLOCK 

SUBTRACT 4 FROM POINTER 

SET DRIVER LINK 

GO TO TRANSFER ROUTINE 

RETURNS HERE WHEN 

. . .TRANSFER UNDER WAY 

RETURNS HERE WHEN 

. . .TRANSFER COMPLETE 

LIST AREA SET 

. . .BY ABOVE SEQUENCE 



3.1.4 User Registers 

During its setup operations for the function requested, the driver assumes that 
Processor Registers 0-5 are available for its use. If their contents are of value, 
the program must save them before the driver is called. 



While servicing intermediate interrupts, the driver may need to save or restore 
its registers. It expects to have two subroutines available for the purpose 
(provided by the Monitor) . It accesses them via addresses in memory locations 
and 46, 



8 



8 



MOV 
JSR 



@#44,-(SP) 
R5,@(SP) + 



;0R MOV @#46,-(SP) 



5-7 



The driver must also ensure that the start addresses are set into the correct 

locations (44_ and 46.,) . 
8 o 

At its final interrupt, the driver saves the contents of Registers 0-5 before 
returning control to the calling program completion return. 

3.1.5 Returns From Driver 

As shovm in the example in Section 5-3.1.3, the driver returns control to the 
calling program immediately after the JSR as soon as it has set the device in 
motion. The program can wait or carry out alternative operations until the driver 
signals completion by returning at the address specified (i.e., RETURN above). 
Prior to this, the program must not attempt to access the data being read in, nor 
refill a buffer being written out. 

The program routine beginning at address RETURN varies according to the device 
being used. In general, the driver has given control to the routine for one of two 
reasons; either the function has been satisfactorily performed, or it cannot be 
carried out due to some hardware failure with which the driver is unable to cope, 
though the program may be able to do so. In the latter case, the driver uses 
the STATUS word in the program list to show the cause: 

Bit 15 = 1 indicates that a device or timing failure occurred 
and the driver has not been able to overcome this, 
perhaps after several attempts. 

Bit 14 = 1 shows that the end of the available data has been 
reached. 

The driver places in R0 the contents of its first word as a pointer to the 
parameter table (see Section 5-3.1.2). 

Possibly, the driver has transferred only some of the data requested. In this 
case, it shows in the RESERVED word of the program list a negative count of the words 
not transferred in addition to setting Bit 14 of the STATUS word. As mentioned in 
the note in Section 5-3.1.2 , this applies only to non-bulk storage devices. The 
drivers for DECtape or disks* always endeavor to complete the full transfer, even 
beyond a parity failure, or they take more drastic action (see Section 5-3.1.6). 



^This includes RFll Disk; although this is basically word-oriented, it is assumed 
to be subdivided into 64-word blocks. 

5-8 



It is thus the responsibility of the program RETURN routine to check the informa- 
tion supplied by the driver in order to verify that the transfer was satisfactory 
and to handle the error situations appropriately. 

In addition, the routine must contain a sequence to take care of the Processor 
Stack, Registers, etc. As noted earlier, the driver takes the completion return 
address after an interrupt and saves Registers jli-5 on the stack above the 
Interrupt Rettirn Address and Status. The program routine should, therefore, contain 
some sequence to restore the processor to its state prior to such interrupt, e.g., 
using the same Restore subroutine illustrated earlier: 

MOV §#46,- (SP) ;CALL REGISTER RESTORE 

JSR R5,@(SP) + 



RTI ; RETURN TO INTERRUPTED PROGRAM 

3.1.6 Irrecoverable Errors 

All hardware errors other than those noted in the previous section cannot normally 
be overcome by the program or by the driver on its behalf. Some of these could be 
due to an operator fault, such as not t\irning on a paper tape reader or not setting 
the correct unit number on a DECtape transport. Once the operator has rectified 
the problem, the program could continue. Other errors, however, require hardware 
repair or even software repair, e.g., if the program asks for Block 2000 on a device 
having a maximum of 1000. In general, all these errors result in the driver placing 
identifying information on the processor stack and calling lOT to produce a trap 
through location 34 . 

Under DOS/BATCH, the Monitor provides a routine to print a teleprinter message when 
this occurs. In a stand-alone environment, the program using the driver must 
itself contain the routine to handle the trap (unless the user wishes to modify the 
driver error exits before assembly) . The handler format depends upon the program. 
The following format takes advantage of the information supplied by the driver: 



Stored by lOT call 

Generally unique to driver 

1 » Recoverable after Operator Action 

3 = No recovery 

Such as content of Driver, 

Control Register, Driver Identity, 

etc. 

As a rule, the driver expects a return following the lOT call in the case of recoverable 

errors but contains no provision for an lOT call following a return from irrecoverable 

errors . 

5-9 





(SP) 


Return Address 


2 


(SP) 


Return Status 


4 


(SP) 


Error No. Code 


5 


(SP) 


Error Type Code: 


6 


(SP) 


Additional 
Information 



3.1.7 General Comment 

The source language of each driver has been written for use with DOS/BATCH and 
contains some code which is not accepted by the Paper Tape Software PAL-llR, in 
particular, .TITLE, .GLOBL, and Conditional Assembly directives. Such statements 
should be deleted before the source is used. Similarly, an entry in the driver 
table gives the device name as .RAD 50 'DT' to obtain a specifically packed format 
used internally by DOS/BATCH. If the user wishes to keep the name, for instance, 
for identification purposes as discussed in Section 5-3.3, .RAD50 might easily 
be changed to .ASCII without detrimental effect, or it might be replaced with 
.WORD 0. 

3.2 DRIVERS ASSEMBLED SEPARATELY 

Rather than assemble the driver with every program requiring its availability, the 
user may wish to hold it in binary form and attach it to the program only when 
loaded. The only requirement is that the start address of the driver should be 
known or be determinable by the program. 

The example in Section 5-3.1.2 showed that the Interrupt Servicing routine can be 
accessed through an offset stored in the Driver Table .^ The same technique can be 
used to call the setup routines, as these also have corresponding offsets in the 
Table, as follows: 

DRIVER+7 Open^ 

+10 Transfer 



+11 Close 



+12 Special Functions^ 

The problem is the start address. There is the obvious solution of assembling the 
driver at a fixed location so that each program using it can immediately reference 
the location chosen. This ceases to be convenient when the program has to avoid 
the area occupied by the driver. A more general method is to relocate the driver 
as dictated by the program using it, thus taking advantage of the position-independent 
nature of the driver. The Absolute Loader, described in the Paper Tape Software 
Handbook (DEC-11-XPTSA-A-D) , provides the capability to continue a load from the 
point at which it ended. Using this facility to enter the driver immediately 
following the program, the program might contain the following code to call the 
subroutine to perform the transfer illustrated in Section 5-3.1.3. 



'^If the routine is not provided, these are 0. 



5-10 



MOV 
ADD 
MOV 
ADD 



PC,R1 

#PRGEND-.,R1 
PC,R0 
#TABLE+12-.,R0 



;GET DRIVER START ADDRESS 

GET TABLE ADDRESS 
AND SET UP AS SHOWN 
...IN SECTION 5-3.1.3 



CMP 
MOV 
CLR 
MOVE 

'add 

JSR 



-(R0),-(R0) 
R0,@R1 
-(SP) 

10 (Rl) ,@SP 
(SP)+,R1 
PC,@R1 



FINAL POINTER ADJUSTMENT 
STORE IN DRIVER LINK 
GET BYTE SHOWING. . . 
. . .TRANSFER OFFSET 
COMPUTE ADDRESS 
GO TO DRIVER 



PGREND: 



.END 



This technique can be extended to cover situations in which several drivers are 
used by the same program, provided that it takes account of the size of each 
driver (known because of prior assembly) and that the drivers themselves are always 
loaded in the same order. 

For example, to access the second driver, the above sequence would be modified to: 



MOV 
ADD 
ADD 



PC,R1 

#PRGEND-.,R1 

#DVR1SZ,R1 



;GET DRIVER 1 ADDRESS 



;SET TO DRIVER 2 



DVRlSZ=n 
PRGEND : 



.END 



An alternative method may be to use the MACRO Assembler in association with the 
Linker program LINK, both of which are available through the DECUS Library. The 
start address of each driver is identified as a global. Any calling programs need 
merely include a corresponding .GLOBAL statement, e.g., .GLOBL DT. 

3.3 DEVICE-INDEPENDENT USAGE 

The drivers are assigned for use in a device- independent environment, i.e., one 
in which a calling program need not know in advance which driver has been associated 
with a table for a particular run. One application of this type might be to allow 
line printer output to be diverted to some other output medivim because the line 
printer is not currently available. Another might be to provide a general pro- 
gram to analyze data samples although these on one occasion might come directly 



5-11 



from an Analog-to-Digital converter and on another be stored on a DECtape because 
the sampling- rate was too high to allow immediate evaluation. 

Programs of this type should be written to use all the facilities that any 
one device might offer, but not necessarily for each device. For instance, the 
program should ask for start-up procedures because it may sometime use a paper 
tape -punch which provides them, even though it may normally use DECtape which 
does not. As noted in paragraph 5-2.2.1, the driver table contains an indication 
of its capabilities to handle this situation. The program can thus examine the 
appropriate item before calling the driver to perform some action. As an example, 
the code to request start-up procedures might be (assuming R0 already set to 
List Address) : 



GET DRIVER ADDRESS 
BIT 7 SHOWS 

...OPEN ROUTINE PRESENT 
STORE TABLE ADDRESS 
BUILD ADDRESS 
; ...OF THIS ROUTINE 

; . . .AND GO TO IT 

; FOLLOWED POSSIBLY BY 

;WAIT AND COMPLETION 

; PROCESSING 

; RETURN TO COMMON OPERATION 



MOV 


#DVRADD,R1 


TSTB 


2(R1) 


BPL 


NOOPEN 


MOV 


R0,§R1 


CLRB 


-(SP) 


MOVB 


7(R1),@SP 


ADD 


(SP)+,R1 


JSR 


PC,@R1 



NOOPEN? 



Similarly, the indicators show whether the device is capable of performing input 
or output, or both; whether it can handle ASCII or binary data; whether it is a 
bulk storage device capable of supporting a directory structure or is a terminal- 
type device requiring special treatment. Other table entries show the device 
name as identification and the number of words the device might normally expect 
to transfer at a time (in 16-word units) . All of the information can be readily 
examined by the calling program, thus enabling the use of a common call sequence 
for any I/O operation, as illustrated in the example on the following page. 



5-12 



MOV 


#DVRADR,R5 


JSR 


R5 , lOSUB 


BR 


WAIT 


• WORD 


10 


.WORD 


103 


.WORD 


BUFFER 


.WORD 


-256. 


.WORD 


404 


.WORD 


RETURN 


.WORD 






WAIT: 



SET DRIVER START 

CALL SET UP SUB 

SKIP TABLE FOLLOWING ON RETURN 

TRANSFER REQUIRED 

BLOCK NO. 

BUFFER ADDRESS 

WORD COUNT 

READ FROM UNIT 1 
;EXIT ON COMPLETION 
; RESERVED 
/•CONTINUE HERE... 



lOSUB: 



MOV 
MOV 
TST 



MOV 

ADD 

CLR 

MOVB 

ADD 

JSR 

RTS 



@SP,R0 
R5,R1 
(Rl) + 



@R1,R1 

R0,R1 

-(SP) 

@R1,@SP 

R0,@SP 

PC,§(SP) + 

R5 



PICK UP DRIVER ADDR 
SET UP POINTER TO LIST 
BUMP TO COLLECT CONTENT 
ROUTINE CHECKS ON DEVICE 
. . .CAPABILITY USING Rl 
...TO ACCESS LIST AND 
. . .R0 THE DRIVER TABLE 
IF O.K... 
GET ROUTINE OFFSET 

;USE IT TO BUILD 
; . . .ENTRY POINT 

;CALL DRIVER 
;EXIT TO CALLER 



The calling program, or a subroutine of the type just illustrated, may take 
advantage of a feature mentioned earlier; the fact that when a driver is in use, 
its first word is non-zero. The driver itself does not clear this word except 
in special cases shown in the description for the driver concerned. If the pro- 
gram itself always ensures that the first word of the driver is set to zero between 
driver tasks, then this word foirms a suitable driver-busy flag. Under DOS, the 
program parameter list is extended to allow additional words to provide linkage 
between lists as a queue in which the list indicated in the driver's first word 
is the first link. 

The preceding paragraphs indicate possible ways of incorporating the available 
drivers into the type of environment for which they were designed. The user should 
carefully read the more detailed description of the driver structure in Chapter 5-4, 
and the individual driver specifications before determining the final form of his 
program. 



5-13 



A word of warning is appropriate here. Although most drivers set up an operation 
and then wait for an interrupt to produce a completion state, there are some cases 
in which the driver can finish its required task without an interrupt, e.g., 
"opening" a paper tape reader involves only a check on its status. Moreover, 
where "Special Functions" are concerned, the driver routine may determine from 
the code specified that the function is not applicable to its device, and therefore, 
have nothing to do. In such cases, the driver clears the intermediate return 
address from the processor stack and immediately takes the completion return. 
Special problems can arise, however, if the driver concerned is servicing several 
tasks, any of which can cause a queue for the driver's services under DOS/BATCH. 
To overcome these problems, the driver expects to be able to refer to flags outside 
the scope of the list so far described. This can mean that a program using such 
a driver may also need to extend the list range to cover such possibilities. 
Particular care should be exercised in such cases. 



5-14 



PART 5 

CHAPTER 4 

I/O DRIVERS WITHIN THE 
DOS/BATCH OPERATING SYSTEM 

The principal function of an I/O driver is to satisfy a Monitor processing routine's 
requirement for the transfer of a block of data in a standard format to or from 
the device it services. This involves setting up the device hardware registers to 
cause the transfer and gaining control under the interrupt scheme of PDP-11, making 
allowance for peculiar device characters (e.g., conversion to or from ASCII if 
some special code is used) . 

The I/O driver must also include routines for handling device start-up or shut- 
down such as punching leader or trailer, and for making available to the user 
certain special features of the device, such as rewind of magtape. 

4.1 DRIVER STRUCTURE 

In order to provide a common interface to the Monitor, all drivers must begin with 
"a table of identifying information as follows: 



DVR: 



BUSY FLAG (initially 0) 


FACILITY INDICATOR (expanded below) 


Offset to 
Interrupt Routine* 


Standard Buffer Size 
in 16-word Units. 


Offset to 
OPEN Routine* 


Priority for 
Interrupt Service* 


Offset to 
CLOSE Routine* 


Offset to 
Transfer Routine* 


Space 


Offset to 

Special Functions* 


DEVICE NAME (Packed Radix- 50) 



Offsets marked * enable the calling routine 
to indicate the routine required. The offsets 
are considered to be an unsigned value to be 
added to the start address of the driver. This 
may mean that with a 256-word maximum, the 
instruction referenced by the offset is a JMP or BR 
(routine) . 



5-15 



The table should be extended as follows if the device is file-structured i 



BLOCK USED AS MASTER FILE DIRECTORY 



POINTER TO BIT-MAP IN MEMORY 



Unit 

Similar Bit-Map 
Pointers for 
Multi-Unit Devices 



The driver routines that set up the transfer and control under the interrupt follow 
the table. 

Bits in the Facility Indicator Word define the device for Monitor reference: 



SPECIAL STRUCTURES 



GENERAL STRUCTURE 



File 

Structured 
Device -i 
DEC tape 
(or simil- 
arly 
reversible) _ 
Magtape 



15 14 13 12 11 10 



t t t t t t T T 

I Reserved Reserve 



Variable length 
record bit 



f 



t 



Multi-User 
Output Device 
Input Device 
Binary Device 
ASCII Device 
Contains SPECIAL 
Contains CLOSE 
Contains OPEN 
"Terminal" 
Device 



Multi-unit System 

type devices (i.e., RK disk) 



4.2 MONITOR CALLING 



When a Monitor I/O processing routine needs to call the driver, it first sets up the 
parameters for the driver operation in relevant words of the appropriate DDB^, as 
illustrated in the following table. 



Dataset Data Block - a 16-word table which provides the main source of communica- 
tion between the Monitor drivers and a particular set of data being processed on 
behalf of a using program. 



5-16 



DDB: 



specizUj function code 



DEVICE BLOCK NUMBER 



MEMORY BLOCK ADDRESS 



WORD COUNT (2'S COMPLEMEJJT) 



TRANSFER FUNCTIONS (expanded below) 



COMPLETION RETURN ADDRESS 



(DRIVER WORD-COUNT RETURN) Set to Zero 



(User Call Address) 
(User Line Address) 



The relevant content of the Transfer Function word is as follows: 



EOF 
or 
EOD 



TT Echo Control 



15 



T 



I 141 13 I 



12 11 10 



reserved 
Used by Driver DEC tape 
to indicate reverse 

Hardware Parity . DEVICE 
Fail , UNIT 



(reserved) 



Open vs. 
Closed 



0=ASCII 
l=Binary 

Transfer OUT 
Transfer IN 



Provided that the Facility Indicator in the Driver Table described above shows that 
the driver is able to satisfy the request, according to the direction and mode and 
the service required, the Monitor routine places in Register 1 the relative Byte 
address of the entry in the Driver Table containing the offset to the routine to 
be used (e.g., for the Transfer routine, this would be 10). The Monitor routine 
then calls the Driver Queue Manager, using a JSR PC, S.CDB instruction. 

The Driver Queue Manager refers to the Busy Flag (Word of the driver table) to 
assure that the driver is free to accept the request. If the Busy Flag contains 0, 
the Queue Manager inserts the address of the DDB from Register and jumps to the 
start of the routine in the driver using Register 1 content to evaluate the address 
required. If the driver is already occupied, the new request is placed in a queue 
linking the appropriate DDB's for datasets waiting for the driver's services. It 
is taken from the queue when the driver completes its current task. (This is done 
by a recall to the Queue Manager from the routine just serviced, using JSR PC,S.CDQ) 



5-17 



On entry to the Driver Routine, therefore, the address following the Monitor routine 
call remains as the "top" element of the processor stack. It can be used by the 
driver in order to make an immediate return to the Monitor (having initiated the 
function requested) , using RTS PC. It should also be noted that the Monitor 
routine saves register contents if it needs them after the device action. The 
driver may thus freely use the registers for its own operations. 

When the driver has completly satisfied the Monitor request, it should return 
control to the Monitor using the address set into the DDB. On such return. 
Register must be set to contain the address of the DDB just serviced and since 
the return will normally follow an interrupt. Registers 0-5 at the interrupt must be 
stored on top of the stack. 

4.3 DRIVER ROUTINES 

4.3.1 TRANSFER 

The sole purpose of the TRANSFER routine is to set the device in motion. The 
information needed to load the hardware registers is available in the DDB, whose 
address is contained in the first word of the driver. Conversion of the stored 
values is the function of the routine. It must also enable the interrupt; however, 
it need not set the interrupt vectors as these are preset by the Monitor when the 
driver is brought into core. After the TRANSFER routine has activated the device, 
the routine returns to the calling processor by an RTS PC instruction. 

4.3.2 Interrupt Servicing 

The form of this routine depends upon the nature of the device. In most drivers 
it falls into two parts, one for handling the termination of a normal transfer and 
the other to deal with reported error conditions. 

For devices which are word or byte-oriented, the routine must provide for indi- 
vidual word or byte transfers, with appropriate treatment of certain characters 
(e.g., TAB or Null) and for their conversion between ASCII or binary and any 
special device coding scheme, until either the word count in the DDB is satisfied 
or an error prevents this. On these devices, the most likely case for such error 
is the detection of the end of the physical medi\im; the treatment for the error 
varies according to v^ether the device is providing input or accepting output- 
The calling program usually needs to take action in the former case and the driver 
should merely indicate the error by returning the unexpired portion of the word 
count in DDB Word 7 on exit to the Monitor. Output End of Data requires operator 



5-18 



action. ~ To obtain this, the driver should call the Error Diagnostic Print routine 
within the Monitor by: 



MOV DEVNAM,-(SP) ;SHOW DEVICE NAME 

MOV #402,- (SP) ;SHOW DEVICE NOT READY 

lOT ;CALL ERROR DIAGNOSTIC PRINT ROUTINE 



On the assumption that the operator will reset the device for further output and 
request continuation, the driver must follow the above sequence with a Branch or 
Jvunp to resume the transfer . ' 

Normal transfer handling on blocked devices (or those like RFll Disk which are 
treated as such) is simpler since the hardware takes care of individual words or 
fcytes and the interrupt only occurs on completion. 

Errors that indicate definite hardware malfunctions must generate diagnostic 
messages to the Operator, The only recourse is to start the program over, after 
the malfunction has been corrected. 

There are some errors which the driver can attempt to overcome by restarting the 
transfer. Device parity failure on input is a common example. If one or more 
retries are unsuccessful, the driver should normally allow programmed recovery 
and indicate the error by Bit 15 of DDB word 5. Nevertheless, because the pro- 
gram may try to process the data despite the error, the driver should attempt to 
transfer the whole block requested if this has not already been effected. The 
remaining forms of errors must be processed according to the type of recovery 
deemed desirable. 

Whether the routine uses processor registers for its operation depends on con- 
siderations of the core space saved against the time taken to save the user's 
contents. However, on completion (or error return to the Monitor) , the calling 
routine expects the top of the stack to contain the contents of Registers 0-5 
and Register to be set to the address of the DDB just serviced. The driver 
must, therefore, provide for this. 

4.3.3 OPEN 

This routine need be provided only for those devices that require some hardware 
initialization. It should not normally appear in drivers for devices used in a 
file oriented manner. The presence of the routine must be indicated by Bit 7 
in the driver table Facility Indicator. 



5-19 



The OPEN routine may vary according to the transfer direction of the device. For 
output devices, the probable action required is the transmission of appropriate 
data, e.g., CR/LF at a keyboard terminal, form-feed at a printer, or null characters 
as punched leader code, and for this a return interrupt is expected. The OPEN 
routine should then be some\^at similar to the TRANSFER routine in that it sets 
the device going and makes an interim return via RTS PC, waiting until completion 
of the whole transmission before taking the final return address in the DDB. 

An input OPEN may consist of just a check .on the readiness of the device to provide 
data when requested. In this case, the desired function can be effected without any 
interrupt wait. The routine should, therefore, take the completion return immediately. 
Nevertheless, it must ensure that the saved PC value on top of the stack from the call 
to S.CDB is appropriately removed before exit. In the case of drivers which can service 
only one dataset at a time (i.e.. Bit of their Facility Pattern word is set to 0) 
and can never be queued, a TST (SP)+ instruction can effect this. However, a multi- 
user driver must allow for the possibility that it may be recalled to perform some 
new task waiting in a queue. This condition exists if the byte at DDB-3 is non-zero. 
In this case, the driver must simulate the interrupt expected by the completion 
process. This is accomplished by inserting a PS word on the stack above the return 
address supplied by the JSR of the Open request. A possible sequence for the 
interrupt simulation is illustrated below. 



EXIT! 



MOV 


DRIVER, R0 


MOV 


(SP) + ,R5 


TSTB 


-3 (R0) 


BEQ 


EXIT 


MOV 


§#177776, -(SP) 


MOV 


R5,-(SP) 


SUB 


#14, SP 


JMP 


@1O(R0) 



;PICK UP DDB ADDRESS 
;SAVE INTERIM RETURN 
;COME FROM QUEUE? 

IF SO, STORE STATUS 
...& RETURN 
DUMMY SAVE REGS 



4.3.4 CLOSE 

The CLOSE routine is like the OPEN routine, in that it should provide for the 
possibility of some fomn of hardware shut-down, such as the punching of trailer code 
and that it is not necessary for file-structured devices. Moreover, it is likely 
to be a requirement for output devices only. If it is provided. Driver Table 
Facility Indicator (Bit 6) must be set. 



5-20 



Again, the probable form is initialization of the, hardware action required, with 
immediate return via RTS PC and eventual completion return via the DDB-stored 
address. 

4.3.5 SPECIAL 

This routine may be included if either the device itself contains the hardware to 
perform some special function or there is a need for software simulation of each 
hardware on other devices, e.g., tape rewind; it should not be provided otherwise. 
Its presence must be indicated by Bit 5 of the Facility Indicator. 

The function itself is stored by the Monitor as a code in the DDE. When called, 
the driver routine must determine whether such function is appropriate in its case. 
If not, the completion return should be taken immediately with prior stack clearance, 
as discussed under OPEN. For a recognized function, the necessary routine must be 
provided. Its exit method depends upon the necessity for an interrupt wait. 

4.4 DRIVERS FOR TERMINALS 

The rate of input from terminal devices normally reflects the typing skill of the 
operator. For both input and output, the amount of data to be transferred on each 
occasion may be a varying length, i.e., a line rather than a block of standard size. 
Furthermore, echoing input may conflict with interrupting output. As a result, 
drivers for such devices demand special treatment. 

Normal output operation, i.e., .WRITE by the program, is handled by the Monitor 
Processor. On recognizing that the device being used is a terminal, as shown by Bit 
8 of the facility indicator, this routine always causes a driver transfer at the end 
of the user line, even though the internal buffer has not been filled. The driver, 
however, is given the whole of a standard buffer, padded as necessary with nulls. 
Provided the driver can ignore these, the effect is the suppression of trailing nulls. 

Input control remains the driver's responsibility since overcoming the rate problem 
requires circular buffering within the driver. This circular buffering feature 
allows the user type-ahead facilities. A sxibsequent input request may then be 
satisfied by data already in core. If the data is sufficient to fill the Monitor 
buffer, the driver awaits the next request before further transfer. If this is 
insufficient, the driver should operate as any other device and use subsequent 
interrupts to satisfy the Monitor's requests. Since the driver must stop any trans- 
fer at the end of a line in normal operation, in order to allow the Monitor to con- 
tinue, the driver must simulate the filling of the buffer by null padding. If the 
user requests .TRAN's which are not line oriented, the buffer size varies from the 
standard and the driver assumes the program requires a complete buffer before 
return. 

5-21 



PART 5 

CHAPTER 5 

SAMPLE LINE PRINTER DRIVER LISTING 

The following is a sample listing of a DOS/BATCH Device Driver. The actual driver 
is the LPll Line Printer Driver (for device name LP:). 



I 

2 

3 

A 

5 

6 

7 

8 

9 

10 

U 

12 

13 

14 

15 

16 

17 

la 

19 
20 
21 
22 
23 
24 
29 
26 
27 
28 
29 
30 
31 
32 
33 
34 
39 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
91 



LPTYP 



000001 UPU 
000012 8KIP2 



L811 

SPHEAO 

3K1F2 



WIOTH 

000000 R0 

000001 Rl 

000002 R2 

000003 R3 

000004 R4 

000005 R5 

000006 SP 

000007 PC 

000402 A002 
000044 S.HSAV 



OiBITAl EQUIPMENT CORPORATION, MAVNARD, MASSACHUSETTS 01 
COPYRIGHT! 1»73 

DI6ITAU EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY 
FOR THE USE OR RKUIABILITY OF ITS SOFTWARE ON EQUIPMENT 
WHICH IS NOT SUPPLIED BY DIGITAL EQUIPMENT CORPORATION, 

VERSION NUMB£RI V13.01 

DATEOI MARCH 9, 1973 

DEVICE DRIVER FOR THE LPU/LSU LINE PRINTERCS) 

DRIVER PARAMETERIZATION SYMBOLS 

LPllf LS11» WIDTH, SPACES, SPREAD 



IF 

ENOC 

IF 

TITLE 



IFF 

IF 

TITLE 



IFF 

MERROR 
ENOC 
ENOC 



;LPTYP=i2f if I.P11 
;LPTYP=1 if LSll 
; DEFAULT IS 



NOF, LPTYP 


EO,LHTYP 

DV,LP0 

1 

12 

Ea,<LPTYP-l> 

DV.LP* 

1 

1 

13 



;UNSUPP0RTE0 LINE PRINTER 



IFNDF WIDTH 



I 80. COLUMN PRINTER DEFAULT 



ENOC 



X0 
XI 
X2 
X3 
X4 
X5 
X6 
X7 

402 
44 



I DIAGNOSTIC MESSAGE CODE 

I REGISTER SAVE (MONITOR SUPPORT 



5-22 



UV,LP0 HACRU V06*id9 09«JAN«74 12155 PAGt; 5 



1 

3 

4 

5 

6 

7 

8 

9 

10 

11 

12 000192 

13 

14 00003 

19 00004 

16 00009 

17 00006 

18 00007 

19 00010 

20 00011 
21 

22 00012 

23 

24 

29 

26 00013 

27 00014 
28 

29 
30 
31 
32 

33 00016 

34 00020 
39 00022 

36 00024 

37 00026 

38 00030 

39 00032 
40 

41 00034 
42 
43 
44 

49 00034 
00039 
46 
47 
48 
49 
90 
91 



I 



000000 000000 LPt 



322 

000 

003 
U0 
200 
036 
060 
036 

000 



000 
046600 tP.NAnt 

000200 UP*TRP 
177914 IP.CSH 
177916 LP.ueK 



000120 
000133 
000000 
000000 
000000 
000000 
000000 



LPtSUt 
UPPCASI 

ovpknti 

LPiUlNI 
i.P«8K8l 
UPtTCti 
UPiBAUt 

LPtTOKI 



019 
014 



•OUOBL UP 
•lOENT /i3,01/ 

D08«ll DEVICE 0RIV|R«8 STANDARDIZED INTERFACE 



UP.FU6I 



• MORD 

• IFOF 
.BYTE 

• ENDC 
•IFNDF 

• BYTE 
.ENDC 
.BYTE 
.BYTE 

• BYTE 
.BYTE 
.BYTE 
.BYTE 
.BYTE 
.IF 

• BYTE 
.IFF 
.BYTE 
.ENDC 
.BYTE 
.RAD90 



i 
■ 

.WORD 

• WORD 

• WORD 

• WORD 
.WORD 

• WORD 
.WORD 



• IFOF 
.BYTE 

• ENDC 
.BYTE 

.EVEN 
.IFDF 

• WORD 

• ENDC 





LSll*SPREAO 

362 

USll&SPREAD 
322 



t USER'S DOB POINTER 
f FACIUITIES INDICATOR 

I FACILITIES INDICATOR 



I SPECIAL STRUCTURES, NONE 

<^WIOTH'»'37>/40» t STANDARD BUFFER SIZE 

LP.INT-UP I INTERRUPT ENTRY OFFSET 

; INTERRUPT PRIORITY 4' 

I OPEN ENTRY OFFSET 

t TRAN ENTRY OFFSET 

I CLOSE ENTRY OFFSET 



200 

LP.OPN-UP 

LP.TKN^UP 

UP.CU^«LP 

EQfUPTYP 





LP.SPC-UP 



/LP^ 

200 

177914 

177916 

WIDTH 

133 













000040 UP.UOW ■ 



tsu 

21 



LSll^SPREAD 




40 



; SPECIAL ENTRY OFFSET 

; SPARE 

t DEVICE DRIVER'S NAME 

f INTERRUPT VECTOR'S ADDRESS 

I COMMAND/STATUS REGISTER 

; DATA BUFFER REGISTER 

f THIS WORD IS SET BY THE INIT|A 

; SET TO THE HIGHER PRINT LIMIT 

I SET TO TRUE WHEN OVER PRINTING 

I ALREADY SENT (CHARACTERS) 

t BLANK POSITIONS COUNTER 

t TRANSFER CHARACTER COUNT 

t BUFFER ADDRESS POINTER 

I COMMAND DEVICE TO TOP-OF-FORM 

I COMMAND DEVICE TO ON-LINE 

I CR, FF 



I CHARACTER ELONGATION FLAG 



I PRINTABlLITYr LOWER LIMIT 



5-23 



I 

2 




; 




OPhN PROCESSUR 


3 0000^6 




tp, 


.QPNI 






4 




; 




CU08E PROCESbOR 


5 000046 




IP. 


iCU8J 






a 000036 


004767 
000454 






JSR 


PCfUP.STS 


7 000042 


062/01 
177772 






ADO 


<*UP,TOP-i»Rl 


8 000046 


010167 
177760 






MOV 


RliUP.BAO 


9 








• IFOF 


USll 


10 








MOV 


#-3,UP,TCT 


11 








,ENOC 




12 








• IF NOP 


USll 


13 00052 


010267 
177752 






MOV 


R2,UP,TCT 


14 








• ENOC 




15 








• IPOF 


USU&SPREAO 


16 








CUR 


UP. FUG 


17 








,ENQC 




18 000^6 


000414 






BR 


UP. INT 


19 












20 








• IPOF 


USll^SPREAO 


21 












22 




t 




SPECIAU 


PROCESSOR 


23 




LP. 


• SPCI 






24 








MOV 


2CR0J,R1 


25 








CMP8 


»lf (Rn 


26 








bUi. 


UP.S00 


27 








MOV 


2CRU,UP.FUG 


28 




UP. 


iS001 


JMP 


#14CR0) 


29 








.ENOC 




30 












31 




; 




IRAN PROCESSOR 


32 000e»0 




UP. 


iTKNI 






33 00060 


004767 
000432 






JSR 


PCUP.STS 


34 00064 


016700 
177710 






HOV 


UPpR0 


35 0.0070 


016067 
000006 
177734 






MOV 


6CR0]|UP«BA.D 


36 00076 


016067 
000010 
177724 






MOV 


10(R0)rUP.TC 


37 00104 


006367 
177720 






ASU 


UP.TCT 



I SIMUUATI INTERRUPT 

I Rl ■ PC (BY UP.STS) 

I INTERNAU BUFFERtS AOORESS 

; INITIAUliE TRANSFER COUNT 

> R2 ■ -2 (BY UP.STS) 

I INITIAUUE EUONGATION fuag 

f OISPATCH INTERNAU BUFFER 



f Rl • FUNCTION BUOCK'S AOORESS 

f UINE EUONGATION FUNCTION ? 

; NOf IGNORE 

; ENABUE/OiSABUe EUONGATION 

f EXIT VIA COMPUETION RETURN 



f SIMUUATE an INTERRUPT 

; R0 i USER IS DOB ADDRESS 

I RETAIN BUFFER'S ADDRESS 

t RETAIN DOB'S BYTE COUNT 



5-24 



1 

2 

3 000U0 

4 000U0 



5 000U6 

6 000U0 

7 000U4 

8 0001<i0 

9 0001.32 

10 00144 

11 00liJ6 

12 00140 
U 00142 

14 00146 

15 00lt3i2 

16 001d6 

17 001^0 

18 00162 

19 00166 
20 

21 
22 
23 
24 
29 00170 

26 00174 

27 00176 

28 00200 

29 00202 



30 00210 

31 00212 

32 00214 

33 00216 

34 00220 



36 00226 

36 00230 

37 00234 

38 00236 

39 690236 

40 

41 00242 



I 

LP.INTI 
042737 

00'0100 

177814 

002002 

000167 

000394 

005767 IP, 101 

177700 

001452 

010446 

010346 

010246 

010146 

016704 

177660 

016703 

177652 

016702 

177654 

112201 LPa00I 

001426 

120127 UP. 1011 

000040 

002442 



INTERRUPT PROCESSOR CViA INTERRUPT VECTOR AT 200) 
8IC #100i##|.P,CSR t DISABLE INTERRUPT 



120167 UP.I02S 

177624 

002111 

005203 LPfl03t 

003016 

032737 l.P,I04S 

100200 

177S14 

100531 

001520 

005304 

100404 

112737 

000040 

177516 

000763 

110137 LP,J05S 
177516 

005004 |.P,I06; 
UPtONPJ 
006267 UP.TRTJ 
177566 

001345 



BGE IP, 10 

4MP LP.EHr 

TST UP.TCT 

8EQ LP, DONE 

MOV R4,»tSP) 

MOV R3,*UP) 

MOV R2,-tSP) 

MOV R1,-(.SP) 

MOV LP,BKS,R4 

MOV LP,HN,R3 

MOV LP,8AD,R2 

M0V9 (R2)+,R1 

SEQ LP.ONp 

CMP9 R1,#LP,L0W 

bUT LP,n0 

•IFOF SPACES 

BGT LP. 1^2 

INC R4 

eR Lf.TRT 

.ENOC 

CMPti R1,UPPCAS 

BOE LP.Ila 

INC R3 

8GT LP.DNp 

BIT #100200, ##LP.CSR 



bMI LP. 122 

BEQ LP, 120 

DEC R4 

BMI LP. 108 

MOVE* #40,<»l»LP.D8R 



BR LP, 103 

M0V8 Rl,<»*»LP.DBR 

CLH R4 

INC LP,Tt;T 

BNE L^,I00 



SEGREGATe ERRORS 
ENTER ERROR PROCESSOR 

ANY CHARACTERS REMAINING ? 

NO, LINE COMPLETED 
SAVE REGISTERS 



R4 » BLANK COUNTER 

R3 • PRINT POSITION 

R2 « BUFFER POINTER (ADDRESS) 

♦♦♦ ACCESS CHARACTER ♦♦* 
NULL (0) IGNORED 
PRINTABILITY CHECK 

EXCEEDS LOWER LIMIT 

VALID CHARACTER, SO FAR 
BLANK t40) ISOLATED, COUNT 
ACCESS NEXT CHARACTER 

PRINTABILITY CHECK 

EXCEEDS UPPER LIMIT 
PRINTER'S WIDTH EXCEEDED ? 
YES, 00 NOT PRINT 
ACCESS ERROR/READY STATUS 



ERROR Indication 

NOT READY INDICATION 
DECREMENT BLANK COUNTER 
NOT PROCESSING BLANKS 
BLANK/HTAB EXPANSION PERFORMED 



CONTINUE PENDING COMPLETION 
*♦* PRINT CHARACTER *♦* 

INSURE NQ BLANKS PENDING 

INCREMENT BUFFER'S CHARACTER 

COUNTER, ANY MORE 7 
YES 



5-25 



I 

2 




1 
\ 

• 






HN£ COMPLETED 


3 

4 000244 


105737 
177514 


? 




TSTa 


#«»LP«CSK 1 


5 000250 


100103 






BPL 


LP.I21 ; 


6 000252 


004567 
000260 


LP, 


ONtJ 


JSR 


Ka,LP.SfcT > 


7 000256 


013746 

000044 


LP. 


DONI 


MOV 


#«S,KSAV#'*CSP) } 


8 000262 


004636 






JSH 


R5,PCSP)* > 


9 000264 


016700 
177510 






MOV 


LP»R0 I 


10 00270 


000170 
000014 






JMP 


#14(K0) 1 


U 












12 00274 


120127 
000011 


UP, 


I10J 


CMPa 


Rl,«ll r 


13 00300 


001010 






BNE 


LP, 113 ; 


14 




1 








13 




; 






HORIZONTAL TAB SI 


16 




1 








17 00302 


016746 
177510 






MOV 


LP,SiZ»-CSP) 1 


16 








• IFOF 


LSllSSPRtAO 


19 








TST 


LP.FLG ; 


20 








6£Q 


LP.IU » 


21 








A3R 


(SP) 1 


22 








.£NOC 




23 00306 


060316 


LP 


.1111 


AQU 


R3rCSP) r 


24 








.XFDF 


LSll48PRtA0 


25 








BG£ 


LP.U2 i 


26 








CLN 


LP.TLT I 


27 








bR 


LP. ONE 1 


28 








.ENO'C 




29 00310 


060416 


LP 


.lUl 


AQQ 


R4,(6P) ; 


30 00312 


052716 
17777^ 






618 


#177770» CSP) » 


31 00316 


102604 






bUB 


(5P)t,R4 } 


32 












33 00320 


000746 






BR 


LP.TKT } 


34 













> DEVICE BUSY ? 

YES 

RESTORE TEMPORARIES 

SAVE REGISTERS 



R0 * USER<S DDB ADDRESS 
EXIT VIA COMPLETION RETURN 

HORIZONTAL TAB (11) 1 
NO 
MULATION VIA BLANKS 

PRINTER'S MAX WIDTH 



ELONGATION ? 
NO 

(PRINTER'S HlOTH)/2 

• PRINT POSITION 

NOT EXCEEDED PRINTER'S »JlDTH 
ELONGATION LiNE TERMINATION 
EXIT 

♦ BLANK COUNTER 

( MODULO 8 ) - 8 

•♦■ BLANK COUNTER 
• BLANK COUNTER 
ACCESS NEXT CHARACTER 



5-26 



1 ^my^^ i'dv>X27 lp.ii«m 

A 000340 001014 

4 000342 005767 

177404 

5 000336 001021 

6 000340 016703 

177458 

7 000344 005403 



9 

10 

11 

12 

13 

14 

15 

16 

17 

la 

19 
20 
21 
22 
23 



24 

25 

26 

27 

28 
29 

30 
31 
32 
33 

34 
35 
36 
37 

38 
39 
40 
41 



00346 UPtlXXI 

00346 000732 

003t>0 lP,I14t 



IPaVYS 

003d(a 120127 

000022 
00334 001016 
00356 012701 

000012 
00362 120127 UPW1&? 

000012 
00366 002411 
00370 001404 
00372 120127 

000013 
00376 001717 
00400 000400 
00402 UP,I16i 
00402 0167^3 

177410 
00406 005403 



00410 000674 



CMPa 

BGT 

TST 

BN£ 
NOV 

NEG 

• IFOF 
TST 

ASR 
MOV 

• ENQC 

BR 

• IFOP 
TST 
dlQ 

CMPd 

BEQ 

• ENOC 
QMPB 

BNE 
MOV 

CMP9 

BIT 

BEQ 
CMP8 

BEti 
BR 

MOV 

NEG 

• IFOF 
TST 
BEQ 
ASR 
MOV 

• ENOC 
BR 



Rl,#l5 

UP,I14 
IP,I15 
QVPRNT 

ip.ne 

UP.SJIZ,R3 

R3 

USlliSPRtAD 

LP.FUG 

R3 
RSft^'.FlG 



lP,IkJ6 

usu&spreao 

LP, FUG 
LP.IYY 
Rlf#ia 
LP, 104 



Rlf#22 

LP,U7 
#3KlP2fRl 

Rlr#l2 

LP,Il7 

LP.ne 

Rli#t3 
LP.DNP 

LP.ne 

LP,SUfR3 

R3 

LSll&SPREAl) 

LP.FLG 

LP, 104 

R3 

R3,LH.PLG 

LP, 104 



t CARRIAGE-RETURN Cl5) ? 

f NO, ABOVE 

I HO, BELOW 

I PRINT THE CARRIAGE-RETURN 7 

I YES 

> R3 • -C PRINTER'S WIDTH) 



f 



t ELONGATION ENABLED ? 

f NO 

t HALVE PRINTER'S WIDTH 

; RE-INITIALIZE THE FLAG 



; SUPPRESS CARRIAGE-RETURN 



NO 

SUBSTITUTE APPROPRIATE CHAR 

LINEFEED (12) 7 

NOf BELOW 

YES 

VERTICAL TAB (13) ? 

YES, IGNORE IT I 

NO, FORMFEED (14) ISOLATED 

R3 • -( PRINTER'S WIDTH ) 



ELONGATION ENABLED 1 
NO, PRINT CHARACTER 
HALVE PRINTER'S WIDTH 
RE-INITIALIZE THE FLAG 

t PRINT THE CHARACTER 



5-27 



I iaBld4l2 012701 UP. 1171 HOV 

Z 000416 I3a0667 BR 

3 000420 120127 UP.lUt CMP8 

000172 

4 000424 003003 BQT 
6 f 

6 > 

7 1 

8 000426 042701 BIC 

000040 

9 000432 000661 BR 

10 00434 120127 IP.IISI CMP8 

000177 

II 00440 001676 BEQ 

12 004'»2 126727 CMP8 

177352 
000137 

13 00490 101252 BHI 

14 00452 fd^Q757 BR 
15 

16 00454 005303 UP. 1201 DEC 

17 00456 005302 DEC 
IB 00460 004567 UPtl2U JSR 

000052 

19 00464 052737 BIS 

000100 
177614 

20 00472 000002 RTI 
21 

22 00474 005303 UPtl22l DEC 

23 00476 005302 DEC 

24 00500 016746 UP.tRKI MOV 

177310 

25 00504 012746 MOV 

000402 

26 00510 000004 XOT 

27 00512 000167 JMP 

177372 



#40, Hi 

UP. 103 
Rlr#l72 



I unprintabue# buank substitutio 

I PRINT A BUANK 

f UQWER CA9E AUPHABET ? 



UP, 119 t EXCEEDS 

UOWEK CASE TO UPPER CASE CONVERSION PERFORMED 

#40,Rl I CONVERSION PERFORMED 



UP, 103 
R1,#177 

UP.ONP 
UPPCASi<*i37 



UP. 11^3 
UP. 117 

R3 
R2 
R5,UP.S£T 



I PRINT CHARACTER 

1 RUBOUT Ci77) ? 

I YES, IGNORED 

f UPPER CASE PERMITTED ? 



I YES, PRINT CHARACTER 

f UNPRINTABUE, BUANK SUBSTITUTIO 

f BACKUP PRINT POSITION 

I BACKUP BUFFER POSITION 

I RESTORE TEMPORARIES 



#100,##UP.CSR f ENABUE INTERRUPT 



R3 
R2 
UP,NAM,-CSP) 

#A002,»»C5P) 



UP. INT 



; EXIT FROM INTERRUPT 

t BACKUP PRINT POSITION 

I BACKUP BUFFER POSITION 

; DEVICE DRIVER'S MNEMONIC 

1 MESSAGE CODE 



f TRY AGAIN 



5-28 



1 

2 

3 

4 000516 




f * 

UP.STSJ 




INTEKRUPT SIMULATOR 


012601 


MOV 


C3P3*,Rl 


1 RETURN PC 


5 000620 


011646 




MOV 


(SP3r-CSP) 


1 OLD PC 


6 000922 


005002 




CLR 


R2 


t ADDRESS PS C-2) 


7 000924 


014266 

000002 




MOV 


-CR2)»2CSP) 


1 OLD STATUS 


8 000630 


013712 
000202 




MOV 


#«LP.TRP*2,(R2) 


r NEW STATUS 


9 000534 

10 

11 00536 


010107 




MOV 


Ri,pg 


1 RETURN 


010467 


UP. Sin 


MOV 


R4,tP,BKS 


1 RESTORE TEMPORARIES 




177264 










12 00542 


010367 
177256 




MOV 


R3,Uf.HN 


f 


13 00546 


010267 
177260 




MOV 


R2,UP,BA0 


f 


14 00562 


016604 
000010 




MOV 


10(8P3»R4 


1 RESTORE REGISTER 4 


15 00556 


012666 
000006 




MOV 


(SP)*,6CSP) 


1 RETAIN RETURN ADORE 


16 00562 


012601 




MOV 


CSP)*,R1 


f RESTORE REGISTERS 


17 00664 


012502 




MOV 


(3P)*,R2 


1 


18 00566 


012603 




MOV 


CSP)*,R3 


f 


19 00570 


000205 




RTS 


R5 


1 EXIT SUBROUTINE 


20 


000001* 




• END 







5-29 



OV.1,P0 MACrU V06»0i 09-JAN-74 12S55 PAGE U-1 
SYMBOL TABLE 



A002 i 


000402 


BF3HFT* 


010000 


BLANK i 


000040 


BSU8H • 


000i;34 


CR » 


000015 


DDBADRi 


000006 


OUBBLK* 


000004 


DDBCNT9 


000010 


QOBCRT* 


000014 


OOBOVA* 


177776 


t)DB3TS» 


000012 


OOBULA* 


000002 


DOBUNT* 


000013 


DITBFSi 


000004 


DITBMPi 


000016 


DITB5Y* 


000000 


DITFACi 


000002 


OITINT* 


000005 


DITMrD» 


000014 


OlTNAMi 


000012 


DnOPNn 


000007 


DiTPRIt 


000006 


OlTSPFi 


000011 


DITXFR» 


000010 


EMTINTI 


000006 


EMTRETi 


000014 


EMTVAL* 


104000 


EMTVEC* 


000030 


FTCOM • 


000001 


FTOOS « 


000001 


FTMUO « 


000001 


FTRPG «» 


000001 


FTRP031 


000001 


F001 • 


001401 


F002 • 


001402 


F003 ■ 


001403 


F005 « 


001409 


F007 ■ 


001407 


F011 ■ 


001411 


F012 • 


001412 


F017 • 


001417 


F024 m 


001424 


F042 • 


001442 


F050 « 


0014^0 


F052 ■ 


.001452 


KSBSiZ" 


000400 


LF • 


000012 


LP 


000000KQ 


LPTyP • 


000000 


LP. BAD 


000032R 


LP.BKS 


000026R 


LP, CIS 


000036R 


LP.CSRi 


177514 


LP.DBRi 


177516 


LP.ONfe 


000292R 


LP.ONP 


000236R 


LP. DON 


000256R 


LPrERR 


000500R 


LP. INT 


000110R 


LP.IXX 


000346R 


LP,I0 


000124R 


LP. 100 


0001d6R 


LP. 101 


000162R 


LP,I02 


000170R 


LP. 103 


000176R 


LP. 104 


000202R 


LP.I05 


000230R 


LP. 106 


0002<i4R 


LP. 110 


000274R 


LP. Ill 


000306R 


LP. 112 


000310R 


LP. 113 


000322R 


LP. 114 


000350R 


LP. IIS 


000362R 


LP. 116 


000402R 


IP. 117 


000412R 


LP, 118 


000420R 


LP. 1 19 


000434R 


UP. 120 


000454R 


IP.I21 


0004t>0R 


LP.I22 


000474R 


LP. LIN 


000024R 


LP. LOW* 


000040 


LP. NAM 


000014R 


LP.OPN 


000036R 


LP. SET 


000536R 


LP.srz 


000016R 


LP.ST8 


000S16R 


LP.TCT 


000030R 


LP.TOF 


000034R 


LP.TRN 


000060R 


LP.TRPt 


000200 


LP.TRT 


000236R 


LPIX • 


000001 


MSBSIZ" 


001000 


OVL006* 


000002 


OVL016" 


000006 


OVPRNT 


000022R 


OV10611 


000012 


OV2061» 


000012 


PATSIZ* 


000030 


PRI4 ■ 


000200 


PRJ7 « 


000940 


PS • 


177776 


PSPRI0« 


177437 


RPBIT ■ 


004000 


RP02SZ* 


000020 


RUBOUTt 


000177 


SKIP2 ■ 


000012 


SMB3IZP 


000040 


STMA8KP 


107070 


S.RSAV* 


000044 


TABCH ■ 


000011 


UPPCAS 


000020R 


V.CDB • 


000050 


V.COQ » 


000052 


V.6T8 • 


000054 


V.RLS • 


0000d6 


V.RRES* 


000046 


V.RSAVp 


000044 


V.SVT » 


000040 


V.XIT • 


000042 


WIDTH » 


000120 


XFTCOM* 


000000 


XFTOOSi 


000000 


XFTMUOp 


000000 


XFTRPGW 


000000 


$$PASS» 


000000 






. AB5, 


000000 
000572 


000 
001 








E-RRORS t 


)ETfcCTEQl 











FREE CUREI 15039. 


, wQKUS 








,LPlLp0/CHF<bYlpRAMTR/NL#SySMAC, 


» FEATSw, OKI ILP0 1200* 2003 /tl^UIl ME 



5-30 



CROSS REFeRtiNCE TAtfUfe S*l 



A002 


1 ** 


S3# 


4» 49# 


10- 


25 




BFSHFT 


1 <■> 


102<» 










BUANK 


1 • 


123# 










BSISH 


I m 


124# 










CR 


X ** 


X2&H 










008ADR 


i <*> 


6An 










ooeaUK 


1 ■> 


ei3t^ 










OOBCNT 


1 III 


55# 










DOSCRT 


1 ** 


6a# 










D08DVA 


l" 


5l# 


1«106# 








OOBSTS 


1 ** 


e>6# 










OOBUUA 


1 ** 


&2# 


U10S# 








OOBUNT 


1 * 


57# 










OITBFS 


1 * 


36# 










DITBMP 


1 * 


4S# 










OITBSY 


\ m 


34 # 










OITFAC 


1 «• 


39^ 










OITINT 


1 * 


38# 










onriFu 


1 * 


441* 










OITNAM 


1 * 


43# 










OITO^N 


1 *■ 


40# 










OITPHI 


I ** 


39 # 










OITSPF 


1 *• 


42f» 










OITXFR 


1 * 


4l# 










EMTINT 


1 * 


b3# 










EMTRfcT 


1 * 


ft2# 










EMTVAL 


t "• 


6l>* 










EMTVfeC 


1 ** 


64«ii 










FTCOM 


3» 


6# 










FTUOS 


3- 


12« 










FTMUO 


3- 


01^ 










FTRPG 


4« 


10«( 










FTRP03 


3- 


16# 










FI301 


I* 


bl« 










fmz 


l" 


80# 




\ 






Pmi 


1" 


as*^ 










F005 


l- 


82^ 










fd&7 


l- 


ae^ 










F0U 


l« 


a6# 










F012 


!• 


87» 










Ftai7 


I. 


89# 










F024 


i- 


9l# 










F042 


!• 


921* 










F0b0 


l" 


84« 










F092 


1* 


90# 










KS8SIZ 


2Mb0# 










UF 


I- 


I2l# 










LP 


&• 
»« 


2i* 
9 


S- 7# 


S« 


16 5- la 


5« 19 


LPTYP 


4« 


18 


4* 2i 


3- 


21 




LP.BAO 


t>- 


394 


6» 8# 


6". 


35* 7- 15 


U" 13# 


UP.BKS 


a- 


37# 


7- 13 


U- 


U* 




LP.CUS 


5* 


20 


(>« 5# 






« 


LP.CSR 


&«• 


30« 


/.. 4^ 


7- 


29 a.. 4 


10* 19* 


LP.DBR 


5* 


31** 


7* 34<» 


7- 


36* 




LP.DNfc 


a« 


6# 










UP.ONP 


7'- 


17 


7- 28 


7- 


38# 9. 30 


10- a 


LP.DON 


7* 


6 


8« 7« 









34 



5-31 



CH03S REFfcKtNCfe TAttUt S-2 



UP, 


.ERR 


7 " 


6 


10- 


24« 




















UP, 


,INT 


5* 


16 


6« 


18 


7- 


3# 


10. 


27 












UP, 


.IXX 


9" 


14# 
























UP. 


.IK) 


7 ** 


5 


7. 


7# 




















UP, 


illt)0 


7 * 


16# 


7» 


41 




















UP, 


.1(91 


7 ** 


ie# 
























UP, 


,1^2 


7 * 


25» 
























UP, 


.1(99 


7 * 


27# 


7- 


35 


10- 


2 


10- 


9 


10- 


13 








UP, 


.104 


7 ■* 


29# 


9- 


41 




















UP, 


.105 


7 * 


33 


7.. 


36 «» 




















UP, 


,106 


Jm 


37» 


9. 


15 




















UP, 


.U0 


7 * 


19 


8-* 


12«» 




















UP, 


.ni 


8» 


23J« 
























UP. 


.112 


«*- 


29# 
























UP, 


,113 


8- 


13 


9* 


U 




















UP, 


.114 


ym 


2 


9. 


16# 




















UP. 


.119 


9- 


3 


9« 


26« 




















UP, 


.116 


9" 


5 


9- 


28 


9- 


31 


9- 


92# 












UP, 


.117 


9* 


24 


9. 


27 


10- 


1# 


10. 


14 












UP. 


.iia 


7- 


26 


10- 


3# 




















UP. 


.119 


10* 


4 


10- 


10«> 




















UP. 


.120 


7* 


31 


10- 


16# 




















UP, 


.121 


e» 


5 


10- 


18# 




















UP, 


122 


7- 


30 


10- 


22tt 




















UP, 


,UIN 


B- 


36» 


7- 


14 


11- 


12# 
















UP, 


uow 


&- 


51» 


7- 


18 




















UP. 


,NAM 


&« 


27*» 


10- 


24 




















UP. 


.OPN 


0- 


18 


6. 


3# 




















UP, 


.3ET 


»• 


6 


10- 


18 


11- 


ll# 
















UP. 


SIZ 


t>- 


33<^ 


8- 


17 


9- 


6 


9- 


33 












UP. 


8TS 


6» 


6 


6- 


33 


u- 


An 
















UP. 


,TCT 


t,m 


38» 


6- 


13^ 


6- 


36f 


6- 


37(» 


7- 


7 


7- 


39p 




UP, 


,TOF 


0* 


4l# 


6. 


7 




















UP. 


.TRN 


Qi. 


19 


6- 


62n 




















UP. 


,TRP 


5- 


29«» 


11- 


8 




















UP. 


.TRT 


7- 


39# 


8- 


33 




















UPU 


4" 


23# 
























usu 


&- 


6 


S- 


11 


5- 


42 


5- 


A7 


6- 


9 


6* 


12 


6- 15 






6- 


20 


8- 


18 


8- 


24 


9- 


8 


9- 


16 


9- 


35 




MSBSIZ 


2- 


159# 
























OVUSftfH 


1 * 


108» 
























0VU»16 


1 ** 


107*» 
























OVPRNT 


£>• 


3&# 


9- 


4 




















ovieei 


1 ** 


109# 
























OV20C>1 


1 * 


U0# 
























PATSIZ 


1 •• 


116# 
























PC 




1 ** 


Uf* 


4- 


47* 


6- 


6$ 


6- 


33# 


11- 


9# 








PRI4 


I •' 


74it 
























PRI7 


1 "* 


75# 
























PS 




I* 


72# 
























PSPRIO 


I" 


73» 
























RP8IT 


1 ** 


103# 
























RP02SZ 


1 ** 


104# 
























RUBOUT 


1 ** 


125<» 
























R0 




J m 


7» 


4- 


40# 


6- 


34# 


6- 


35 


6- 


36 


8- 


9$ 


a- 10 


Rl 




1 " 


an 


4- 


41» 


6- 


7# 


6- 


8 


7- 


12 


7- 


I6t» 


7- 18 






7» 


25 


7- 


36 


8- 


12 


9. 


1 


9- 


23 


9- 


25^ 


9- 26 






9- 


29 


10- 


19 


10- 


3 


10- 


8# 


10- 


10 


11- 


49 


U- 9 



5-32 



CROSS REf'fcKfcNCe TABLfe S-3 





U" 16$ 


























R2 


l» 9» 


4» 


42# 


6» 


13 


7.1 


11 


7. 


15* 


7- 


16 


10- 


17# 




la- 23f 


u- 


$# 


11» 


7 


11. 


8f 


11- 


13 


11- 


17# 






R3 


• !• ifun 


4» 


43i» 


7« 


10 


7m 


I4f 


7- 


27# 


8* 


23 


9. 


6# 




»• 7# 


9« 


33# 


9-< 


34# 


10- 


1«# 


10- 


22f 


11- 


12 


11- 


ia# 


R4 


8« 3l# 


4«. 


44# 
U 


7- 

11- 


9 

I4r 


7- 


13* 


7- 


32# 


7- 


37# 


8» 


29 


R5 


1- 12# 


4i 


4S^ 


8- 


Q$ 


8. 


8* 


10- 


18# 


11- 


19# 






3KIP2 


4* 24# 


»» 


25 






















SMBSIZ 


2-lS8# 


2»; 


U9 


2-: 


160 


















8P 


I- 13# 


4m 


46# 


7» 


9# 


7m 


10# 


7» 


Hi 


7- 


120 


8« 


7# 




8» 6 


&m 


17# 


8« 


23# 


Urn 


29f 


8- 


30» 


8- 


31 


10- 


24# 




10** 25# 


11- 


4 


11- 


' 5# 


U- 


^f 


11- 


14 


11- 


15# 


11» 


16 




U- 17 


11" 


18 






















SPACES 


7- 20 


























SPREAD 


5* 8 
9» 8 


6» 

9ii» 


11 

la 


5- 
9» 


47 

35 


e>* 


15 


6« 


20 


a- 


18 


8* 


24 


STMASK 


I- 93# 


























S.RSAV 


4» 5l» 


a. 


7 






















TA8CM 


1*122«* 








. 


















UPPCAS 


5» 34# 


;• 


25 


13- 


12 


















V.COB 


1" 25# 


























V.CDU 


1" 26« 


























V.STB 


I- 27» 


























V.RLB 


1- 28l« 


























V.RRES 


I- 24*> 


























V.RSAV 


l* 23# 


























V.SVT 


!• 2l» 


























v,xn 


I- 28« 


























WIOTH 


4» 36 


5. 


15 


S- 


33 


















XFTCOM 


a- 7» 


























XFTOOS 


3« 13*» 


























XFTMUO 


3» 9# 


























xftrpg 


3- ll# 


























$$PASS 


2-l77# 

b- 7 



























5-33 



CROSS ReFfcRENCE TABtt M.J 



AERROR 


2* 9l«* 


CALL 


2« 73# 


CALL5 


£• 69# 


CMKPNT 


2* 96» 


DIAL 


2-324# 


ERROR 


2" 18« 


FIRROR 


2* 28# 


FREM5B 


2-2Sl# 


6ETBUF 


2«i24# 


lERROR 


2- 39# 


lOTERR 


2« 24<> 


MOOEND 


2«2d2M 


MOOSTA 


2»179# 


MQVMSB 


2»273# 


MOVSEG 


2-297# 


OUTMSB 


2-2d9* 


OVLNAM 


2«222# 


POP 


2" 53# 


PUSH 


2- 57i» 


QORVR 


2-l46i» 


RELBUF 


2«l38# 


RESREG 


2-lia7# 


RETEMT 


2«2S0f* 


RETURN 


2» 77# 


SAVREG 


2»lid2# 


SERROR 


2* 3S# 


SETABS 


2«165# 


STOEV 


2-3'i3# 


SWPCAL 


2» 84# 


WERROR 


2«» 43*r 



CROSS REfERENCe TaBLE C«l 

9952(9 
, ABS, 55520 



5-34