File Number 1130-30 Order Number GC26-5929-8
Systems Reference Library
IBM 1130 Subroutine Library Ninth Edition (May 1974)
This is a reprint of GC26-5929-7 incorporating changes released in the following newsletter GN34-0182.
This edition applies to version 2, modification 12 of IBM 1130 Disk Monitor System and to all subse- quent modifications until otherwise indicated in new editions or Technical Newsletters. Changes are continually made to the specifications herein; beforeusing this publication in connection with the operation of IBM systems, consult the latest SRL Newsletter, Order No. GN20-1130, for the editions that are applicable and current.
Text for this manual has been prepared with the IBM Selectric® Composer.
Requests for copies of IBM publications should be made to your IBM representative or the IBM branch office serving your locality.
A form for readers' comments is provided at the back of this publication. If the form has been removed, send your comments to IBM Corporation, Systems Publications, Department 27T, P. 0. Box 1328, Boca Raton, Florida 33432. Comments become the property of IBM.
©Copyright International Business Machines Corporation 1965, 1966, 1967, 1968, 1969, 1970, 1972
2 Preface
The publication describes how the The operating procedures manuals for the programmer can use the IBM 1130 library programming systems also provide subroutines to increase the efficiency of information on subroutine usage. These his programs and decrease his writing and manuals are: testing time. The libraries include the following programs: IBM 1130 Card/Paper Tape Programming • Interrupt Level Subroutines. System Operator s Guide, Order No. • Interrupt Service Subroutines. GC26-3629. • RPG Subroutines. • FORTRAN I/O Subroutines. • Data Code Conversion Subroutines. IBM 1130 Disk Monitor System, Version 2, • Arithmetic and Functional Subroutines. Programmer s and Operator s Guide, Order • Selective Dump Subroutines. No. GC26-3717. • Utility Programs. The subroutines are available for use with the 1130 Assembler, the 1130 FORTRAN Compiler, and the 1130 RPG Compiler. The MACHINE CONFIGURATION Utility Programs are executable under Monitor control. The use of the library subroutines requires the following minimum machine In Assembler language, the user calls configuration: the subroutines via a calling sequence. The appropriate subroutine calls are IBM 1131 Central Processing Unit with generated by the FORTRAN Compiler whenever 4096 words of core storage. a read, write, arithmetic, or CALL statement is encountered. The RPG Compiler IBM 1442 Carl Read Punch, or IBM 1134 generates the appropriate subroutine Paper Tape Reader with IBM 1055 Paper linkages. This publication describes each Tape Punch. subroutine and the required calling sequence. All subroutines in the 1130 libraries are included in the lists that Note: RPG, available only with the DM2 appear in Appendix A. system, requires 8192 words of core storage. It is assumed that the reader is familiar with the methods of data handling In addition, the following input/output and the functions of instructions in the units and features can be controlled by IBM 1130 Computing System. He must also be the input/output subroutines. familiar with the Assembler or Compiler used in conjunction with the subroutines. Console Printer/Keyboard The following IBM publications provide the Single Disk Storage prerequisite information: 1132 Printer 1627 Plotter IBM 1130 Functional Characteristics, 1403 Printer (DM2 only) Order No. GA26-5881. 2310 Disk Storage (DM2 only) IBM 1130 Operating System, Order No. 2311 Disk Storage (DM2 card system only) GA26-5717. 2501 Card Reader (DM2 only) 1231 Optical Mark Page Reader (DM2 only) IBM 1130 Assembler Language, Order No. GC26-5927. Synchronous Communications Adapter (DM2 only) IBM 1130/1800 Assembler Language, Plotter subroutines are described in IBM Order No. GC26-3778. 1130/1800 Plotter Subroutines, Order No. IBM 1130/1800 Basic FORTRAN IV Language, GC26-3755. Order No. GC26-3715. IBM 1130 RPG Specifications, Order No. SCA subroutines are described in IBM GC21-5002. 1130 Synchronous Communications Adapter Subroutines, Order No. GC26-3706.
3
Contents
INTRODUCTION 7 CARDZ - 1442 Card Read Punch I/O Subroutine 71 INTERRUPT SERVICE SUBROUTINES 8 PAPTZ - 1134/1055 Paper Tape Realer ISS Characteristics 8 Punch I/O Subroutine 71 Methods of Data Transfer 8 PRNTZ - 1132 Printer Output Interrupt Processing 8 Subroutine 71 ILS Operation 9 ISS Operation General Error-Handling Procedures 12 I Basic ISS Calling Sequence 14 SUBROUTINES USED BY FORTRAN (DM2 Assignment of Core Storage Locations SYSTEM) 73 (C/PT System) 16 General Specifications (Except DISKZ) 73 Assignment of Core Storage Locations Error Handling 73 (DM2 System) 17 Descriptions Of I/O Subroutines . . 73 Descriptions of Interrupt Service IYPEZ - Keyboard/Console Printer I/O Subroutines 19 Subroutine 74 1442 Card Read Punch Subroutines WRTYZ - Console Printer Output (CARDO and CARD1) 19 Subroutine 74 2501 Card Reader Subroutines (READO CARDZ - 1442 Card Read Punch I/O and READ1) 21 Subroutine 74 1442 Card Punch Subroutines (PNCHO PAPTZ - 1134/1055 Paper Tape Reader and PNCH1) 22 Punch I/O Subroutine 74 Disk Subroutines (C/PT PRNTZ - 1132 Printer Output System) 24 Subroutine 74 Disk Subroutines (DM2 System) . . . 28 PNCHZ - 1442 Output Subroutine . . . 75 DISKZ - Disk I/O Subroutine 32 READZ - 2501 Input Subroutine . . . 75 1132 Printer Subroutine (PRNT1) . . 33 PRNZ - 1403 Printer Subroutine . . . 75 1132 Printer/Synchronous Communications Adapter Subroutine DATA CODE CONVERSION SUBROUTINES . . . 76 (PRNT2) 35 Descriptions Of Data Codes 76 1403 Printer Subroutine (PRNT3) . 36 Hexadecimal Notation 76 Keyboard/Console Printer 38 IBM Card Code 77 Paper Tape Subroutines (C/PT Perforated Tape And Transmission Code System) 40 (PTTC/8) 77 Paper Tape Subroutines (DM2 System) 42 Console Printer Code 77 Plotter Subroutine (PLOT1) 44 Extended Binary Coded Decimal Plotter Subroutine (PLOTX) 45 Interchange Code (EBCDIC) 78 1231 Optical Mark Page Reader 1403 Printer Code 78 Subroutine (OMPR1) 46 Conversion Subroutines 78 2250 Display Unit Model 4 I/0 BINDC 79 Subroutine (DSPYN) 48 DCBIN 80 BINHX 80 RPG SUBROUTINES (DM2 SYSTEM) 49 HXBIN 81 Disk File Management Subroutines (DM2 HOLEB 81 System) 49 SPEED 82 Disk I/O Subroutines 49 PAPEB 83 File Organization 49 PAPHL 85 File Processing 49 PAPPR 86 Sequentially Organized Disk Routines 50 HOLPR 87 Indexed Sequential Organized (I SAM) EBPRT 88 Disk Routines 53 BIDEC 89 RPG Object Time Subroutines 66 DECBI 90 ZIPCO 90 1SUBROUTINES USED BY FORTRAN (C/PT SYSTEM) 70 ARITHMETIC AND FUNCTIONAL SUBROUTINES 93 General Specifications 70 Real Data Formats 93 Error Handling 70 Real Number Pseudo Accumulator . . . 94 Descriptions of I/O Subroutines . . 70 Calling Sequences 94 TYPEZ - Keyboard/Console Printer I/O Arithmetic And Functional Subroutine Subroutine 71 Error Indicators 98 WRTYZ - Console Printer Output Functional Subroutine Accuracy 100 Subroutine 71 Extended Precision Subroutines . . . 100
5 Standard Precision Subroutines . . . .101 Paper Tape Utility (PTUTL) 111 Elementary Function Algorithms 102 Sine-Cosine 102 WRITING ISS AND ILS (C/PT Arctangent 103 SYSTEM) 112 Square Root 103 Interrupt Service Subroutines 112 Natural Logarithm 104 Interrupt Level Subroutines 112 Exponential 104 Hyperbolic Tangent 105 APPENDIX A. LISTING OF SUBROUTINES . . .118 Real Base to Real Exponent 105 APPENDIX B. ERRORS DETECTED BY THE ISS SELECTIVE DUMP SUBROUTINES 106 SUBROUTINES 130 Dump Selected Data On Console Printer Or 1132 Printer 106 APPENDIX C. SUBROUTINE ACIION ON Dump Status Area 106 RETURN FROM A USER S ERROR SUBROUTINE .132 SPECIAL MONITOR SUBROUTINES 107 APPENDIX D. CHARACTER CODE CHART . . . .133 FLIPR (LOCAL/SOCAL Overlay) 107 APPENDIX E. CORE REQUIREMENTS OF RDREC (READ ID Record) ...... 107 SUBROUTINES 137 CALPR (Call System Print) 107 FSLEN (Fetch Phase IDs and Fetch APPENDIX F. EXECUTION TIMES OF System Subroutine) 107 SUBROUTINES 139 SYSUP (DCOM Update) 107 APPENDIX G. RE-ENTERABLE CODE . . . . .143 Re-enterable Code 143 Calling a Re-Enterable Subroutine . 144 SYSTEM LIBRARY MAINLINE PROGRAMS (242 Obtaining Temporary Storage 144 1 SYSTEM) 109 Modifying Storage or Instructions . .144.2 Disk Maintenance Programs 109 1800 Compatibility 145 INDEX 146
6 Figures
Figure 1. Call Portion of an ISS . . 11 Figure 17. Disk File Information Figure 2. Interrupt Response Table for ISAM Random (Part 1 of 2) 67 Portion of an ISS 11 Figure 18. Hexadecimal Notation . . 77 Figure 3. (C/PT System ISS Figure 19. PTTC/8 Code for the Names) 14 Characters 1/ (if lower case) or Figure 4. DM2 System ISS Names . . 15 the Characters =? (if upper case) . 77 Figure 5. ISS and ILS Core Figure 20. Types of Conversion . . . 79 Locations for the (C/PT Figure 20.1 System Library EBPT3 . 92 System) 17 Figure 21. Arithmetic and Figure 6. ISS and ILS Core Functional Subroutines 95 Locations for the DM2 System . . . 18 Figure 22. (C/PT System) Figure 7. Carriage Control ISS/ILS Correspondence 112 Operations for 1132 Printer . . , . 35 Figure 23. (C/PT System) Figure 8. Carriage Control Subroutine Library (Part 1 of 3) . .118 Operations for 1403 Printer . . . . 38 Figure 24. 1130 Disk Monitor Figure 9. PLOT1 Control Digits • . 45 Version 2 System Library (Part 1 Figure 10. PLOT1 Example 45 of 9) 121 Figure 10.1 PLOTX Control Digits . 46 Figure 25. Core Requirements of Figure 10.2 Space Utilization for Arithmetic and Functional Various Size Records for Sequential Subroutines 137 Files 50 1 Figure 26. Core Requirements of - Figure 11. Disk File Information Miscellaneous and ISS Subroutines .138 Table for Sequential Access . . . . 52 Figure 27. Core Requirements of Figure 12. Disk File Information Conversion Subroutines 138 Table for Direct Access 54 Figure 28. Core Requirements of RPG Figure 13. Format of an ISAM Label 55 Subroutines (DM2 only) 138 Figure 13.1 ISAM Cylinder Index Figure 29. Execution limes of Chart 57 Conversion Subroutines 139 Figure 13.2 Space Utilization for Figure 30. Execution Times of 1130 Various Size Records for Indexed ISS (C/PT System) 140 Sequential Files. 58 Figure 31. Execution Times of 1130 Figure 14. Disk File Information ISS (DM2 System) 141 Table for ISAM Load (Part 1 of 2) . 59 Figure 32. Execution Times of Figure 15. Disk File Information Arithmetic and Function Table for ISAM Add (Part 1 of 2) . . 62 Subroutines 142 Figure 16. Disk File Information Figure 32.1 Modifying Storage or Table for ISAM Sequential (Part 1 Instructions . . . . 144.2 of 2) 64
6.1
Introduction
It is often necessary to repeat a group, or These subroutines are contained in the block, of instructions many times during following separately available programs: the execution of a program (examples include conversion of decimal values to equivalent binary values, computation of • Graphic Subroutine Package, which square roots, and the reading of data from enables the FORTRAN IV or Assembler a card reader). It is not necessary to language programmer to display images write the instructions each time a function in the form of lines, points, and is required. Instead, the block of characters on the screen of a 2250 instructions is written once, and the main Model 4 Display Unit attached to the program transfers to that block each time 1130 system. The program also it is required. Such a block of provides for communication between the instructions is called a subroutine. 2250 operator and the user s program. Subroutines normally perform such basic It is described in the publication IBM functions that they can assist in the 1130/2250 Graphic Subroutine Package solution of many different kinds of for Basic FORTRAN IV, GC27-6934. problems. • Data Transmission Subroutines, which When a main program uses a subroutine enable the FORTRAN IV or Assembler several times, which is the common language programmer to transmit data situation, the block of instructions between a program being processed by constituting the subroutine need appear the Disk Monitor System Version 2 and only once. Control is transferred from a a program being processed by a remote main program to the subroutine by a set of System/360 Operating System. These instructions known as a calling sequence, subroutines permit an 1130 program to or basic linkage. A calling sequence use the high-speed computational transfers control to a subroutine and, capability and large storage capacity through parameters, gives the subroutine of the IBM System/360 Operating any control information required. System. Communication between the two systems is accomplished in binary synchronous mode via telecommunication The parameters of a calling sequence lines. The data transmission vary with the type of subroutine called. subroutines are described in the An input/output subroutine requires several publication IBM System/360 Operating parameters to identify an input/output System and 1130 Disk Monitor System: device, storage area, amount of data to be System/360-1130 Data Transmission for transferred, etc., whereas an FORTRAN, GC27-6937. arithmetic/functional subroutine usually requires one parameter representing an argument. Each calling sequence used with • Satellite Graphic Job Processor, which subroutines in the 1130 system consists of enables the user at a 2250 Model 4 a CALL or LIBF statement (whichever is Display Unit attached to the 1130 to required to call the specific subroutine), easily start the processing of related followed by the DC statements that make up programs in a remote System/360 the parameter list. The calling sequences Operating System. This allows the for the various subroutines in the 2250 user to access the high-speed libraries are presented later in the computational capability and large manual. Each subroutine is self-contained, storage capacity of the IBM System/360 so that only those subroutines required by Operating System. Use of the the current job are in core storage during Satellite Graphic Job Processor execution. requires the data transmission subroutines discussed in the preceding paragraph. The Satellite Graphic Job In addition to the subroutines described Processor is described in the in this publication, subroutines are publication IBM System/360 Operating available for use with the Disk Monitor System and 1130 Disk Monitor System: System, Version 2 that are not provided in User s Guide for Job Control from an the system library for that version. IBM 2250 Display Unit Attached to an IBM 1130 System, GC27-6938.
Introduction 7 Interrupt Service Subroutines
The interrupt service subroutines (ISSs) user s I/O area. Once initiated, data transfer data from and to the various transfer proceeds concurrently with program input/output devices attached to the execution. An operation-complete interrupt computer. These subroutines handle all the signals the end of an I/O operation when details peculiar to each device, including all data has been transferred. All disk the usually complex interrupt functions, drives, the 1403 Printer, and the 2501 Card and can control many input/output devices Reader operate via a data channel. at the same time by overlapping their operations. INTERRUPT PROCESSING ISS Characteristics Interrupt processing is divided into two To fully understand subsequent descriptions parts, level processing and device of each ISS, the user should be familiar processing. The flow of logic in response with the following characteristics, which to an interrupt is: user program are common to all ISSs: interrupted, level processing begun, device processing begun and completed, level • Methods of data transfer. processing completed, and user program continued. • Interrupt processing. • ILS (interrupt level subroutine) Level Processing operation. Level processing consists of selecting the • ISS (interrupt service subroutine) correct device processing subroutine, operation. performing certain housekeeping functions, and clearing the level by a BOSC • g eneral error-handling procedures. instruction when interrupt processing is complete. • Basic calling sequence. Level processing is done by the ILSs (interrupt level subroutines). Entered by METHODS OF DATA TRANSFER interrupts, ILSs give temporary control to device processing subroutines (ISSs) and IBM 1130 I/O devices and their related eventually return control to the user subroutines can be differentiated according program. The interrupt entrance address is to their methods of transmitting and/or stored during the loading of a core load or receiving data. program, in the appropriate interrupt branch address; location 8 for interrupt Direct Program Control level zero (ILS00), location 9 for interrupt level one (ILS01),..., location Serial I/O devices operate via direct 12 (/000C) for interrupt level four program control, which requires a (ILSO4). The device processing entrance programmed I/O operation for each word or address is computed during the loading of a character transferred. A character core load from identifying information that interrupt occurs whenever a character I/O is a part of the ILS. operation is completed. Direct program control of data transfer is used for the In the card/paper tape system, the following system I/O devices: 1442 Card device processing entrance address is Read Punch, 1442 Card Punch, 1134 Paper stored during the loading of a program from Tape Reader and 1055 Paper Tape Punch, identifying information stored in the ILS, Console Printer, Keyboard, 1132 Printer, in the compressed ISS header card, and in and 1627 Plotter. the loader interrupt Transfer Vector. Data Channel Device Processing Other system I/O devices operate via a data Device processing consists of operating an channel, which requires an I/O operation I/O device, processing the interrupts, and only to initiate data transfer. These clearing the device by an XIO (sense DSW) devices are provided with control instruction when interrupt processing is information, word counts, and data from the complete.
8 Device processing is done by the ISSs If this handling includes calling the (interrupt service subroutines). The ISSs Console Printer subroutine, certain can be entered by a calling instruction information is destroyed, the most (LIBF or CALL), which either requests important of which is the return address of certain initialization to be done or the program that originally called the requests an I/O device operation. They can Console Printer. also be entered by an ILS as part of the interrupt processing. The calling entry To prevent the loss of data resulting point is specified in the ISS statement. from such a recurrent entry, the user must The interrupt entry points are set up in provide the programming required to save the ISS and identified in the ILS. They the return address and any other data are entered indirectly through a branch needed to continue an interrupted address table. subroutine after an interru pt has been serviced. ILS OPERATION Note: All ISSs were written with the assumption that all LIBFs to them would be The ISS/ILS package services all executed on the mainline level (i.e., not input/output interrupts. while on the interrupt level). There are no provisions in any ISSs to handle Description recurrent entries. See Appendix G for information on user-written re-enterable There is one ILS for each interrupt level code. used. Each subroutine determines which device on its level caused a particular interrupt; preserves the contents of the Accumulator, the Accumulator Extension, ISS OPERATION Index Register 1 (ull), and the Carry and Overflow indicators; and transmits identi- This section briefly describes the fying information to the ISS. Disk Monitor operation of the ISSs. This description, ILSs also save Index Register 2 (KR2). The along with some basic flowcharts, should special ILSX subroutines in DM2 save make it easier for the reader to understand and restore Index Register 3. the descriptions of individual subroutines presented later. Interrupt service subroutines are loaded first so that the loader loads only the The disk subroutines are included here ILSs that are required. For example, if a as ISSs even though in the Disk Monitor main program does not call the 1132 Printer System they are not truly ISSs. They do subroutine, the subroutine for interrupt however, have most of the characteristics level 1 (ILS01) need not be loaded because of an ISS. no interrupts will occur on that level. An ILS cannot be called; it is included in a ISS Subdivision core load or program only if requested by an ISS. If you use the 1130 Card/Paper Each ISS is divided into a call portion and Tape system, see "ISS-Define Interrupt an interrupt response portion. The call Service Entry Point" in IBM 1130 Assembler portion is entered when a user s calling Language. If you use the 1130 Disk Monitor, sequence is executed; the interrupt Version 2, system (DM2), see "Define response portion is entered as a result of Interrupt Service Subroutine Entry Point" an I/O interrupt. in IBM 1130/1800 Assembler Language. Call Processing When the ILSs are loaded, the core addresses assigned to them are incorporated The Interrupt Service Subroutines -- with into the appropriate locations in the the exception of those used by FORTRAN -- Interrupt Transfer Vector (decimal words save and restore the contents of the 8-13). Interrupts occurring during Accumulator, Index Registers 1 and 2, and execution of a user program cause a Branch the Carry and Overflow Indicators. Indirect, via the interrupt branch address, However, the contents of the Accumulator to the correct ILS. will be destroyed if a preoperative error is detected. The call portion, illustrated Recurrent Subroutine Entries Recurrent entries to a subroutine can result from interrupts. For example, during execution of the Console Printer subroutine, a disk interrupt can start execution of a subroutine to handle the condition that caused the disk interrupt.
Interrupt Service Subroutines 9 in Figure 1, has four basic functions: Initiate I/O Operation. The call portion only initiates an I/O operation. 1. Determines if any previous operations Subsequent character interrupts cr on the specified device are still in operation complete interrupts are handled progress. by the interrupt response routine. 2. Checks the calling sequence for Interrupt Response Processing legality. The I/O interrupt response portion of an 3. Saves the calling sequence. ISS is illustrated in Figure 2. 4. Initiates the requested I/O operation. Operation. An I/0 interrupt causes a user The flow diagram (Figure 1) is not exact program to exit to an interrupt level for any one ISS. It is only a general subroutine, which in turn exits to the I/O picture of the internal operation of the interrupt response portion of an ISS. The call portion of an ISS. interrupt response portion checks for errors, does any necessary data Determine Status of Previous Operation. manipulation, initiates character This function can be performed by using a operations, and initiates retry operations programmed subroutine-busy indicator to in case of errors. It then returns control determine if a previous operation is to the interrupt level subroutine, which complete. The CARD1 subroutine is a good returns control to the user. example. When an operation is started on the 1442, a subsequent LIBF CARD1 for the Character Interrupts. These interrupts 1442 is not honored until the occur for devices under direct program subroutine-busy indicator is turned off. A control whenever data can be read or call to any other ISS subroutine, such as written, e.g., a card column punched or a TYPEO, is not affected by the fact that the paper tape character read. CARD1 subroutine is busy. Operation Complete Interrupts. These Each ISS, except PAPTN and DISKN, can interrupts occur in disk and card use one programmed subroutine-busy operations when a specified block of data indicator to determine if a previous has been read or written, e.g., a disk operation is complete. The PAPTN record read. subroutine uses two busy indicators, one for the paper tape reader and one for the Error Detection and Recovery Procedures. punch. If an operation is started on the These procedures are an important part of reader, a subsequent LIBF PAPTN for the an ISS. However, little can be done about reader is not honored until the Reader Busy reinitiating an operation until a character indicator is turned off. However, a LIBF interrupt or operation complete interrupt PAPTN for the paper tape punch is treated occurs. Therefore, error indicators are in the same manner as a call to any other not examined until one of these interrupts ISS and is not affected by the fact that occurs. the paper tape reader is busy. The subroutine DISKN uses five busy indicators, Recoverable Device. This is an I/O device one for each disk drive. (Each disk drive that can be easily repositioned by a corresponds to a certain bit in $DBSY.) subroutine or by an operator and an I/O This provides the possibility to operate operation reinitiated. If a device is not all of the disk drives simultaneously. recoverable, or if an error cannot be corrected after a specified number of Check Legality of Calling Sequence. retries, the user is informed of the error Calling sequences are checked for such condition. If a device is recoverable, the items as illegal function character, user may request, via his error subroutine, illegal device identification code, zero or that the operation be reinitiated. negative word, count, etc. Save Calling Sequence. The call portion saves, within itself, all of the calling sequence information needed to perform an I/O operation. The user can modify a calling sequence, even though an I/O operation is not yet complete. Note: The I/O data area should be left intact during an operation because the ISS is continually accessing and modifying that area.
10 Entry
Return to User) at LIBF + 2
Return to User ) at LIBF +3
Exit to User Error Routine (
Manipulate Data as Specified Set Exit to Busy $ PRET+ 1 Indicators (
Return to User Save Calling at LIBF Yes Sequence Parameters
Determine Initiate Next Clear e-Initiate/ Requested Busy VO Function Operation Indicators \Operation
Initiate I/O Operation Clear 4 \ Busy Indicators et I teturn to interrupt) Level Routine ( Rto Urn ) (
• Figure 1. Call Portion of an ISS Figure 2. Interrupt Response Portion of an ISS
Interrupt Service Subroutines 11 GENERAL ERROR-HANDLING PROCEDURES 7-PLOT1 7- PLOT1 or PLOTX 8-SCAT1, SCAT2 8- SCAT1, SCAT2, Each ISS has its own error detecting or SCAT3 or SCAT3 portion, which determines the type of error and chooses an error procedure. (In this 9- PRNT3 or PRNZ context, the term error includes such conditions as last card, channel 9, channel A- OMPR1 12, etc.) Errors fall into one of two categories: those that are detected before Digits 2 and 3 are reserved. an I/O operation is initiated, and those that are detected after an I/O operation Digit 4 identifies the error: has been initiated. Appendix B contains a list of the errors detected by the ISSs; 0- device not ready. Appendix C contains descriptions of the actions taken by each ISS after the return 1- illegal LIBF parameter or illegal from user-written error subroutines. specification in the I/O area. There is a WAIT instruction in core location $PRET+1 and a branch instruction (BSC I $PRET) in the next location. Therefore, the LIBF may be executed again Preoperative Error Detection (after the error condition has been corrected) by pressing PROGRAM START on the console. The user can, if he chooses, Before an ISS initiates an I/O operation, replace these two instructions with an exit it checks the device status and the to his own error subroutine. legality of calling parameters. If a device is not ready or a parameter is in error, the Interrupt Service Subroutine will wait at $PRET+1 displaying an error indicator that defines the error (see Postoperative Error Detection Appendix E). This error indicator consists of four hexadecimal digits that are defined below. After an I/O operation has been started, certain conditions may be detected about $PRET is entered via a Branch and Store which the user should be informed. The Instruction Counter (BSI) instruction in conditions might be card jams for which the following subroutines: DISKZ, DISK1, manual intervention is needed before the DISKN, OMPR1, PLOTX, and the ISSs used by operation can continue; read checks that FORTRAN. All other ISSs store the address have not been corrected after a specified of the LIBF statement in $PRET and then number of retries; or indications of branch to $PRET+1 to wait and display the equipment readiness, such as last card or error; i.e., when PROGRAM START is pressed, channel 12 indicators. All these the call to the subroutine is retried. conditions are detected by the interrupt response portion (see "ISS Operation"). Digit 1 ident ifies the ISS subroutine called: No Error Parameter. If no error parameter is included in the calling sequence that C/PT System DM2 System initiated the I/O operation and a postoperative error condition is detected, 1-CARDO or CARD1 1- CARDO, CARD1, or the card/paper tape system subroutine CARDZ; PNCHO, PNCH1, initiates a Wait procedure (programmed or PNCHZ • loop), which continues until the operator corrects the detected condition. 2-TYPEO or WRTYO 2- TYPEO or TYPEZ, WRTYO, or WRTYZ The DM2 system does not use a programmed loop, but rather branches to a 3-PAPT1 or PAPTN 3- PAPT1, PAPTX, postoperative error trap that is similar to or PAPTZ the preoperative error trap. Each interrupt level (1-4) has its own 4- READO, READ1, or postoperative error trap with accompanying READZ WAIT address. 5-DISKO, DISK1, 5- DISKZ, DISK1, Level 1 - $PST1 (0081) or DISKN or DISKN Level 2 - $PST2 (0085) Level 3 - $PST3 (0089) 6- PRNT 1 6- PRNT1 or PRNTZ Level 4 - $PST4 (008D)
12 Processing resumes -- at the address priority interrupt level than the immediately following -- after the operator device that caused the error. corrects the detected condition and presses PROGRAM START. Note: A call to WRTYO to type an error Error Parameter Included. If an error message can be made only if the user does parameter is included in the calling not wait for the completion of typing or sequence, a Branch and Store Instruction for operator intervention before returning Counter (BSI) instruction to the user s to the ISS. A test loop on level 4 error subroutine specified in the calling (typewriter) or a WAIT loop will both block sequence is executed. Identifying the clearing of the level that caused the information is placed in the Accumulator interrupt to the user s error subroutine. and Extension (see Appendix B). When the user s error subroutine returns control to the ISS using the return link (see "Basic 5. The user should have a separate error ISS Calling Sequence"), the subroutine subroutine for each device to prevent examines the Accumulator. If the user has errors on several devices (on cleared the Accumulator before returning to different levels) from causing the subroutine, he is requesting that the recurrent-entry problems in thr error condition be ignored and the error subroutine. operation term...aated. If the user has not cleared the Accumulator, he is requesting that the operation be restarted, in which Note: The error codes in the Accumulator case the subroutine reinitiates the may not distinguish between ISSs, as the operation before returning to the user s preoperative error codes do. main program. Implications of the User s Error Since the ILS saves Index Register 1 as Subroutine. It is important to note that a part of its interrupt processing, the user s error subroutine (entered via the user s error subroutine can also use this LIBF error parameter address) is executed index register without saving and restoring as part of the interrupt processing. the it. However, the user cannot depend on the interrupt level is still on, preventing contents of Index Register 1 unless he recognition of other interrupts of the same initializes it as part of his error or lower priority. This has the following subroutine. The DM2 ILSs also save Index implications: Register 2. The special ILSX subroutines in the DM2 save and restore Index Register 1. Return must be made to the ISS 3. subroutine via the return link (set up by the BSI instruction executed by the ISS subroutine). Otherwise, normal Programming Techniques - User s Error processing cannot be continued because Subroutine Exits. Some programming the ISS must return to the ILS to techniques that can be used in conjunction restore the contents of the with the ISS error exit are as follows: Accumulator and Extension, Status Indicators, and Index Registers. 1. To try the operation again: 2. Return must be made with a BSC instruction, not a BOSC instruction. Label Operation Operands llentorks Otherwise, the interrupt level is turned off, setting up the possibility USER, AC, 01 i t t i I .1 that another interrupt could occur on 1111 BS C, r U115 tEIR1 1 1 1 1 1 1 I the same level, thus destroying the it II III!,,. t return address to the user from the ILS. 2. To terminate the operation: 3. A LIBF or CALL to another subroutine from the user s error subroutine can Operanda 6 p,r, cause a recurrent-entry problem. If 0 5 IRA. 5.6 ,r., .C41141,13 that subroutine is already in use when PTA r. (1 S the interrupt occurs, the user s new LIBF or CALL destroys the original return address and disrupts operation of the called subroutine. 3. To indicate that a condition ("last 4. A LIBF or CALL to another ISS can card" or "channel 9") was detected and cause an endless loop if the new I/O that the normal program flow should be device operates on the same or lower altered:
Interrupt Service Subroutines 13 Operand, Remarks Name Parameter
Al .n NoF,141 ,Z R •P,R,O,G,MA,A4 n ki , , , , , „ ,,,,, , „ , ,,, Each subroutine has a symbolic name that
3 must be written in the LIBF statement .r, , T , N,E, ,,, exactly as listed in Figures 3 and 4.
r- Device Subroutine 4 -4 1442 Card Read Punch CARDO, CARD1, or CARDZ Disk DISKO, DISK1 DISKN
1132 Printer PRNT1 or PRNTZ
Keyboard/Console Printer TYPEO or TYPEZ BASIC ISS CALLING SEQUENCE Console Printer WRTYO or WRTYZ
Each ISS described in this manual is 1134/1055 Paper Tape PAPT1, PAPTN entered via a calling sequence. These or PAPTZ calling sequences follow a basic pattern. In order not to burden the reader with 1627 Plotter PLOT1 or PLOTX redundant descriptions, this section presents the basic calling sequences and Synchr. Comm. Adapter SCAT1, SCAT2, describes those parameters that are common or SCAT3 to most of the subroutines. Figure 3. C/PT System ISS Names
Basic Calling Sequence For some devices more than one subroutine is available, although only one LIBF Name DC Control parameter can be selected for use in any one program (including called subroutines). DC I/O area DC Error subroutine NAMEO. The NAMEO subroutine is the The above calling sequence, with the shortest and least complicated. The NAME° parameters shown, is basic to most of the version is the standard subroutine for the ISSs. Detailed descriptions of the above 1442, 2501, and Console Printer/Keyboard. four parameters are omitted when the The NAMED version of the Disk routine subroutines are described later in the (DISKO) can be used if transfer of data is manual. Unless otherwise specified, the 320 words or less (C/PT system only). subroutine returns control to the instruction immediately following the last parameter.
14 T 1 PRNT3. The PRNT3 version is used with the Device Subroutine f 1403. -F- 1442 Card Read Punch CARDZ, CARDO, or CARD1 Control Parameter 2501 Card Reader READZ, READO, or READ1 The control parameter, in the form of four 1442 Card Punch PNCHZ, PNCHO hexadecimal digits, conveys necessary or PNCH1 control data to the ISSs by specifying the desired function (read, write, etc.), the Disk DISKZ, DISK1, device identification, and similar control or DISKN information. Most subroutines do not use all four digits. 1132 Printer PRNTZ, PRNT1, or PRNT2 A typical control parameter is illustrated below. 1403 Printer PRNZ, or PRNT3 Hexadecimal Digits Keyboard/Console Printer TYPEZ, or TYPED 1st 2nd 3rd 4th Console Printer WRTYZ, or WRTYO I/O Function 1 - 1134/1055 Paper Tape PAPTZ, PAPT1, Reader Punch PAPTN, or PAPTX Not Used
1627 Plotter PLOT1, or PLOTX Device Identification
1231 Optical Mark DMPR 1 Since the I/O function and device Page Reader identification digits are used in most subroutines, a description of the purpose Synchr. Comm. Adapter SCAT1, SCAT2, of each is given here. or SCAT3 I/O Function 2250 Display Unit, DSPYN Model 4 The function digit in the calling sequence specifies which I/O operation the user is Figure 4. DM2 System ISS Names requesting. Three of these functions-- read, write, and test-- are used in most subroutines. NAME1. The NAME1 version is the standard subroutine for the disk, 1132, 1403, 2501, Read. The read function causes a specified 1134/1055, 1231, and 1627. It may be used amount of data to be read from an input if a user error exit is needed rather than device and placed in a specified input the internal looping and retries by the area. Depending upon the device, an NAMED subroutine. interrupt signals the subroutine either when the next character is ready or when NAMEN. The NAMEN version is available to all requested data has been read. When the operate the 1134/1055 Paper Tape Reader and. specified number of characters has been Punch simultaneously and to minimize extra read, the subroutine becomes available for disk revolutions when transferring more another call to that device. than 320 words to or from the disk. The NAMEN subroutine offers more options than Write. The write function causes a the NAME1 subroutine. In DM2, it also specified amount of data from the user s operates as many as 5 disks simultaneously. output area to be written, i.e., printed or I punched, by an output device. As with the read function, an interrupt signals the NAMEZ. The NAMEZ version is designed for subroutine when the device can accept use in an error-free environment. It another character, or when all characters provides no preoperative parameter have been written. When the specified checking. The FORTRAN formatting number of characters has been written, the subroutines use these ISSs but they do not subroutine becomes available for another use the calling sequence listed below (see call to that device. "Subroutines Used by FORTRAN"). Test. The test function causes a check to PRNT2. The PRNT2 version is used when the be made as to the status of a previous 1132 is used with the SCA. operation initiated on an I/O device. If
Interrupt Service Subroutines 15
the previous operation has been completed, Error Parameter the subroutine branches to the LIBF+3 core location; if the previous operation has not been completed, the subroutine branches to The error parameter is the means by which the LIBF+2 core location. The test an ISS can give temporary control to the function is illustrated below: user in the event of conditions such as error, last card, etc. This parameter is not required for the NAMED subroutines for LIBF Name the 2501, 1442, Console Printer, or Keyboard. The instruction sequence for setting up the error subroutine is shown L/BF+1 DC Control Parameter below. (specifying Test function) LIBF NAME LIBF+2 OP Code. xxxx.... DC ERROR (error parameter)
LIBF+3 OP Code xxxx-... ERROR DC 0 (return link) . (error routine) Note: Specifying the test function BSC I ERROR (branch to return link) requires two statements (one LIBF and one DC), except in disk subroutines, where The return link is the address in the three statements are required. related ISS to which control must be returned upon completion of the error The test function is useful in subroutine. The link is inserted in situations in which input data has been location ERROR by a BSI from the ISS when requested, but no processing can be done the subroutine branches to the error until the data is available. subroutine. Device Identification The types of errors that cause a branch to the error address are listed in Appendix This digit should be zero except for the B. Test function with the PAPTN (paper tape) subroutine. Note: The user s error subroutine is executed as part of the interrupt response handling. The interrupt level is still on Note: For all disk subroutines, this digit and remains on until control is returned to appears in the I/O area rather than in the the ISS (see "General Error-Handling control parameter. Procedures").
Assignment of Core Storage Locations I/O Area Parameter (C/PT System) The I/O area for a particular operation The portion of core storage used by the ISS consists of one table of control and ILS subroutines is defined below. Care information and data. This table is should be used in altering any of these composed of a data area preceded by a locations (see Figure 5). control word (too control words for disk operations) that specifies how much data is The areas illustrated in Figure 5 are to be transferred. The area parameter in described below. the calling sequence is the address (symbolic or actual) of the first control word that precedes the data area. Interrupt Branch Addresses The control word contains a word count referring to the number of data words in the table. It is important to remember ILS Subroutines. When required, the that the number of words in the table is address of ILSOO is always stored in not always the number of characters to be location 8, ILSO1 in location 9,..., mos read or written, because some codes pack in location 13 (e000D). two characters per word. The disk subroutines require a second control word, Interrupt Trap. The address of the which is described along with those interrupt trap is stored in any location subroutines. for which no ILS is loaded.
16 1132 Printer Hex Decimal
8 8 (ILS00) This area is used by 1132 Printer. 9 9 (ILS01) A 10 (ILS02) Interrupt Branch Addresses B 11 (ILS03) C 12 (ILSO4) Preoperative Error Trap D 13 (ILS05) 14 This exit is used whenever a preoperative 1F 31 error (illegal LIBF or device not ready) is 20 detected by an ISS. To retry the call, Reserved for 1132 Printer press START. 27 39
28 40 ISS Exit 29 41
The ISS exit results from pressing the 2C 44 Keyboard Interrupt Request key. The TYPEO, and WRTYO subroutines execute a BSI I /002C 2D 45 whenever a keyboard operator request is 2E 46 4 detected. Note that interrupt level is 2F 47 still on. The user-written subroutine must return to the TYPEO or WRTYO subroutine in order 32 50 to allow interrupts of equal or lower priority to occur. Also a call executed to any subroutine might cause a recurrent- entry problem unless the user can guarantee that the subroutine was not in use when the keyboard interrupt occurred. 1Figure 5. ISS and ILS Core Locations for the C/PT System Location /002C is initialized with the address of the interrupt trap in case the user fails to store an address in the interrupt trap to process Keyboard operator requests. Assignment of Core Storage Locations (DM2 System)
Interrupt Trap The portion of core storage used by the ISS and ILS subroutines is defined below. Care should be used in altering any of these This trap is entered when an interrupt locations (see Figure 6) . occurs for which there is no ILS and/or no ISS assigned to the pertinent bit in the The areas illustrated in Figure 6 are Interrupt Level Status Word (IISW). described below. Interrupts of higher priority will be processed before the system finally halts with the IAR displaying /002F. Interrupt Branch Addresses
ISS Counter ILS Subroutines. The address of ILSOO is always stored in location 8, ILSO1 in location 9,..., ILSO5 in location decimal The ISS counter is incremented by +1 every 13. time an ISS initiates an interrupt-causing I/O operation and is decremented by +1 when the operation is complete. A positive Interrupt Trap. The address of the Program value in this location indicates the number Stop Key trap ($STOP-location /0091) is of interrupt(s) pending. This counter stored in any location for which no ILS is should never be negative. loaded.
Interrupt Service Subrcutines 17 Reserved Areas Hex Decimal 8 8 (11500) These locations are reserved for the DM2 9 9 (ILS01) A 10 (11502) system. BI1 (1LS03) Interrupt Branch Addresses C 12 (ILSO4) 13 (ILS05) 1132 Printer E 14 This area is used by 1132 Printer. is/ Reserved for Monitor System IF 31 PreoPerative_Error.TKaP 20 32 1}Res ....." .x Reserved for 1132 Printer This exit is used whenever a preoperative error (illegal LIBF or device not ready) is 27 39 detected by an ISS. To retry the call, 28 40 SPRET DC • • press START. 29 41 WAIT Preoperative Error Trap 2A 42 BSC I PRET
- ISS Counter 2C 44 $IREQ DC ) Interrupt Request Branch Address 2D 45 The ISS counter is incremented by +1 every Reserved for Monitor System time an ISS initiates an interrupt-causing 31 49 I/0 operation and is decremented by +1 when 32 50 } 155 Counter the operation is complete. 33 51 Reserved for Monitor System A positive value in this location 3E 62 I indicates the number of interrupts(s) 40 64 pending. This counter should never be I negative. /Reserved for Monitor System 80 128 81 129 EPST1 DC • - 82 130 WAIT Postoperative Error Trap For Level 1 Interrupt Request Branch Address 83 131 BSC I PST! 1 85 133 EPST2 DC • - • The subroutine ILSO4 or ILSX4 executes a 86 134 WAIT }Postoperative Error Trap for Level 2 BSI I $1REQ whenever a Keyboard operator 87 135 BSC I EPST2 request is detected. 89 137 EPST3 bC • - • 8A 138 WAIT /Postoperative Error Trap for Level 3 $1REQ (location /002C) is initialized 8B 139 BSC I EPST3 with the address $1420 in Resident Vcnitor. 80 141 EPST4 DC - BE 142 WAIT }Postoperative Error Trap Far Level 4 This allows the user to terminate the job BSC I EPST4 by pressing the Interrupt Request key (INT 8F 143 REQ). 91 145 ESTOP DC • - • 92 146 WAIT Program Stop Key Trap 93 147 BOSC I ESTOP Note the following when writing an interrupt request subroutine: • Interrupt level 4 is still on. -0/ • An X10 instruction sensing Reyboard with reset must be performed. Figure 6. ISS and ILS Core Locations for • Return to ILSO4 or ILSX4 to exit the DM2 System address +6. • ILSO4 or ILSX4 will turn off the Postoperative Error Traps interrupt. These traps are entered when a device- • Subroutines that are in use when the not-ready condition is detected prior to interrupt occurs may not be called. the initiation of an I/O operation in the interrupt response portion of an ISS For examples of INT REQ see IBM 1130 subroutine. Each interrupt level (1-4) has Disk Monitor System, Version 2, Programmer s its own postoperative error trap. The and Operator s Guide. system will WAIT with the IAR displaying
18 the address of $PST1+2, $PST2+2, $PST3+2, where or $PST4+2, depending on the interrupt level of the device. a is 0 or 1, b is the I/0 function digit, f is the number of columns to be read Description of Interrupt Service Subroutines from or punched into the card, h is the length of the I/O area. h must be equal to or greater than f. Note that the subroutine READO, READ1, PNCHO, PNCH1, PRNT3, and OMPR1 are The calling sequence parameters are available only with the DM2 system. described in the following paragraphs.
Control Parameter 1442 CARD READ PUNCH SUBROUTINES (CARDO AND CARD 1) This parameter consists of four hexadecimal digits as shown below: The card subroutines perform all I/O functions relative to the IBM 1442 Card 1 Read Punch: read, punch, feed, and stacker select. I/O Function Not Used 31 41 CARDO Subroutine. The CARDO subroutine is shorter and less complicated than CARD1 and is the standard subroutine for the 1442. I/0 Function CARDO can be used if the error parameter The I/O function digit specifies the is not needed. When an error occurs, the particular operation to be performed on the subroutine loops (DM1 and C/PT system) or 1442 Card Read Punch. The functions, will WAIT at $PST4+1 (DM2 system) until the associated digital values, and required operator takes corrective action. Last parameters are listed and described below. card conditions cause preoperative not-ready exits. r Digital Required CARD1 Subroutine. The CARD1 subroutine can Function Value Parameters oe used for the Card Read Punch if a user error exit is needed, rather than the error Test 0 Control procedures of the CARDO subroutine. Read 1 Control, I/O Area, Error2 Punch 2 Control, I/O Area, Error2 Calling Sequence Feed 3 Control, Error2
Label Stacker Opera, ion Op rands IL Remarks Select 4 Control
1 I 1 L • I, BIF al• MEL 4. •C■A•L • I ,CaA,Rith1 ,10. .... Pc. Lazat.olos, ..... r . la Li • AAR •MF • T GIP • • - Any parameter not required for a n ,r, , ro. A . 1 • • re it 01 A•Ro.F5A • • RA 1 R•AeL4F■T■F particular function must be omitted. fad?", IR ...... EiRtli eaR1 P IRA IMF • Tt 2 Error parameter not required for CARDO. • I e L —J I I I lllllllllllllllllllll
FIRA0a DIC1 it — e lllllll Rt FIT 11111ZAA 1.111,1/71 FICISI 1111 1 I 1 I I 1 llllllllllllllllllll Test. Branches to LIEF+2 if the previous I I I operation has not been completed, to LIEE+3 I llllllllllllllllllllllllll if the previous operation has been I 1 ir • r Falk OIRI 11111 API r RIM/ ,Tn. ,nA L.nF,R, I completed.
t II r te el. I el. I t ,a, I e lllllllllllllllllllllll Read. Reads one card and transfers a r • • llll ll aNt af2,01 ,c.o.u,ni,r1 1 a ■ specified number of columns of data to the ha a , ■roi101 A l FiA llll , user s input area. The number of columns read (1-80) is specified by the user in the first location of the I/O area. The
Interrupt Service Subroutines 19 subroutine clears the remainder of the I/0 Stacker Select. Selects stacker 2 for the area and stores a 1 in bit position 15 of card currently at the punch station. After each word, initiates the card operation, the card passes the punch station, it is and returns control to the user s program. directed to stacker 2. When each column is ready to be read, a column interrupt occurs. This permits the card subroutine to read the data from that column into the user s input area (clearing bit 15) , after which the user s program is I/O Area Parameter again resumed. This sequence of events is repeated until the requested number of columns has been read, after which the The I/0 area parameter is the label of the remaining column interrupts are cleared (no control word that precedes the user s I/0 data read). area. The control word consists of a word count that specifies the number cf columns When an operation complete interrupt of data to be read or punched, always occurs, the card subroutine checks for starting the count at column 1. The word errors, informs the user if an. error count must be in the range of 1-80. occurred (CARD1 only), and sets up to terminate (CARE1 only) or retry the operation. Error Parameter The data in the user s input area is in a code identical to IBM Card Code format; that is, each 12-bit column image is CARDO. CARDO has no error Parameter. If left-justified in one 16-bit word. an error is detected while an operation complete interrupt is being processed, the Punch. Punches into card the number of subroutine loops (C/PT system) or will WAIT columns of data specified by the word count at $PST4+1 (DM2) with interrupt level 4 found at the beginning of the user s output on, waiting for operator intervention. area. The punch operation is similar to When the condition has been corrected, the read operation. As each column comes the 1442 made ready, and PROGRAM START under the punch dies, a column interrupt pressed, the subroutine retries the occurs; the card subroutine transfers a operation. word from the user s output area to the punch and then returns control to the CARD1. CARPI has an error narameter. If user s program. an error is detected, the user can request the subroutine to terminate (clear This sequence is repeated until the subroutine-busy indicator and the interrupt requested number of columns has been I level) or to loop (C/PT system) or WAIT punched, after which an Operation Complete at $PST4+1 (DM2) for operator intervention interrupt occurs. At this time the card (interrupt level 4 on). See "Basic subroutine checks for errors, informs the Calling Sequence".) user if an error occurred (CARD1 only) , and sets up to terminate (CARD1 only) or retry the operation. The character punched is the image of the leftmost 12 bits in the Protection of Input Data word. Feed. Initiates a card feed cycle. This Since the CARD subroutines read data advances all cards in the machine to the directly into the user s I/0 area, the user next station, i.e., a card at the punch can manipulate the data before the entire station advances to the stacker, a card at card has been processed. This procedure is the read station advances to the punch inherently dangerous because, if an error station, and a card in the hopper advances occurs, the data may be in error and to the read station. No data is read or error-recovery procedures will cause the punched as a result of a feed operation and operation to be tried again. The exit via no column interrupts occur. This the error parameter is the only method of effectively skips a card when used in informing the user that an error has conjuction with a Read or Punch function. occurred. Therefore, do not manipulate data before the entire card has been When the card advance is complete, an processed when using CARDO. Operation Complete interrupt occurs. At this time the card subroutine checks for when using CARD1, the following errors, informs the user if an error precautions should be taken: occurred (CARD1 only), and sets up to terminate (CARD1 only) or retry the • Do not store converted data back into operation. the read-in area.
20 • Do not take any irretrievable action Calling Sequence based on the data until the card has been read correctly; i.e., be prepared to convert the data or perform the calculations a second time. Operands Remar 1 I CIA.L.I r,A.R,D rtir . • , TaAAA • When data manipulation is complete, 4AAA 4,411RAMF■r.P.R check the user-assigned error j jjj JJjjjJjJJJJJJ 1111111..1 indicator that is set when a branch to .. .. 1■11 ■111111 1111■111111■ the user-written error subroutine RIET.U.R.Alt ,AtaDoRIELS,St occurs. The data conversion or calculations can then be reinitiated, if necessary. EtR.R R .... RIF.T.IIR Ah n •r,.4 I .1 .E.R1 •
..... , , „ 11111itil 01 11...111 ...... f . ... 4,h(7 R .... ...... ,r., ...... Last Card
When the last card has been detected, a branch to the user error routine with /0000 where in the Accumulator will occur. An operation requested after the last card has been fed from the hopper causes an exit to a is 0 or 1, $PRET. When the 1442 is made ready and the PROGRAM START key is pressed, the last card will be processed. b is the I/O function digit,
f is the number of columns to be read from the card,
2501 CARD READER SUBROUTINES (READO AND h is the length of the I/O area. h must READ1) be equal to or greater than f.
These card subroutines, available only with The calling sequence parameters are the DM2 system, perform read and test described in the following paragraphs. functions relative to the IBM 2501 card reader.
READO Subroutine. READO is shorter than Control Parameter READ1, provides no error parameter, and is the standard subroutine for operation of the 2501 card reader. On an error, READO This parameter consists of four hexadecimal branches to $PSTY, then a WAIT for digits as shown below: operation intervention will occur. The last card condition causes a branch to 1 2 3 4 $PRET. I/O Function. READ1 Subroutine. READ1 is used for Not Used operation of the 2501 card reader if a user error exit is required. I/O Function
The I/O function digit specifies the particular operation to be performed on the 2501 Card Reader. The functions, associated digital values, and required parameters are listed and described below.
Interrupt Service Subroutines 21 r 1 interrupt level 4 on, waiting for operator I Digital Required I intervention. When the condition has been !Function Value Parameters I corrected, the 2501 made ready, and PROGRAM I I START pressed, the subroutine attempts the Test 0 Control I operation again. !Read 1 Control, I/0 Area, Error21 1 i l Any parameter not required for a I READ1. READ1 has an error parameter. If 1 particular function must be omitted. 1 an error is detected, the user can request 1 2 The error parameter is not required for 1 the subroutine to terminate (that is, to 1 READO. I clear the subroutine s busy indicator and L J turn off the interrupt level) or retry. Prior to a retry, the subroutine checks to see if the unit is ready. If the unit is Test. Branches to LIBF+2 if the previous not ready, the subroutine branches to $PST4 operation has not been completed, to LIBF+3 with interrupt level 4 on, waiting for if the previous operation has been operator intervention. completed.
Read. Reads one card and transfers a specified number of columns of data to the user s input area. The number of columns Last Card read (1-80) is specified by the user in the first location of the input area. The subroutine initiates the read function and A read function requested after the last returns control to the user s program. card has been fed from the hopper causes an exit to $PRET. When the reader is made When an Operation Complete interrupt ready and the PROGRAM START key pressed, occurs, the card subroutine checks for the last card is read and fed into the errors. If an error occurred, REAM exits stacker. to $PST4; READ1 informs the user of the error and sets up to terminate or retry the operation. The data in the user s input area is in IBM Card Code format; that is, each 12-bit column image is left-justified in one 1442 CARD PUNCH SUBROUTINES (PNCHO AND 16-bit word. PNCH1)
There is no separate feed function. However, a feed can be obtained by a read These card subroutines, available only with function with a word count of zero. the DM2 system, perform all I/O functions relative to the IBM 1442-5 Card Punch, that is, punch and feed. These subroutines may also be used with the 1442-6 or 1442-7 Card Read Punch for punch and feed functions. I/O Area Parameter
PNCHO. The PNCHO subroutine is shorter The I/O area parameter is the label on the than PNCH1, provides no error parameter, control word that precedes the user s input and is the standard subroutine for area. The control word consists of a word operation of the 1442 card punch. On an count that specifies the number of columns error, PNCHO branches to $PST4, then a WAIT of data to be read, always starting with for operator intervention will occur. The column 1. The word count must be in the last card condition causes a branch to range of 0-80. $PRET.
PNCH1. PNCH1 can be used for operation of the 1442 card punch if a user error exit is Error Parameter desired.
READO. READO has no error parameter. If an error is detected while an Operation Complete interrupt is being processed, the subroutine branches to $PST4, with
22
Calling Sequence r- Digital Required Function Value Parameters Test 0 Control flernorLs Punch 2 Control I/0 Area, Error2 .CALAT,P.f4T. Feed 3 Control, Error2 1112,11,121,0 ...... r , . DC TIO.A , , ora,O, A .R.F.A. r Fe/7.R , R , , IARIRPA, "Any parameter not required for a
1 4. particular function must be omitted. 2The error parameter is not required for
FR,R.O.R pc, , PNCHO. L_ -J
,r.A,1 , Test. Branches to LIBF+2 if the previous , fiR.RAR ,,,, operation has not been completed, to LIBF+3 if the previous operation has been completed. F,,,,,, „ rod, N. .
U.1,11,t1,311a1)11ittll11(11,1 Punch. Punches into one card the number of columns of data specified by the word count found at the beginning of the user s output where area. As each column comes under the punch dies, a column interrupt occurs, the subroutine transfers a word from the user s a is 0 or 1, output area to the punch, and then returns control to the user s program. The character punched is the image of the b is the I/O function digit, leftmost 12 bits in the word.
This sequence is repeated until the f is the number of columns to be punched requested number of columns has been into the card, punched, after which an Operation Complete interrupt occurs. At this time the card subroutine checks for errors. If an error h is the length of the I/O area. h must occurred, PNCHO exits to $PST4; PNCH1 be equal to or greater than f. informs the user of the error and sets up to terminate or retry the operation. The calling sequence parameters are Feed. Initiates a card feed cycle. This described in the following paragraphs. function advances all cards in the machine to the next station; that is, a card at the punch station advances to the stacker, a card at the read station advances to the punch station, and a card in the hopper advances to the read station. No data is Control Parameter punched as a result of a feed function and no column interrupts occur.
This parameter consists of four hexadecimal When the card advance is complete, an digits as shown below: Operation Complete interrupt occurs. At this time the card subroutine checks for errors. If an error occurred, PNCHO exits 1 2 4 to $PST4; PNCH1 informs the user of the error and sets up to terminate or retry the operation. I/O Function Not used I/O Area Parameter
I/O Function The I/O area parameter is the label of the control word that precedes the user s The I/O function digit specifies the output area. The control word consists of particular operation to be performed on the a word count that specifies the number of 1442 Card Punch. The functions, associated columns of data to be punched, always digital values, and required parameters are starting with column 1. The word count listed and described below. must be in the range of 1-80.
Interrupt Service Subroutines 23 Error Parameter Sector Numbering and File Protection
PNCHO. PNCHO has no error parameter. If In the interest of providing disk features an error is detected while an Operation permitting versatile and orderly control of Complete interrupt is being processed, the disk operations, programming conventions subroutine branches to $PST4 with interrupt have been adopted concerning sector level 4 on, waiting for operator numbering, file protection, and defective intervention. When the condition has been cylinder handling. Successful use of the corrected, the 1442 made ready, and PROGRAM disk subroutines can be expected only if START pressed, the subroutine retries the user programs are built within the operation. framework of these conventions. PNCH1. PNCHI has an error parameter. If The primary concern behind these an error is detected, the user can request conventions is the safety of data recorded the subroutine to terminate (that is, to on the disk. To this end, the clear the subroutine-busy indicator and file-protection scheme plays a major role, turn off the interrupt level) or retry. but does so in a manner that is dependent Prior to a retry, the subroutine checks to upon the sector-numbering technique. The see if the unit is ready. If the unit is latter contributes to data safety by not ready, the subroutine branches to allowing the disk subroutine to verify the $PST4, with interrupt level 4 on, waiting correct positioning of the access arm for operator intervention. before it actually performs a write operation. This verification requires that sector identification be prerecorded on each sector and that subsequent writing to IDISK SUBROUTINES (C/PT SYSTEM) the disk be done in a manner that preserves the existing identification. The disk subroutines have been organized to comply The disk subroutines perform all reading with these requirements. and writing of data relative to disk storage. This includes the major functions: seek, read, and write, in Sector Numbering. The details of the conjunction with readback check, file numbering scheme are as follows: each disk protection, and defective cylinder sector is assigned an address from the handling. sequence 0,1,...,1623, corresponding to the sector position in the ascending sequence DISKO. The DISKO subroutine is the of cylinder and sector numbers from shortest version of the disk subroutine and cylinder 0 sector 0 (outermost), through can be used if not more than 320 words are cylinder 202 sector 7 (innermost). The to be read or written at one time. user can address cylinders 0 through 199. The remaining three cylinders are reserved DISK1. The DISK1 version is the standard for defective cylinder handling. subroutine for the disk and allows more than 320 words to be read or written; Each cylinder contains eight sectors and however, a full disk revolution might occur each sector contains 321 words. The sector between sectors. DISK1 requires more core address is recorded in the first word of storage than DISKO. each sector and occupies the rightmost eleven bit positions. Of these eleven DISKN. The DISKN subroutine minimizes positions, the three low-order positions extra disk revolutions in transferring more identify the sector (0-7) within the than 320 words. The DISKN subroutine cylinder. Utilization of this first word requires more core storage than DISK1. for identification purposes reduces the per sector availability of data words to 320; The major difference between DISK1 and therefore, transmission of full sectors of DISKN is the ability of DISKN to read or data is performed in increments of 320 write consecutive sectors on the disk words. The sector addresses must be without taking an extra revolution. If a initially recorded on the disk by the user full sector is written, the time in which and are thereafter rewritten by the disk the I/O command must be given varies. subroutines as each sector is written (see DISKN is programmed so that the extra "Disk Initialization" in this section). revolution will not occur the majority of the time; DISK1 approximately 50 percent of the time. All three disk subroutines have the same I error-handling procedures.
24 File Protection. File protection-is Calling Sequence provided to guard against the inadvertent destruction of previously recorded data. By having the write functions (except write immediate) uniformly test for the
file-protect status of sectors that they C3pero6c.r. .7perandl etliemlarl.. are about to write, this control can be 32 1-113C / 3.5 33e3 431.3 3 3 3 ra L./ .Ek I JKI rd ,,,,, achieved. ,r, b el.• 3 ,,,,, AR AA E, TL.-. r. AAR, 3 3 3 3 3 rain .14 RIFIA, IR.A•AtE 1ER This convention is implemented by an • I? .(01R. I • AIR JR■17101 tP3.43/73.43ME3 TIAR3 assigning a file-protected area to each iiiiiiii 111111 lllllll !III disk. The address of the first unprotected sector (0000-1623) on each disk is stored III iiii 1 1 F.(417,0112 31fi 3i113 3 I 3 3 tR63 T1U3R3A13 3A301.1 R if3,53.S. 3 within the disk subroutine. Every sector I I 1 I I below this one is file-protected, i.e., ■ no writing is permitted below this address. 1 1 1 .11 E AR■ 1 3 3 49 at-IT .(11R.Ah ■T"
lllll ll i• iiiiiiiii 1111.111 1 1111■1, 111 III I I I zaAA P.C. iiiiiiii i Avoam Et/116MT iiiii 1. f 9 iiiiiiiii AIACITIMA An,EAR.F.c.s lll /11111 III XI/In, I A LattlA lllllllll •
Defective Cylinder Handling where A defective sector is one in which, after ten retries, a successful writing operation a is 0, 1, or N. cannot be completed. A cylinder having one or more defective sectors is defined as a defective cylinder. The disk subroutines b is the I/O function digit, can operate when as many as three cylinders are defective. c is in DISKN test function, the logical drive number. Otherwise c is 0. Since there are 203 cylinders on each disk, the subroutine can "overflow" the d is the Seek option digit, normally used 200 cylinders when defective cylinders are encountered (see "Effective e is the Displacement option digit, Address Calculation" in this section). f is the number of words to be The address of each defective cylinder transferred to or from the disk, is stored within the disk subroutines by the user (see "Disk Initialization" in g is the sector address at which the this section). transfer is to begin, If a cylinder becomes defective during h is the length of the I/O area. h must an operation, the user can move the data be equal to or greater than f. in that cylinder and each higher-addressed cylinder into the next higher-addressed The calling sequence parameters are cylinder. Then the address of the new described in the following paragraphs. defective cylinder can be stored in DISKx +16, +17, or +18 and normal opera- tion continued. Thus the user should not store the new defective cylinder Control Parameter address in DISKx and then continue normally because the effective sector address computation then yields a sector This parameter consists of four hexadecimal address eight higher than is desired (see digits as shown below: "Effective Address Calculation" in this section). 1 2 3 4 I/O Function f If there are no defective cylinders, all three words in the defective cylinder table Not Used contain /0658. If, for example, only sector 0009 is defective, the table would Seek Option contain /0008 (cylinder 1), /0658, and /0658. Displacement Option
Interrupt Service Subroutines 25 1/3 Function appropriate error code in the Accumulator and exits to location /0028. The I/0 function digit specifies the operation to be performed on disk storage. The functions, their associated digital If the specified sector address is not value, and the required parameters are in a file-protected area, the subroutine listed and described below. positions the access arm and writes the contents of the indicated I/O data area r into consecutive disk sectors. Writing Digital Required begins at the designated sector and Function Value Parameters continues until the specified number of words has been transmitted. A readback Test 0 Control, I/O Area check is performed on the data written. Read 1 Control, I/O Area, Error If any errors are detected, the operation is retried up to ten times. If Write with- the function still cannot be accomplished, out RBC 2 Control, I/0 Area, Error an appropriate error code is placed in the Accumulator, the address of the faulty Write sector is placed in the Extension, and an with RBC 3 Control, I/0 Area, Error exit is made to the error subroutine designated in the error parameter. Write Immediate 4 Control, I/0 Area Upon return from this error subroutine, the same sector operation is reinitiated or Seek 5 Control, I/O Area, Error the function is terminated depending upon whether the contents of the Accumulator is I l Any parameter not required for a nonzero or zero. I particular function must be omitted. L As each sector is written, the subroutine supplies the sector- Test. Branches to LIBF+3 if the previous identification word. The identification operation has not been completed, to LIBF+4 word for the first sector is obtained from if the previous operation has been the I/O area, although it and subsequently completed. generated identification words are not included in the word count. Writing less Note: This function requires the I/O area than 320 words on any sector sets the parameter even though it is not used. remaining words in that sector to zero. Read. Positions the access arm and reads data into the user s I/0 area until the Write Without Readback Check. This specified number of words has been function is the same as the function transmitted. Although sector-identifi- described above except that no readback cation words are read and checked for check is performed. agreement with expected values, they are neither transmitted to the I/O data area nor counted in the number of words Write Immediate. Writes data with no transferred. attempt to position the access arm, check for file-protect status, or check for If, during the reading of a sector, a errors. Writing begins at the sector read check occurs, up to ten retries are number specified by the rightmost three attempted. If the error persists, the bits of the sector address. This function function is temporarily discontinued, an is provided to fulfill the need for more error code is placed in the Accumulator, rapid writing to the disk than is provided the address of the faulty sector is placed in the previously described write in the Extension, and an exit is made to functions. Primary application will be the error subroutine specified by the error found in the "streaming" of data to the parameter. disk for temporary bulk storage. Upon return from the error subroutine, As each sector is written, the that sector operation is reinitiated or the subroutine supplies the sector- function is terminated, depending on identification word. The identification whether the Accumulator is nonzero or zero. word for the first sector is obtained from the I/O area, although it and subsequently Write With Readback Check. This function generated identification words are not first checks whether or not the specified included in the word count. Writing less sector address is in a file-protected area. than 320 words sets the remainder of the If it is, the subroutine places the sector to zero.
26
Seek. Initiates a seek as specified by the Note: The I/O area parameters are not seek option digit. If any errors are available to the user until the requested detected, the operation is retried up to operation is completed. The word count and ten times. sector addresses may be altered during a requested disk operation but are restored at the completion of the operation. Seek Option
If zero, a seek is executed to the cylinder whose sector address is in the disk I/O Error Parameter area control word; if nonzero, a seek is executed to the next cylinder toward the center of the disk, regardless of the Refer to the section "Basic ISS Calling sector address in the disk I/O area control SequenceTM. word. This option is valid only when the seek function is specified. The seek function requires that the user set up the normal I/O area parameter (see "I/0 Area Parameter" in this section) even Important Locations though only the sector address in the I/O area is used. The I/O area control (first) word is ignored. The relative locations within the DISKO, DISK1, and DISKN subroutines are defined as follows: Displacement Option DISKx +0 - entry point from calling transfer vector when LIBF DISKx is executed. If zero, the sector address word contains +2 - loader stores address of the absolute sector identification; if first location (in the nonzero, the file-protect address for the calling transfer vector) specified disk is added to bits 4-15 of the assigned to DISKx. sector address word to generate the +4 - entry point from ILS effective sector identification. The handling Disk Storage file-protect address is the sector interrupts. identification of the first unprotected +7 - area code for Disk Storage. sector. +8 - zero. +9 - zero. +10 - cylinder identification Oits 4-12) of the cylinder I/O Area Parameter currently under the disk read/write heads (loaded as +202). The I/O area parameter is the label of the +11 - unused. first of two control words which precede +12 - reserved. the user s I/O area. +13 - sector address (bits 4-15) of the first The first word contains a count of the non-file-protected sector number of data words that are to be for disk storage (loaded as transmitted during the disk operation. If 0). the DISK1 or DISKN subroutine is used, this +14 - reserved. count need not be limited by sector or +15 - reserved. cylinder size, since these subroutines +16 - sector address of the first cross sector and cylinder boundaries, if defective cylinder for disk necessary, in order to process the storage (loaded as +1624). specified number of words. However, if the +17 - sector address of the second DISKO subroutine is used, the count is defective cylinder for disk limited to 320. storage (loaded as +1624). +18 - sector address of the third The second word contains the sector defective cylinder for disk address where reading or writing is to storage (loaded as +1624). begin. Bits 0-3 are used for device identification and must be zero. Bits 4-15 specify the sector address. Following the two control words is the user s data area.
Interrupt Service Subroutines 27
Effective Address Calculation If the above subroutines are not used, the starting address of the DISKx routine can be loaded into an index register for An effective disk address is calculated as easy use in reaching the specified follows: locations: 1. Start with the user ,requestedsector address (found in the sector address OPtIvIth word of the I/O area). F ...... ,LX.P,A.N,111 ditarty.ALFR
2. If the displacement option (found in nsias I 1 ▪ .111)D TN TV AARRFSZ the control parameter) is nonzero, add z. Ara n rmic.r.a.mr.s. .R.E.SCaL▪ the sector address of the first r btr F .1)r,c K s non-file-protected sector (found in s .X.22 .J) TAX I , DISKx +13). -1--1 .1 -A- 1 4 A. -4- 1---/1
Note: This starting address will cause a IrAmF,_.[2,1.51X-1_, • _I. 11,41, . I .1
preoperative error exit to location /0029 -L. • .1 J._ . I I if over 1599. 3. If the resulting address is equal to or greater than the sector address of the first defective cylinder (found in DISKx +16), add 8. The SPIR is a special-purpose utility subroutine. It is not called by LIBF as 4. If the resulting address is equal to are the other disk subroutines described in or greater than that of the second this section. SPIRO must be used if DISKO defective cylinder (found in DISKx +17), is called, SPIR1 if DISK1 is called, or add 8 more. SPIRN if DISKN is called. 5. If the resulting address is equal to or greater than that of the third Note: In no case should SPIR be used with defective cylinder (found in DISKx +18), the DM2 System. add 8 more. The SPIR reads sector 0000 from the disk The address obtained from steps 1-5 is and stores the first four words into the the effective sector address. disk ISS that is in core. Therefore, the SPIR subroutine should be called before any calls are made to the disk ISS.
Disk Initialization The calling sequence for SPIR is as follows:
I It is the user s responsibility to CALL SPIRx correctly load DISKx +13, +16, +17, DC /0000 and +18 at execution time and whenever a new disk is initialized. The following The four words read from sector 0000 are programs can be used to perform these described under "Disk Pack Initialization functions. Routine" in the publication IBM 1130 Card/Paper Tape Programming System Disk Pack Initialization Routine (DPIFt). Operator s Guide. The functions of this program are to write sector addresses on a disk, to detect any defective cylinders, and to store defective cylinder information, file-protect addresses, and a disk label in sector 0 of the disk. The operating procedures for DISK SUBROUTINES (DM2 SYSTEM) DPIR are located in the publication IBM 1130 Card/Paper Tape Programming System Operator s Guide. All disk subroutines used by the DM2 system (including DISKZ) reside in the IBM System 1 Set Pack Initialization Routine (SPIRO, area on the monitor disk. The disk SPIR1, and SPIRN). The function of these subroutines are stored in a special core subroutines is to store defective cylinder image format in this area rather than in information and the file-protect address the System Library, since the DM2 system from sector 0 of the disk into the appro- always requires a disk I/O subroutine. The priate DISKx subroutine. required version is fetched by the Core Image Loader just prior to execution.
28 The disk subroutines used with the The other version of DISKN, shown in Monitor system are DISKZ, DISK1, and DISKN. the next drawing, can simultaneously control a single-disk drive in the 1131 CPU and DISKZ. DISKZ is intended for use in a two 2311 Disk Storage Drives (only one of FORTRAN environment in which FORTRAN I/O is the disks in each pack). This version of used. DISKZ makes no preoperative DISKN is for systems having 1316 Disk parameter checks and offers no file Storage Packs (mounted in 2311 Disk Storage protection. It is the shortest of the Drives), and--optionally--a 2315 Disk three disk I/O subroutines and requires a Cartridge mounted in the 1131 CPU. special calling sequence (see "DISKZ-Disk I/O Subroutine"). This calling sequence can also be used with DISK1 and DISKN. DISKZ is also used by the RPG disk subroutines. DISK1. DISK1 is intended for use by Assembler language programs in which the core storage requirement is of more importance than the execution time. DISK1 is longer than DISKZ but is the shorter of the two subroutines intended for use in Assembler language programs (DISK1 and DISKN). However, DISK1 does not minimize extra disk revolutions when transferring more than 320 words. DISKN. DISKN minimizes extra disk revolu- tions in transferring more than 320 words. It provides all the functions During loading of the Disk Monitor DISK1 does and also operates as many as 5 System, the 2310 version of DISKN is auto- drives simultaneously. matically placed into the IBM System Area on disk. If your system contains 2311s, Two versions of DISKN are distributed however, you must replace this version with the Disk Monitor System. Both ver- with the 2311 version of DISKN before you sions are called by the same calling load the Disk Monitor System card deck. sequence. The difference between them is (See "Monitor System Initial Load and the way they control disk drives. One System Reload" in IBM 1130 Disk Monitor version of DISKN, shown in the next System, Version 2, Programmer s and drawing, can control as many as 5 single- Operator s Guide.) disk drives simultaneousl y . This version of DISKN is for systems having only 2315 Note: Both DISK1 and DISKN can be Disk Cartridges (mounted in 2310 Disk specified on the Monitor XEX record for use Storage Drives and/or the 1131 CPU). with FORTRAN programs. However, they offer no real advantage over DISKZ if they are called by the disk FORTRAN I/O subroutine.
Interrupt Service Subroutines 28.1 28.2 One of the major differences among the Sector Numbering. Each disk sector is disk subroutines is the ability to read or assigned an address from the sequence 0, 1, write consecutive sectors on the disk ...,1623, corresponding to the sector without taking extra revolutions. If full position in the ascending sequence of sectors are written, the time in which the cylinder and sector numbers from cylinder I/O command must be given varies. DISKN is 0, sector 0 (outermost), through cylinder programmed so that transfers of more than 202, sector 7 (innermost). The user can 320 words are made with a minimum number of address cylinders U through 199. The extra revolutions occuring between sectors. remaining three cylinders are reserved for defective cylinder handling. DISK1 and DISKN have the same error- handling procedures. Each cylinder contains eight sectors and each sector contains 321 words, counting Note: In the DM2 system, the disk I/O the sector address. The sector address is subroutines are not stored in the System recorded in the first word of each sector Library; consequently they do not have LET and occupies the rightmost eleven bit entries. positions. Of these eleven positions, the three low-order positions identify the sector (0-7) within the cylinder. Utilization of this first word for Sector Numbering and File Protection identification purposes reduces the per sector availability of data words to 320; therefore, transmission of full sectors of In the interest of providing disk features data is performed in increments of 320 permitting versatile and orderly control of words. disk operations, programming conventions have been adopted concerning sector Sector addresses must be initially numbering, file protection, and defective recorded on the disk by the user (via DISC sector handling. Successful use of disk or DCIP: see IBM 1130 Disk Monitor System, I/O subroutines can be expected only if I Version 2, Programmer s and Operator s user programs are built within the Guide), and are thereafter rewritten by the framework of these conventions. The disk I/O subroutines as each sector is primary concern behind the conventions is written. the safety of data recorded on the disk. To this end, the file-protection scheme Note: Although not actually written on the plays a major role, but does so in a manner disk, the logical drive code must be part that is dependent upon the sector-numbering of the sector address parameter (bits 1-3) technique. The latter contributes to data which is stored in the second word of the safety by allowing the disk I/O subroutine I/O area. Bit 0 must always be zero. to verify the correct positioning of the access arm before it actually performs a write operation. This verification File Protection. File protection is requires that sector identification be provided to prohibit the inadvertent prerecorded on each sector and that destruction of previously recorded data. subsequent writing on the disk be done in a This control is achieved by having all manner that preserves the existing write functions (except write immediate) identification. The disk I/O subroutines test for the file-protection status of support these requirements. sectors they are about to write.
Interrupt • Service Subroutines 29 Each cartridge has a file-protect g is the sector address, including the address in COMMA. This address is the logical drive code, at which the address of the first unprotected sector, transfer is to begin, i.e., the address of the beginning of Working Storage. Every sector, from sector h is the length of the I/O area. h must 0 up to the sector address maintained in be equal to or greater than f. COMMA, is file-protected. The initial assignment of the file-protect address is performed by the disk initialization program DCIP or DISC: see IBM 1130 Disk Monitor System, Version 2, Programmer s Control Parameter and Operator s Guide. Subsequent updating of the file-protect address is performed by the Monitor programs. This parameter consists of four hexadecimal digits, shown below: Defective Sector Handling. A defective sector is a sector on which a read or write 1 2 3 4 function cannot be successfully completed during initialization of the cartridge. A I/O Function cylinder having one or more defective sectors is defined as a defective cylinder. Logical Drive Code The disk I/O subroutines can accommodate as (DISKN Test function Only)._ many as three defective cylinders per cartridge. Since there are 203 cylinders Seek Option on each disk, the disk I/O subroutines can "overflow" the 200 cylinders normally used Displacement Option when defective cylinders are encountered (see "Effective Address Calculation" in this section). I/O Function The I/O function digit specifies the operation to be performed on disk storage. The functions, their associated digital Calling Sequence value, and the required parameters are listed and described below.
Operemds gem:As- 32 a r- -1 L.L F n.r,.s.K,...... ,r .A, I .n.r,s,r. a/ ..... Digital Required p.c ith .0d.o ..... .rw.r , tIAA■R t.11 AlrIT Function Value Parameters" r • I St/ 17. EA, Palika IFIT .E.12, ERRI7R FR RO JI IR IRA iT er IRA ...... IIIIIIIIIIIIIIIIIII Test 0 Control, I/O Area
1/.11 lllllllllllllllll Read 1 Control, I/O Area, Error FIARdloR n ,c. jE l,R,F,T R l 01.111)1RIErC.51 1 I I I ...... 1...1■■■111.11111111.■ Write with- out RBC 2 Control, I/O Area, Error Iti r F tRAIRIRI .R. FIT of SIR WI Tal teLt4 Write with RBC 3 Control, I/O Area, Error
P.C. e f llllll JIM .00.1./A71 P.c. . F r T XI IANIADIR■E■C■S lllll Write .81.25.Se 1 I 1 iti101 1.4■R.FIA lllllllllll Immediate 4 1■■■■■■.•.■■•■■••■■■•■■■■••■ Control, I/O Area Seek 5 Control, I/O Area, Error -1 where "Any parameter not required for a particular function must be omitted. a is 1 or N. Note that LIBF DISKO is L_ equivalent to LIBF DISK1.
b is the I/O function digit, Test. Branches to LIBF+3 if the previous operation on the drive has not been d is the Seek option digit, completed, to LIBF+4 if the previous operation has been completed. e is the Displacement option digit,
f is the number of words to be Note: This function requires the I/O area transferred to or from the disk, parameter even though it is not used.
30 Read. Positions the access arm and reads Write Without Readback Check. Functions data into the user s I/O area until the the same as Write With Readback Check specified number of words has been except that no readback check is performed. transmitted. Although sector identification words are read and checked Write Immediate. Writes data with no for agreement with expected values, they attempt to position the access arm, check are neither transmitted to the I/O area nor for file-protect status, or check for counted in the number of words transferred. errors. Writing begins at the sector number specified in the user s I/O area. If, during the reading of a sector, a This function provides more rapid writing read check occurs, up to 16 retries are to the disk than is provided in the attempted. If the error persists, the previously described Write functions; it function is temporarily discontinued, an provides, for example, the ability to error code is placed in the Accumulator, "stream" data to the disk for temporary the address of the faulty sector is placed bulk storage or to write addresses in in the Extension, and an exit is made to Working Storage (see "System Library the error subroutine specified by the error Mainline Programs (DM2 System) ADRWS"). parameter. Writing less than 320 words on any Upon return from the error subroutine, sector sets the remaining words in that the operation is either reinitiated or sector to zero. terminated, depending on whether the Accumulator is nonzero or zero, As each sector is written, the respectively. subroutine supplies the sector-identi- fication word. The identification word for the first sector is obtained from the I/O Write With Readback Check. Checks whether area, although it and subsequently or not the specified sector address is in a generated identification words are not file-protected area. If it is, the included in the word count. subroutine places the appropriate error code in the Accumulator and exits to $PRET. Seek. Initiates a seek as specified by the seek option digit. If any errors are detect- If the specified sector address is not ed, the operation is retried up to 16 times. in a file-protected area, the subroutine positions the access arm and writes the The seek function requires that the user contents of the indicated I/O area onto the set up the normal I/O area parameters (see disk. Writing begins at the designated "I/0 Area Parameter" in this section) even sector and continues until the specified though only the sector address in the I/O number of words have been transmitted. A area is used. readback check is performed on the data written. Logical Drive Code. Digit 2 defines the logical drive code (0, 1, 2, 3, or 4). This Writing less than 320 words on any digit is used only with the DISKN test function. sector sets the remaining words in that sector to zero. Seek Option. If digit 3 of the control parameter is zero, a seek is executed to If any errors are detected, the the cylinder whose sector address is in the operation is retried up to 16 times. If I/O area; if nonzero, a seek is executed to the function cannot be accomplished, an the next nondefective cylinder toward the appropriate error code is placed in the center, regardless of the sector address in Accumulator, the address of the faulty the I/O area. This seek to the next sector is placed in the Extension, and an nondefective cylinder must be taken into exit is made to the error subroutine consideration when planning for the designated by the error parameter. "streaming" of data. This option is valid only when the seek function is specified. Upon return from this error subroutine, the operation is either reinitiated or Displacement Option. If digit 4 of the terminated, depending upon whether the control parameter is zero, the sector Accumulator is nonzero or zero, address word contains the absolute sector respectively. identification; if nonzero, the file-protect address for the specified cartridge is added As each sector is written, the to bits 4-15 of the sector address word to subroutine supplies the sector-identi- generate the effective sector identification. fication word. The identification word for The file-protect address is the sector the first sector is obtained from the I/O identification of the first unprotected area, although it and subsequently sector, i.e., the address of the first generated identification words are not sector of Working Storage. included in the word count.
Interrupt Service Subroutines 31 I/0 Area Parameter 5. If the resultant address is equal to or greater than that of the third defective cylinder, add 8 more. The I/O area parameter is the label of the first of two control words which precede The address obtained from steps 1-5 is the user s I/O area. The first word the effective sector address. Defective contains the number of data words that are cylinders are handled in this manner for to be transferred during the disk all operations, including seek and write operation. This number need not be limited immediate. by sector or cylinder size, since the subroutines cross sector and cylinder boundaries, if necessary, in order to transmit the specified number of words. Monitor Entry Point The second word contains the sector address at which reading or writing is to Both DISK1 and DISKN can be entered by a begin. Bit 0 must be zero. Bits 1-3 are BSI L /00F2, the monitor entry point (see the device identification (logical drive calling sequence of DISKZ). This entry code) and must be 0, 1, 2, 3, or 4. Bits point is used by the system programs and by 4-15 specify the sector address. The FORTRAN programs when DISE1 or DISKN is user s I/O area follows the two control specified in the XEQ record. words. Reading begins at the designated sector Note: The I/O area parameters are not where the access arm reads data into the available to the user until the requested user s I/O area until the specified number operation is completed. The word count of words has been transmitted. and sector addresses may be altered during a requested disk operation but are re- Writing begins at the designated sector stored at the completion of the operation. and continues until the specified number of words have been transmitted. A readback check is performed on the data written on Error Parameter the disk. When DISK1 and DISKN are entered via /00F2, however, there is no check for writing in the file-protect area. If an error is detected, the user can request the subroutine to terminate (that There is no possibility of performing a is, to clear the subroutine s busy seek operation when using the monitor entry indicator and turn off interrupt level 2) point. A word count of zero will result in or to branch to $PST2, with interrupt level a preoperative error wait. All postopera- 2 on, waiting for operator intervention. tive errors will cause a branch to $PST2 (see Appendix B).
Effective Address Calculation Disk Initialization An effective disk address is calculated as follows: Before the DM2 system is stored on a cartridge, the Disk Cartridge 1. Obtain the sector address found in the Initialization Program (DCIP) must be sector address word of the I/O area. executed. This program writes sector addresses on the disk cartridge, detects 2. If the displacement option digit in any defective cylinders, stores defective the control parameter is nonzero, add cylinder information and a cartridge ID in the sector address of the first sector sector 0 of cylinder 0, and initializes that is not file-protected. DCOM. The operating procedure for DCIP is listed in the publication IBM 1130 Disk Note: This address causes an exit to $PRET Monitor System, Version 2, Programmer s if it exceeds 1599. and Operator s Guide. 3. If the resultant address is equal to or greater than the sector. address of the first defective cylinder, add 8. DISKZ - DISK I/O SUBROUTINE 4. If the resultant address is equal to or greater than that of the second The DISKZ subroutine offers no file defective cylinder, add 8 more. protection, no preoperative parameter checks, no write immediate function, and nc
32 write without readback check function. It Buffer Size. Unlimited is intended for use by the DM2 programs, RPG programs, and FORTRAN programs in which disk FORTRAN I/O is used. Although DISKZ Operation. DISKZ performs read, seek, and has many of the characteristics of an ISS, write with readback check functions. Each it is assembled as though it were a function returns control to the user after mainline and is stored in a special Core it has been initiated. To determine the Image format in the System Device completion of a disk operation, the user Subroutine area. may test $DBSY (location /00EE in COMMA) until it is cleared to zero. DISKZ itself tests this word before initiating an operation. Following a write, this subroutine performs a readback check on the Calling Sequence data just written. If it detects an error, it reexecutes the write. Similarly, if a sector is not located or if an error is 066,666 6 Remark. detected during a read, DISKZ repeats the I Hsi 1.04D PAR.RACT,EAS , .1,N, R.c.C, .E,LT. .8,11,/114.C.H. .T,O. ,11,1o.S.R.Z ...... , operation. All operations are attempted 16 ■ „ . . o . ...... . . . , , . . . , . . , . o , , . times before DISKZ indicates an ■ .,.. unrecoverable error. al , , . . [—LA T, ♦Al — . U N C I•■ P AR • .R.R.E R. P,A.RokilE.,T.0 R. ■ If a partial sector (less than 320 111 ■ _i__LI .. . , . , .1_1_1_1_ ,,,,,,,, i • words) is written, the remaining words of • : ■ , ,,,,,, V40.R.D. .610.01,N , T ,,,,,,, . . . . , , . , . . the sector are set to zero. ,,,,,,,, S.s,c.1,e,R, .A.D.D.R.Cs , 8 ...... . . . . ■ 41_ Li 0 ,ASAAA_,_,_,_ Subroutines Required. No other subroutines IF., are required by DISKZ. ■M■■ MONO II NOON. MI ■ MOMOOO.,. ■ . ... .... 1 ..... ■ .1.. ..,, ,,,,,,, , Note: It is important to realize that the DISKZ subroutine is designed to operate in where an error-free environment; it is not recommended for general usage. The user should therefore use DISK1 or DISKN a is the I/O function digit: whenever possible. indicates a read, 1 a write.
b is the number of words to be transferred to or from the disk,
1132 PRINTER SUBROUTINE (PRNT1) c is the sector address at which the transfer is to begin, The printer subroutine PRNT1 handles all d is the length of the I/O area. d must print and carriage control functions be equal to or greater than b. relative to the IBM 1132 Printer (see also 1132 Printer/Synchronous Communications The word count (first word of the Adapter Subroutine (PRNT2) ). Only one buffer) must be nonnegative and must be on line of data can be printed, or one an even core boundary. The sector address carriage operation executed, with each call must be the second word of the buffer. The to the printer subroutine. The data in the logical drive code (0, 1, 2, 3, or 4), as output area must be in EBCDIC form, packed defined by the // JOB DM2 control record, two characters per computer word. Any code is in bits 1-3 of the sector address. Bit other than those defined for the 1132 will zero is always zero. be interpreted by the PRNT1 subroutine as a blank. (See Appendix D. Character Code A word count of zero indicates a seek to Chart".) the cylinder denoted in the sector address. File protection is not provided. If the access arm is not positioned at the cylinder addressed, DISKZ seeks to that cylinder before performing the requested function. A read follows each seek to verify that the seek was successful. No buffer is required for this read.
Interrupt Service Subroutines 33 Calling Sequence r Digital Required Function Value Parameters Operation Operand. Reeneeks 32 es 30 Test 0 Control 4,1"ereF P.R,Ahr i ...... Pia rIAATIF.R, ne, lllll r l tn147,17.1 ■PARIA IME IT Ea?. D .C. , ZIA A RI till, .T./.n, AIRIEJA .1114■RAM■F IT IF RI Print 2 Control, I/O Area, Error n.f fitIAROJZ ...... 4:1414ARI ... Control yyy, Carriage 3 Control 1. deAraAcm AdmchkiE,s,s„