Development of time shared basic system processor for Hewlett Packard 2100 series computers by John Sidney Shema A thesis submitted to the Graduate Faculty in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in Electrical Engineering Montana State University © Copyright by John Sidney Shema (1974) Abstract: The subject of this thesis is the development of a low cost time share BASIC system which is capable of providing useful computer services for both commercial and educational users. The content of this thesis is summarized as follows:First, a review of the historical work leading to the development of time share principles is presented. Second, software design considerations and related restrictions imposed by hardware capabilities and their impact on system performance are discussed. Third, 1000D BASIC operating system specifications are described by detailing user software capabilities and system operator capabilities. Fourth, TSB system organization is explained in detail. This involves presenting TSB system modules and describing communication between modules. A detailed study is made of the TSB system tables and organization of the system and user discs. Fifth, unique features of 1000D BASIC are described from a functional point of view. Sixth, a summary of the material presented in the thesis is made. Seventh, the recommendation is made that error detection and recovery techniques be pursued in order to improve system reliability. In presenting this thesis in partial fulfillment of the requirements, for an advanced degree at Montana State University, I agree that permission for extensive copying of this thesis for scholarly purposes may be granted by my major professor, or, in his absence, by the Director of Libraries. A program listing of the 1000D Time Share BASIC system is not submitted as part of this thesis since pro-' gram development was performed by a private business corp­ oration which considers the listing as proprietary infor­ mation. Arrangements must be made with a representative of Western Telecomputing Corporation of Bozeman, Montana in Order to obtain a program listing for evaluation. It is understood that any copying or publication of this thesis for financial gain shall not be allowed without my written permission. Signature , f y i r f w J d & b u t / Date Ti? : /T /9 7 ^ 7 DEVELOPMENT OF TIME SHARED BASIC SYSTEM PROCESSOR FOR HEWLETT PACKARD 2100 SERIES COMPUTERS by. JOHN SIDNEY SHEMA A thesis submitted to the Graduate Faculty in partial fulfillment of the requirements for the degree MASTER OF SCIENCE in Electrical Engineering Approved: Head, Major D e p a r # # // Chairman, Examining Committee ____ __________ Graduate Dean MONTANA STATE UNIVERSITY Bozeman, Montana March, 1974 • } >6 iii ACKNOWLEDGMENT The development of any major computer software oper­ ating system is a lengthy, and complex process requiring the cooperation and creative talents of many individuals. The author wishes to thank the programmers and system analysts at Hewlett Packard Company for their excellence in designing and documenting the HP 2000B time shared BASIC system which served as a starting point for this investigation. The writer is deeply grateful to Western Telecomputing Corporation for supplying the facilities and equipment to develop and debug 1000D BASIC. He is especially thankful to Dr. Donald K. Weaver Jr. for his backing of the project and many suggestions for improvement. J.S.S iv i TABLE OF CONTENTS Chapter I. Page INTRODUCTION.. . . . . . . . . . . . . . . . . . . . . . . . . . . . ... I Historical Development of Time Share Principles. . . . . i Relevance of Previous Wor k. . . . . . . . . . . . . . . . . . . . . . . 6 Organization of Remaining Chapters. . . . . . . . . . . . . . . 7 II. OPERATING SYSTEM REQUIREMENTS. . . . . . . . . . . 8 System Design Considerations. . . . . . . . . . 8 1000D System Specifications. . . . . . . . . . . . . . . . . . . . 11 III. OPERATING SYSTEM SPECIFICATIONS. . . . . . . . . . . . . . . . . . . 16 User Software Capabilities. . . . . . . . . . . . . . . . . . . . . . 16 System Operator Software Capabilities. . . . . . . . . . . . . 22 IV. TSB SYSTEM ORGANIZATION... . . . . . . . . . 27 TSB System Modules. . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 TSB System Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Disc Organization. . . . . . . . . . . . 54 V. VI. UNIQUE FEATURES OF 1000D. . . . . . . . . . . . . . . . . . . . . 59 ASSIGN Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . CHAIN Statement. . . . . . . . . . . . . FORMAT Command.. . . . . . . . . . DISC Command. . . . . . . . . . . . . . . . . 59 67 73 78 SUMMARY AND RECOMMENDATIONS. . . . . . . . . . . . . . . . : . . . . 86 Summary. . . . . . Recommendations. . . . . . . . . . . . . . . . . . . . . . . . . . 87 BIBLIOGRAPHY.... . . . . . . . . . 89 86 APPENDIX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Appendix A: Appendix B: Hardware Requirements.. . . . . . . . . . . . . . . 92 1000D Core Map./.. . . . . . . . . . . . . . . . . . . 96 V LIST OF TABLES Table Page 1. BASIC Matrix Operations. . . . . . . . . . . . . . . . . . . . . . . . . 17 2. Base Page Links. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3. System Console States. . . . . . . . . . . . . . . . . . . . . . . . . . 35 4. System Library Overlay Programs.... . . . . . . . . . . . . . . . 42 5. ID Code Entry Format. . . . . . . . . . . . . . . . . . . . . . . . . . . 45 6. Base Page DIREC Format. . . . . . . . . . . . . . . . . . . . . . . . . 48 7. DIREC Values. . . . . . . . . . . 8. COMTABLE Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 9. System Disc Organization. . . . . . . . . 10. 49 56 User/Library Disc Organization. . . . . . . . . . . . . . . . . . ...58 vi LIST OF FIGURES Figure Page 1. Terminal Data Formats. . . . . . . . . . . . . . . . . . . . . . . . 2. Example of ROSTER Command. . . . . . . . . . . . . . . . . . . . . . . . 24 3. Example of REPORT Command. . . . . . . . . . . . . . . 4. Example of DIRECTORY Command. . . . . . . . . . . . . . . . . . . . . 25 . 5. Bit-Flag Representation. . . . . . . . . . . . . . . . . . . 6. I/O Buffer States.. . . . . . . . . . . . . . . . . . . . 7. Disc Address W o r d . . . . . . . . . . . . . . . . . . . . . 8. System Queue. . . . . . . . . . . . . . . . . . . . . 9. Directory Entry Format. . . . . . . . . . . . . . . . . . . . . . . . 13 25 28 32 34 40 46 10. Directory Pseudo-Entries. . . . . . . . . . . . . . . . . 47 11. ADT Entry Format. . . . . . . . . . . . . . . . . . . . . . 12. COMTABLE Entry Coding Format... . . . . . . . . . . . . . . 53 13. HP7900 Disc Organization. . . . . . . . . . . . . . . . . . . 54 14. HP7901 Disc Organization.... . . . . . . . . ... ■. . . . . . . . 55 15. ASSIGN Syntax Processing Flow Diagram. . . . . . . . . . . . . 16. ASSIGN Execution Flow Diagram. . . . . . . . . . . . . . . . 17. CHAIN Statement Syntax Processor. . . . . . . . . . . . . . . . . . 69 18. CHAIN Execution Flow Chart. . . . . . . . . . . . . . . . . . . . . . . 71 19. FORMAT Command Flow Chart. . . . . . . . . . . . . . . . . . 20. DISC-UP Command Flow Diagram... . . . . . . . . . . . . . . . . . . . 80 21. DISC-DN Command Flow Diagram. . . . . . . . . . . . . . . . . . . . . 84 49 62 64 74 v ii ABSTRACT The subject of this thesis is the development of a low cost time share BASIC system which is capable of providing useful com­ puter services for both commercial and educational users. The content of this thesis is summarized as follows: First, a review of the historical work leading to the development of time share principles is presented. Second, software design considerations and related restrictions imposed by hardware capabilities and their impact on system performance are discussed. Third, 1000D BASIC operating system specifications are described by detailing user soft­ ware capabilities and system operator capabilities. Fourth, TSB system organization is explained in detail. This involves presenting TSB system modules and describing communication between modules. A detailed study is made of the TSB system tables and organization of the system and user discs. Fifth, unique features of 1000D BASIC are described from a functional point of view. Sixth, a summary of the material presented in the thesis is made. Seventh, the recom­ mendation is made that error detection and recovery techniques be pursued in order to improve system reliability. CHAPTER I INTRODUCTION Time sharing is a technique of computer system software design which allows many users, located at remote terminals, to have simultaneous access to a single central computer. Due to the extremely fast processing speed of the computer in comparison with that of the terminals, the computer is able to share its resources among the users. This makes it appear as if each terminal was directly connected to its own separate computer. Even if one ter­ minal is running a program requiring large amounts of computer time, the other user terminals are required to wait only a few seconds for the computer to process their programs. The objective of this thesis is to present an overall des­ cription of one specific time share system. This system was devel­ oped by Western Telecomputing Corporation in order to provide low cost computer services for both commercial and educational organiz­ ations in Montana HISTORICAL DEVELOPMENT OF TIME SHARE PRINCIPLES The introduction of the minicomputer in the late 1960's along with its associated low cost-high performance peripheral 2 equipment, caused the data processing industry to undergo a massive change. Early computer facilities emphasized the need to create powerful computer centers whose power was measured in terms of physical dimensions such as number of central processors, amount of main core memory available, and number of peripherals attached. Such thinking lead to the creation of multi-mil I ion dollar computer systems capable of handling tremendous quantities of problems and data. However, the cost of such systems was prohibitive to smaller companies and educational institutions. With today's technologies of microminiaturization and large scale integration of circuits having reduced the size and cost of computers, a new philosophy of data processing has emerged. Rather than have one extremely powerful computer facility to handle all problems, it is now more economical to have several small processors, each handling a specific problem. In fact, in some cases the best solution to a specific problem is to design a special purpose pro- . cessor using state of the art techniques rather than attempt to pro­ gram a general purpose computer to perform the same function.^ Historically, much data processing was accomplished by pro­ grammers writing programs to a particular customer's specifications, ^ Kampe, Thomas W., "The Design of a General-Purpose Microprogram^Controlled Computer, with Elementary Structure," in Computer Structures: Readings and Examples, pp. 341-347. 3 entering the program with data cards into a batch processing facility, and returning hours later to see if any error had occurred. Omission of even a single comma could mean the run produced no results. Additionally, time was required to analyze the printout to determine if the algorithm written had actually performed the desired task. If not, several more program runs, each printing diagnostic information would be required before the program ran error free. Such a procedure was acceptable after a program had been fully written and made free of logic errors. routine basis. The program could then be run on a However, this procedure is unacceptable to the pro­ grammer since little, if any, interaction with the program was allowed. Another problem which was not handled by the large computing system was that of the small or medium sized program requiring only several seconds of computer processing time. In most cases, the person waited several hours for his program to be run on the computer even though actual execution time was less than a minute for the entire program. In many cases, the computer's central processor was idle, while it waited for the results of a previous computation to be printed. . Numerous attempts were made to solve the problem of obtaining maximum utilization of a computer's resources in the early 1960's. of the most effective solutions was that of a time share system developed at. Dartmouth College by John G. Kemeney, Chairman of the One 4 Department of Mathematics, and Thomas E. Kurtz, Director of Com­ putation Center. Their idea, which was first proposed in 1962, was to design a program language which would be both simple to learn yet powerful enough to perform complicated tasks. The language was implemented in 1964 and was termed BASIC, for Beginner's All­ purpose Symbolic Instruction Code. Up to 40 simultaneous users were allowed to communicate with the BASIC Language processor directly through keyboard-printer terminals. A master program, called the supervisory control or executive, kept track of all communication between the users and computer. It decided who was to run next, how long they were allowed to run, and performed the appropriate task called upon. - An important feature of the Dartmouth BASIC system was that the user was not required to be in the proximity of the computer in order to run a program. Terminals could communicate directly with the computer over regular telephone circuits. Thus, computer service was never farther away than the nearest telephone. The major advantage of a time share computer system over a batch system is the ability of the programmer to communicate directly with a "virtual processor" and have each line of code examined immediately upon entry into the computer. This allows for on-line debugging of programs which is not possible on most batch systems. Since the computer is being "shared" among many customers, the cost 5 of computer services can be shared among the various.customers. allows even small businesses to afford computer services. This Finally, communication with a time-share computer is on a real-time basis. Data can be entered and analyzed immediately, with results printed on the user terminal in a matter of seconds rather than hours. This capability of time share gives a company the ability to analyze data on sales, inventory, expenses, etc. and receive up to the minute company reports, such as cash flow or sales forecasting. The Dartmouth BASIC system, capable of supporting many terminals, required a substantial investment in terms of processors, discs, and peripheral equipment. One of the first breakthroughs in terms of providing a low cost but powerful BASIC Language processor was the announcement by Hewlett Packard Company of their minicomputer-based 2Q00A Time Shared BASIC System in 1969. The 2OOOA System could generate up to 16 channels of BASIC for an investment of approximately $100,000. The 2000B System generated up to 32 channels of BASIC for about the same initial investment. The only major problem was that the initial system had limited disc space and additional disc space was very expensive. . In 1972, Western Telecomputing Corporation started development of a Hewlett-Packard 2000B - based time shared BASIC system designed around a new low cost moving-head disc drive, the Hewlett Packard 7900A. Design specifications stated that the system should be capable . 6 of supporting up to 16 channels of BASIC, meet most of HP2000B Language specifications, provide large quantities of disc storage, and have a total system cost of less that $40,000. The version of BASIC that was developed to meet these requirements was called the WTC-I0000 Time Share BASIC System.' RELEVANCE OF PREVIOUS WORK The WTC-I000D time shared BASIC system described in this thesis, is only one of the many variations upon the Dartmouth System as con- . ceived. by Kemeney and Kurtz. A study of all manufacturers of computers would show that each one has his own version of BASIC. Some of these are so powerful and have so many extensions that they tend to obscure the simplicity of the original language. The system described is organized almost identically to that of Hewlett Packard 2000B., That particular implementation of BASIC was selected for two reasons. readily available. The first is that the source tapes were The second, and most important, was that the 2000B system had been documented and described in sufficient detail that modifications could be easily made and tested. 7 ORGANIZATION OF REMAINING CHAPTERS Chapter 2 discusses restrictions imposed upon the design of the system in terms of hardware arid performance requirements. A discussion of terminology is presented to acquaint the reader with various concepts underlying the principle of time sharing. Chapter 3 is a presentation of the operating system specifications of 1000D BASIC. It presents an overview of the system from both the user's point of view and the system operator's point of view. Chapter 4 describes TSB System organization. It presents an overview of TSB modules and describes communication between modules. This chapter describes the organization of TSB tables and explains their functions. Finally, an account of disc organization is given, both for system discs and user/library discs. Chapter 5 is a description of unique capabilities of 1000D which were developed to enhance system operation or make the system better fit the needs of commercial customers. The concluding chapter 6 gives a summary and conclusion of IOOOD as a solution to providing economical computing services to both commercial and educational users. Finally, several recommendations for system improvement are presented and discussed. CHAPTER 2 OPERATING SYSTEM REQUIREMENTS In designing a computer operating system, two types of problems must be solved.^ The first type deals with intrinsic problems or those which are inherent in the design itself. The designer must Took at the function the software is to serve and evaluate the requirements needed to implement that function. A design consideration of 1000D BASIC was that it should perform a useful function for both commercial users and educational users. This decision immediately created several design problems. Commercial customers needed large files for storage of data and would be using programs requiring significant compute times. Increased file access was needed and this would tend to tie the system up. Educational users demanded rapid response time to pro­ grams which would be mostly input/output bound. data banks would not be required. Access to large Finally, a system of user security would be required to prevent unauthorized access to a. user's private files by another user. The second type of problem occurs when one attempts to solve the first, that is technological problems arise. ^ Walsh, Larry, 2000C Course Notes, p. 10. These problems 9 can be looked upon as forming the constraints with which the system designer is forced to work. For example, limiting the amount of computer core memory implies an upper limit to user program length. Not all of the system coding may fit in memory so techniques must be derived to move blocks of coding into core when they are to be executed. These constraints force the system designer to carefully consider various algorithms for making maximum use of the system resources. If the designer has decided upon a system language, BASIC in this case, communication with the system must be considered. Two levels of communication are required . 3 One is a command lang­ uage. A processor for this language is then required. This processor is responsible for handling system access, for control of system resources, and for file and program control. level of communication is that of a program language. preter for that language is required. The second An inter­ This is the processor which executes program statements that control file manipulations, carries out calculations, and perform specific operations on data. Other technological problems must be solved while planning the operating system. The hardware system must be separated by software procedures into a number of virtual processors for 3 Ibid., p . 10. 10 simultaneous use by many users. Most importantly, such sharing of resources must be done in a way that makes sharing of resources "invisible" to all of the users. This places the requirement that the system be highly organized. Sharing of resources implies that a master program must exist whose function is to determine which user will be allowed to execute a command or perform a calculation. referred to as a scheduler. Such a program is The time this program is running rather than a user program is called overhead time. Overhead is the time the system spends performing routines designed to implement the sharing of resources. It is time lost to the users since their programs are idle when.the scheduler is operating. It is impor­ tant that the overhead time be kept to an absolute minimum in a well organized system. Another function of .the scheduler is to maximize utilization of system resources. This means the scheduler should attempt to keep each hardware subsystem busy.and insure that the system does not "bottleneck" because one resource is overly busy while others remain idle. Response time or the amount of time required for the system to respond to a user command will increase as system utilization increases. The system must wait for one user to complete a task before it can allow a new user to start its own task. The tech­ nique of "time-slicing" allows the computer to implement resource 11 sharing among the users and reduce response time. This procedure enables the. computer to set an upper limit on the amount of time a user's program may execute in core. If the program exceeds this limit it is written back onto a disc from core and the next user's program is read from the disc into core and allowed to execute. IOQOD SYSTEM SPECIFICATIONS WTC-I000D BASIC was designed to run on a Hewlett Packard 2100 series computer. This section presents some of the design specifications and constraints which were placed on I GOOD. Appendix A contains a complete list of all hardware required to operate the system. 1000D was designed as a small-scale time-share system capable of supporting up to 16 simultaneous users. In order to keep response time of the system to less than five seconds, data communication transfer rate was set to be in the 10 to 30 character per second range. Faster rates would force the scheduler to spend most of its time character processing, leaving little time to execute user programs. The most common time-share terminal in use at the time of system design was the ASR-33 teletype which operated at 10 characters per second ( H O baud). This terminal communicated in a bit-serial 12 A^ClI .code. ASCII code was also the method of character represen­ tation internally within the HP 2100 series computers. Hence, no code conversion was required by the input/output processor. Figure I gives the format of the data words generated by a device operating at 10 characters per second and by one operating at 30 characters per second. The input/output processing routine required at the worst case .15 milliseconds to process a single character. At an input speed of 10 characters per second, the routine has two bit lengths to process a character without loss of data, or 18 milliseconds. It is obvious that at least 100 channels could be processed at this speed. For terminals operating at 30 characters per second, timing is more critical. The computer has only one bit length or 3.33 milliseconds to process a character from each channel without loss of data. Calculations show that the computer can process at best, only 22 channels at 30 characters per second. Therefore, a full system of high speed terminals would tend to run much slower than a full system of slow speed terminals since most of the computer's time would be spent processing characters. Since all communication from users to the system would be over telephone connections, a second design consideration was to allow system control of the telephone circuits. reasons for doing so. There were three First, a person dialing a wrong number could 13 START BIT 0 2 I <--- 3 4 6 5 S bit character code --------------- STOP STOP BIT BIT 7 --- > <18 msec > IOO milliseconds------------------ > Data Word at 10 Characters per Second. START BIT 0 I 2 3 4 5 6 7 d bit character code S 33 .3 milliseconds Data Word at 30 Characters per Second. Figure I. Terminal Data Formats STOP BIT 3.33 msec 14 tie up one of the channels, preventing, others from accessing the computer. To solve this problem, the computer allows only a certain number of seconds for the caller to log on the system. to do so, the line is disconnected. If he fails Second, if the phones are on a rotary call-in basis, a user can never be certain he will be able to access a particular channel if he is accidentally disconnected. A data set monitor in the system will log the user off the computer in the event his telephone carrier signal is lost. Third, a user's telephone is automatically placed back on hook when he logs off, making the channel immediately available to other users. . The amount of user space available for programming is very important to the customer and system designer. like to have unlimited program space. A customer would The system designer is aware that longer program areas mean the system will run slower since it takes longer to swap users in and out of core. A compromise was made in 1000D setting maximum program length.to 4500 words, approximately 500 BASIC statements. For longer programs, the user was given the ability to "chain" programs together, resulting in virtually un­ limited program length. A final design consideration was that of selecting an optimum amount of disc storage. Fixed head discs were ruled out since they were very expensive and provided limited storage. time was very fast, in the 5 millisecond range. However, access 15 A decision was made to utilize the Hewlett Packard 7900 and 7901 moving-head disc drives. Access time was in the 35 millisecond range, fast for a moving head disc, and storage capacity of a single disc was roughly four times that of a fixed head disc. Each moving- head disc channel provided 203 tracks of 6144 words per track for a total channel capacity of over 1.2 million words. This was enough storage for approximately 960 medium-sized, programs. 1000D allows up to four disc channels for a maximum capacity of over 4.8 million words or approximately 3840 programs. CHAPTER I I I .OPERATING SYSTEM PROCEDURES The language processor of IOOOD BASIC is the same as that . for HP2000B.4 This is an extended version of the original Dartmouth BASIC as first described by Kemeney and Kurtz.^ This chapter summarizes the main features of BASIC from both the user's and operator's view. USER SOFTWARE CAPABILITIES Extended BASIC enables the user to perform complex matrix operations' in a single statement. Table I lists these operations and defines their function. The working size of a matrix is defined by the program through the use of DIMENSION statements. For example, DIM A (5,3), creates a matrix of five rows and three columns. These are maximum limits which may be dynamically redefined in the program using the matrix IDN, Z E R , CON, READ, or INPUT functions. 4 In the above example, MAT 4 Hewlett Packard Company, 2000B: A Guide to Time Shared BASIC, 205 p p . 5 Kemeney, John G., and Kurtz, Thomas E., BASIC Programming, 122 pp. 17 TABLE I. Operation Addition BASIC MATRIX OPERATIONS. Example .MAT C=A+B Description Add matrix B to matrix A. result in matrix C . Put Subtraction MAT C=A-B Subtract matrix B from Matrix A. Result in matrix C . Multiplication MAT C=A* B Multiply matrix A by matrix B. Multiply matrix B by scalar A. Result in matrix C . Inversion MAT C=INV(A) Generates matrix C as the in­ verse matrix of A. MAT C=TRN(B) Generate C as the transpose ma­ trix of B. Transposition ZERO MAT A=ZER Set all elements of matrix A equal to zero. Identity MAT A=IDN Initialize MAT B=CON READ MAT READ C Input MAT INPUT B Print MAT PRINT A Generates A as the identity matrix. Sets all elements of matrix B to one. Reads.data from program DATA statements into matrix C . Reads in elements of matrix B from user terminal. Causes all elements of matrix A to be printed on user ter­ minal . Note: ,MAT READ may also input data from a user disc data file. MAT PRINT may write data to a user disc data file.. 18 A = CON (2,2), redefines A to be a matrix of two rows and two columns. Matrices can only be redefined as being smaller than that set up by the DIM statement. matrix is 2000. The maximum number of elements allowed in a An array of more than 2000 elements will produce an error condition. BASIC contains special variables and language elements for manipulating string quantities. than numeric values. These are alphanumeric values rather String variables are defined in the system by declaring a single letter (A through Z) followed by the dollar sign ($). The physical length of the string variable must be declared in a dimension statement. For example, DIM A$(36), sets up a string variable A$ of 36 elements. Maximum string length is 72 elements. A string value is a set of from I to 72 characters enclosed in quotes. Most printing and non-printing characters of the ASCII code set are valid string characters. During execution of a program, the logical length of the string is set. This is the count of the actual number of characters in the string. For example, the statement, A$ = "SAMPLE STRING", has a logical length of 13 characters even though the physical length of A$ was specified as 36 elements. Substrings may be referenced by the use of subscripted variables. In the above example, A$(2,6) gives the second through sixth character or "AMPLE". BASIC allows string, substrings, and string variables to be used with relational operators. They are com­ 19 pared and ordered as entries are in a dictionary. For example, the following statements may be written: 100 IF A$ = "TEST" THEN 400 200 IF A$(4,6) < B$(7,8) THEN 500. The first statement will cause the program to go to statement 400 only if string A$ has four elements which are exactly "TEST". The second example will go to 500 if the fourth and fifth elements of A$ are alphabeticalIy less than the seventh and eighth elements of B$. Thus, BASIC allows string values to be read, printed, compared, and sorted with very little programming effort required. Two special features of extended BASIC are the ability to specify length of the terminal print line and ability to access.the system clock. Use of the WIDTH, command allows the user to inform the system that the terminal may print only 20 columns of data per line or up to 132 columns per line. Use of the TIM(X) function allows a program to obtain the current minute, hour, Julian day, and year from the system real-time clock. This information is useful in identifying multiple runs of the same program or for reporting run times of various programs. A serious limitation of 1000D BASIC is its rather small user program area of 4500. words. Since some of this area is used for program overhead, program lengths generally have a maximum length of 3500 words. This is sufficient to store a BASIC program of roughly 20 500 statements. If arrays are dimensioned, the user loses two words of program space for each element in the array. Commercial programs are typically very long and utilize large arrays for data storage. Use of the BASIC CHAIN statement allows-the programmer to divide one large program into many smaller segments which are stored on the disc. As each segment of coding is needed, it is called off the disc by the currently executing program. Parameters and other values may be passed from one program to the next through COMMON or data files. . Use of the CHAIN statement gives BASIC the capability of handling programs of virtually unlimited length. All users have access to two levels of libraries. first level is that of the system public library. The These are pro­ grams and files saved on the disc by the master user, A 0 0 0 . Users may get these programs from the disc, list and punch them, modify them, and execute them. public library. User A000 may protect any program in the This makes them "run-only" to all other users. Such a procedure would be used to prevent unauthorized copying of proprietary software. A user also has access to a second level of libraries, an individual user library. Programs and files stored in an individual library are accessible only by the owner. The most powerful program function of BASIC is its versatile file handling capability. Users may create data files on the disc to allow for direct manipulation of large volumes of data. Files 21 may be of two forms: sequential or random access. Sequential files are treated as serial access storage devices. A program starts reading or writing data as a serial list of data items from the physical beginning of the file and continues on an element by.element basis until either the physical end of file is encountered or an end of data condition occurs. During a serial file write operation, the new data element is written immediately following the previous data element. To retrieve an item from the file, the program must, start at the beginning of the file and. read through all items until it comes to the desired data element. Files may also be used in a random access mode. This enables the program to break the file into a series of logical subfiles that can be modified independently of each other. Each subfile is a block of 128 words. Data may be written into a file in either numeric form or string variable form. mixed in any file. String and numeric data may be randomly Use of the TYP(X) function enables the program to identify what type of data the next file item is during a file read. Numeric data requires two words of storage per number whereas two string characters may be stored in a single word. File lengths are variable from I to 48 sectors. holds 128 words of data. Each sector Maximum file length is 6144 words. program may reference up to 16 files at one time. / / / Each This is equivalent 22 to having immediate access to 98,304 words of additional data storage. Any program may access an unlimited number of files during execution through the ASSIGN statement. This statement allows a new file to be referenced in the place of a previously defined file in the pro­ gram. The system allows users simultaneous access of files. The first user program to reference a file is allowed read/write privileges. Al I other users accessing the same file are allowed read-only access. Users whose account identification codes begin with an A (A000 through A999) always are allowed read/write access to the same files. This section has described some of the more important capabilities of extended BASIC. A complete description of user capabilities may be found in the WTC-I000D BASIC user's guide. SYSTEM' OPERATOR SOFTWARE CAPABILITIES The system operator is responsible for maintaining the TSB system, add.ing new accounts, modifying existing accounts, and re­ moving old accounts from the system. These functions are accomplished through the system operator's console using special system commands and through the user account A 0 0 0 . System control through user A000 is restricted to two functions. 23 Only programs stored under that account, become a part of the, public library, accessible to all users. Placing programs and files in this library is the primary function of A000. The second function involves maintenance of a particular program in the public library, the "HELLO" program. This program is automatically run on the user's terminal following a successful attempt to log on TSB. HELLO is a standard BASIC program whose function is to describe the system, give the current date and time, and print important messages from the system operator to the users. Primary system control takes place through operator commands entered on the system console. One function performed is that of limiting access of system resources by the users. The system operator controls resource allocation to up to 562 user accounts, the maximum allowed by the system. This is accomplished by setting restrictions on each account through operator commands. Each account is assigned a unique ID code and password required for system access. The operator also specifies a maximum number of minutes of connect time allowed each user and additionally, a maximum number of sectors of disc storage the user is allowed. The password, maximum connect time and maximum disc storage allowed may be modified at any time by the system operator. If required, an entire account may be removed from the system by an operator command. The system operator may request TSB to generate reports 24 useful for evaluating system utilization. The ROSTER command generates a listing of currently active channels as shown in Figure 2. ROSTER . . . . . . . S231 .... AOOO AOOO K341 . . . . . . . . . . . . . . . . B260 __ C246 ...... Figure 2. . Example of ROSTER Command The first line lists, from left to right, the users logged on terminals 0 through 7. User S231 is on channel 2, user AOOO is on channels 4 and 5, and user C246 is on channel 7. line list users on channels 8 through 15. User B260 is on channel 13. The second User K341 is on channel 8 . Four dots indicate an inactive channel. A listing of all accounts with the total connect time used to date and disc space used to date may be obtained with the REPORT command. This: command is used to generate a report for account purposes. An example of the REPORT command output is given in Figure 3. I 25 REPORT ID AOOO C021 C240 5231 5300 TIME 00007 OOOOO 00666 05267 03406 DISC 02798 OOOOO 00082 00186 00292 Figure 3. ID AOOl C060 C241 5232 UOlO TIME 15339 00767 00311 00099 00311 DISC 02314 OOOlO 00027 00091 01241 ID AOlO Cl 40 C242 5239 Z623 TIME 01723 00583 00106 00043 20001 DISC 00003 00125 00088 00047 01024 Example of REPORT Command ID specifies the account identification code of the user. TIME is the total connect time used in minutes and DISC is the amount of disc storage used in sectors. The DIRECTORY command is used whenever the operator wishes to obtain a listing of library programs and files. The operator may specify what type of directory is desired, a complete listing of all programs and files on the discs or simply a directory for an individual account. Figure 4 gives an example of a directory for a single user. DIR - 5232 NAME *ALFA1 *ALFA2 *ALFA3 *ALPHA *C0DE* BA MCDA WORK DATE 355/73 004/74 004/74 006/74 353/73 009/74 011/74 023/74 Figure 4. SUB 0 0 0 0 0 0 0 0 TR/SEC 092/25 092/22 102/07 092/18 139/00 092/04 166/20 117/02 LEN 03 03 03 04 F 06 14 C 14 08 C Example of DIRECTORY Command 26 The account identification code is listed under the column ID. The program or file name appears under NAME, the date the entry was last referenced is given under DATE. The disc channel number is printed under SUB and the disc address of the entry in the form track number/sector number is printed under the column TR/SEC. The length of the program or file in sectors is printed under LEN. If the entry is a file, an "F" is printed. A "C" prints if the program has been saved in a semi-compiled form. "P" indicates the entry has been protected. A If none of the above appears, the entry is a program. Programs and files which have not been referenced since a particular date may be removed from the system with the PURGE command. The disc space recovered is returned to the system. The system operator may also move programs and files from one disc to another with the MOVE command. This feature is useful when attempting to recover programs from a defective disc. , Finally, the system operator has the ability to initiate an orderly shutdown of the TSB system through the SLEEP command. Back­ up discs may be written using utility programs after TSB has stopped. These backup discs may be used to restore the system in the event of a system failure. CHAPTER IV TSB SYSTEM ORGANIZATION This chapter describes in detail the various modules which comprise TSB and the communication which takes place between these modules. Appendix B is a core map of the system. modules are distributed throughout core. It shows how the Since almost all communi­ cation is carried out in tables, a description of the format and function of important TSB tables is given. Finally, organization of the system and user/library discs is discussed, since most TSB tables are disc resident. TSB SYSTEM MODULES Time-share BASIC is written in several independent modules which link together through core and disc resident tables and through system linkage variables in core. This section describes the various system modules, defines their function, and lists linkage rules for communication with other modules. are given in Appendix B. Core locations for these modules Ten modules will be discussed: (I) base page, (2) power fail processor, (3) input/output buffers, (4) BASIC ; language processor, (5) disc criver, (6) system console driver, (7) multiplexor driver, (8) clock driver, (9) scheduler, and (10) system ■ library overlay programs. 28 Base Page. The first 1024 words of memory are directly addressable by instructions located in any other part of memory. For this reason, most system links are located on base page. Memory locations below IOOg contain interrupt linkages to input/output processing routines and general temporary storage locations used by various programs. The system equipment table starts at address IOOg and constitutes the core resident information about the system. Immediately following the equipment table are system status variables and input/output driver temporaries. Some of these linkages are bit flags, each bit in the word referring to a single port or channel on the system. Figure 5 gives an example of an arbitrary bit-flag word. 15 14 13 12 11 IO 9 8 7 6 5 4 3 2 I O I "O" associated with channel 15 "I" associated with channel I' Figure 5. Bit-Flag Representation From figure 5 it can be seen that a value of "0" or "I" may be associated with a particular channel by setting the bit in the word 29 to the appropriate state. A test of the state of the bit is used to determine whether or not a specific condition exists on a partic­ ular port. Table 2 lists base page links, defines whether they are word or bit flags, and describes their function. The remaining words on base page not contained in user area are linkages to numerous subroutines located throughout memory and general use constants shared by various routines. The user swap area begins at approximately I300g. The first four words are used to save run-time variables when the user is swapped out of core to the disc. These four locations store the A-register, B-register, Extend bit, Overflow bit, and Program counter when the user's program time-slice is exhausted. The next block of memory stores subroutine return addresses of the interrupted program. General usage information follows. The first word of available program space in the user's swap area is approximately 1774g. Power fail processor. If the computer is running when a power failure occurs, control passes to the power fail processor which saves the current machine and input/output system status. to indicate that this status has actually been saved. A flag is set The program then halts the computer. When power is restored, the flag is checked to determine whether or not the power up process can be started. When sufficient power 30 TABLE 2. BASE PAGE LINKS NAME TYPE COMMENTS MAIN Word Points to word 0 of the teletype table of user program currently in core. If none present, MAIN = 0. LIB Word Points to the location in the command table of the disc address of the library routine in core. LIB = 0 when none is present. PLEX Bit Bit = I, port is full duplex. UNABT Bit Bit = I, no abort allowed. ABTRY Bit Bit = I, abort attempted. ENDSK Word 0 if disc not busy. TIMER Word I when current program is timed. MPCOM Bit Bit = I for multiplexor message to scheduler. IOTOG Bit Bit = I for input; 0 = output. TAPER Bit Bit = I for channel in TAPE mode. CHNRG Bit Bit = I for CHAIN running. HRLAG Bit Bit = I for $HELL0 running. TERR Bit Bit = I if error occurred while reading tape. CRLAG Bit Bit - I if program is in compiled mode. PHM Bit Bit = I if carriage return received. PHT Bit Phones are timing when bit = I. PHR Word Number of seconds allowed to log on system. 0 = half duplex. 31 returns, the program restarts the computer using the saved system status. This insures that BASIC will be restored to the same opera­ ting state as existed prior to the power failure. Input/Output buffers. Each channel on the time share system has a 50 word (100 character) input/output buffer for communication between the multiplexor and T S B . Each of these is a "circular" buffer, having a physical start and end address, and a logical start and end address. The time share system always communicates directly with these buffers. Output operations merely place characters in the appropriate slot in the buffer. buffer. Input retrieves a character from the Figure 6 shows the three cases which are allowed to exist within the I/O buffers. In each of the three cases shown in Figure 6, the variable BGIN is a fixed value pointing to the start address of the user's physical buffer. BEND is the name of a variable pointing to the first character following the physical buffer. value equal to BGIN+50. It is a constant While in input mode, BPNT points to the character location into which the next character will be deposited. During output, it points to the location of the character currently being transmitted. BSTR points to the first character of the most recent buffer during input. On output, it points to the location into which the next character will be deposited. during input. buffer. BHED is used only It points to the first character in the first logical 32 BGIN BEND Current Line BSTR=BHEd BPNT (A) Channel in normal input mode. Line 2 (cont.) Line 3 Line I t t BSTR Line 2 I BPNT (B) Channel in TAPE mode. BHED User has been Queued. Character being output Current Line BPNT BSTR (C) Channel in output mode. Figure 6. I/O Buffer States 33 BASIC language processor. The BASIC language processor of WTC-IOOOD TSB is essentially the same as that for HP2000B. This is a completely re-entrant program which is responsible for syntax checking, program compilation and decompilation, and for execution of BASIC programs. A complete BASIC processor description is beyond the scope of this thesis. Complete documentation of the HP2000B processor may be obtained directly from Hewlett Packard Company.^ Disc driver. The TSB disc driver is responsible for all data transfer to and from the system discs. Any module of the system may call the disc driver to perform a disc transfer. are required for each disc transfer. Three parameters The first is the disc address in the A-register given in standard format as shown in Figure 7. The.disc address word is interpreted automatically by the disc driver. The driver determines how bits 15 and 14 are to be decoded depending on which disc drive is being used with the system. The second parameter passed to the disc driver is the core address from which data is to be read or into which data is to be written. This parameter is passed in the B-register. set to one for a read from disc to core. Bit 15 is Bit 15 is zero for a trans­ fer from core to disc. Crandall, Ron, and McEvoy, Dennis, 2000B Time Shared BASIC Internal Maintenance Specifications, pp. 171-226. 34 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 v D D-field \r Cylinder Sector (HP7900 disc drive) Bit 15 = drive number (0-1). Bit 14 = 0 for cartridge disc within drive. Bit 14 = I for fixed disc within drive. D-field (HP7901 disc drive) Bits 15-14 = drive number (0-3). Cylinder (HP7900 and HP7901) Bits 13-6 = track number (0-202). Sector (HP7900 and HP7901) Bits 5-0 = sector number (0-47). Figure 7« Disc Address Word 35 The third parameter is the number of words of data to be trans­ ferred. This value is given as a negative number in the base page link entry WORD. Upon initiation of a disc transfer, the variable ENDSK is set to one. It is cleared by the disc driver upon completion of data transfer. This value is tested by each module prior to performing a disc transfer to insure that the disc is available for use. System console driver. The operation of the system console driver is determined by two flags located on base page, T35F1 and T35F2. Table 3 describes the operation of the console as signified by these flags. TABLE 3. T35F1 STATE T35F2 STATE 0 0 0 -I -I 0 -I -I SYSTEM CONSOLE STATES CONSOLE DRIVER OPERATING MODE Driver is accepting input (normal state). I) input command received and being processed, or 2) output terminated from a system command which is to be reinitiated. Normal output occuring. Outputting, at the end of which the current system command will be reinitiated. 36 The console driver is always in the input wait mode unless processing a command or printing. System modules may call this driver by placing the number of characters to be printed in the Aregister with bit 15=0 if a carriage return/linefeed is to be appended. The B-register is set to the core address of the output buffer. If bit 15=1 in the core address word, punching will occur in addition to printing. Multiplexor driver. The multiplexor driver is responsible for handling data communication between the user terminals and the input/ output buffers. Communication with up to 16 terminals is handled by the WTC-200B hardware multiplexor. Complete programming specifications may be found in the WTC-200B reference manual ? Output to the multiplexor driver is performed on a character by character basis using the output a character subroutine OUTCH. The character to be output is placed in bits 6-0 of the A-register. The address of word 0 of the user's teletype table is placed in the B-register. Data is then transferred using a JSB OUTCH5I instruction. The OUTCH subroutine places characters into a user's buffer until it is filled (99 characters), at which point the user is suspended. Since BASIC is fully re-entrant, this poses no problems 7 7 Western Telecomputing Corporations, Instruction Manual for the WTC-200B Communication Multiplexor, pp.,48. 37 for that module. Other modules of the system are not allowed to suspend a user since they are not re-entrant. These modules must wait until the buffer is empty before they attempt to output data to any channel. Furthermore, they must never let OUTCH suspend their operation. Most of these routines typically only partially fill the user's output buffer then call a special suspension routine which saves the current run-status. Input from a user channel is allowed only when the user is in idle or input.status, or while entering a program under TAPE control. Upon completion of input (carriage return received) a test is made to determine if the channel is in TAPE mode. If it is, the appropriate MPCOM bit is set to indicate to the scheduler that input is ready for processing. If not, a bit in PHM is set which causes the clock driver to set the appropriate MPCOM bit 200 milliseconds later. This prevents the teletype from getting out of synchronism with the multiplexor driver. The scheduler will initiate the appropriate action upon detecting the MPCOM bit as being set. While a program is running and not printing data, the port is set to the idle mode during which input is allowed to occur. If the "BREAK" key is pressed for at least 1/10 of a second, the multi­ plexor driver will set an abort request condition to stop the pro­ gram. While a program is printing, the port is set to the full duplex mode. This allows data to be input even while data is being 38 output to that channel. Pressing the "BREAK" key during output will also set the abort condition. The multiplexor driver recognizes when an abort attempt has been requested. abort is allowed. It checks the port's status to determine if an If the user is running a library program other than Library or Catalog, the abort attempt is ignored since the routine may be in the process of updating system tables. At other times when aborting could cause loss of system information, the port's UNABT bit is set. When an attempt to abort is made, the driver will not set the stop condition but will set a bit in ABTRY. Routines which set UNABT always call ABCHK when aborts will no longer cause any problems. ABCHK tests ABTRY and aborts the user if the channel's bit was set. Clock driver. The clock driver is the central point through which control is passed to the scheduler. Entry comes to the driver whenever the clock (real time scalar) interrupts. every 100 milliseconds. This event occurs Besides giving control to the scheduler, the clock driver also performs the following tasks: During normal system operations, the console teletype motor is turned off. Logging operations and user messages automatically turn the motor on and set up a two second delay to allow the motor time to reach operating speed. The clock driver is responsible for initiating output on the system console after the two seconds.has elapsed. 39 When a user terminal is in the input mode and receives a carriage return, the. multiplexor driver sets up a 200 millisecond delay. The clock driver tests each channel for this condition and sets the port's MPCOM bit after the delay has timed out. The clock driver also keeps the BASIC time of day clock. This is a real-time clock which keeps track of second of day, hour of day, day of year, and century. Finally, the clock gives control to the scheduler. Scheduler. The basic philosophy of the TSB scheduling algorithm is to provide short response times for short, interactive jobs at the possible cost of delays in longer running jobs.8 The implemen­ tation of this involves a queue of jobs to be run arranged according to a priority scheme. The queue is a list of from I to 18 entries, each entry pointing to the next entry, and the last entry pointing back to the first. The 18 entries in the queue are the 16 LINK words in the.user teletype table, a LINK word in the console teletype table, and a queue head. At the head of the queue are the locations MLINK, MILNK+1, and MLINK+2. These entries are always on the queue. priority of the queue is stored in MLINK+2. is the last entry in the queue. 8 The It is always 77777g and M L INK+I is the pointer to the first Crandall, and McEvoy, op c i t ., pp. 17-19. 40 entry on the queue. to itself. In the case of an empty queue, MLINK+1 points Each entry on the queue has a priority no greater in value than that of the one it points to. In adding a new entry to the queue, the new entry is placed just ahead of the first entry with a larger priority. Figure 8 gives an example of a queue contain­ ing users one, four, and seven in addition to the system console. Channel number I. TTY01+?LINK ?PLEV Console teletype. T35LK T35PR Channel number 4. TTY04+7LINK ?PLEV Channel number 7. TTY07+7LINK ?PLEV Queue head. MLINK MLINK+1 MLINK+2 Figure 8. 77777 System Queue 41 The scheduler uses the following rules to assign priorities: 1. 2. Job priorities assigned upon initial placement in queue: A. SYNTAX and jobs returning from I/O suspend :0 B. BASIC commands (RUN,LIST,PUNCH) :1 C. DISC Resident commands (GET,SAVE,etc.) :2 Jobs are reassigned priorities as follows: A. Jobs of priority two are reassigned priority zero upon reaching the top of the queue. B. RUN jobs which have exceeded their time sliced are assigned priority four and repositioned in the queue. Each job is assigned a time slice of one second. System Library Overlay Programs. The last 256 words of non­ protected memory (37300g - 37677%) are reserved for execution of system library overlay programs. These are programs which are disc resident and called into memory only when needed to perform a special function, such as log a user on or off the system. These programs read into the overlay area and either run to completion or self suspension during output. Parameters required to restart the overlay program are saved in the user's work area. These programs use the user swap area of 4500 words as a system routine work area. are built and modified in this area by the overlay programs. Tables Table 4 lists the system overlay programs and describes their functions. 42 TABLE 4. NAME SYSTEM LIBRARY OVERLAY PROGRAMS DESCRIPTION FUSS Table Table indicating files usage by the users. FILES Processes FILES statements in user programs. CHAIN Processes CHAIN statement syntax. CHAIN.overlay Executes CHAIN statement. ASSIGN Processes ASSIG statement syntax. ASSIGN overlay Executes ASSIGN statement. SAVE Stores a program in the user library. CSAVE Stores a program in semi-compiled form. SUPERSAVE Called by SAVE, CSA V E , and OPEN to redistredistribute the disc directory on a full disc to gain disc space. GET Retrieves a program from the library. APPEND Adds a program from the disc onto a program in user area. HELLO Logs a user on the system. BYE Logs a user off the system. KILL Removes a program or file from the library. RENUMBER Reassigns the sequence numbers of a user program. NAME Gives a program a name. CATALOG Prints the names and lengths of all programs and files in the user's library. 43 TABLE 4 NAME (Continued) DESCRIPTION LIBRARY Prints the names and length of all programs and files in the public library. WIDTH Assign terminal print length from 20 to 132 columns. DELETE Deletes sections of a user's program. TIME Prints a listing of terminal time used since log on, and total time used for the account. DISC Prints a listing of disc space used to date, and total disc space allowed for the account. MESSAGE Sends a one line message from the user terminal to the operator's console. PROTECT Used by AOOO to make programs read-only. UNPROTECT Allows full access to a previously protected program. (A000 only). OPEN Creates a data file of the length specified by the user. LENGTH Prints the length (in words) of the user's program ECHO Sets a terminal to full or half duplex. REPORT Prints a report of all user accounts, giving total connect time and disc space used. DIRECTORY Prints a report of programs and files on the TSB discs. STATUS Prints a report describing where TSB tables are stored. 44 TABLE 4 NAME (Continued) DESCRIPTION ROSTER Produces a listing indicating active ports on TSB. DATjE Changes the status of TSB's real time clock. RESET Resets terminal connect times to a specified value. CHANGE Changes parameters in user ID table. SLEEP Initiates a systematic shutdown of the TSB system. NEWID Adds an account to T S B . KILLID Removes an account from TSB. MOVE Moves a program or file from one disc subchannel to another. PURGE Removes programs and files from TSB which haven't been referenced since a specified date. PHONES Enables/disables the phone logic. FORMAT Formats a user disc. COPY Copies one disc subchannel to another disc sub­ channel . DISC Adds a new disc subchannel to TSB or removes a disc subchannel from T S B . ERROR TABLES Six overlay programs containing error message text. 45 TSB SYSTEM TABLES System tables provide the cohesive framework that holds system operation together. This section describes the function and organ­ ization of five system tables: (I) user ID tables, (2) directory, (3) disc availability table, (4) files usage table, and (5) command table. ID Table. The ID table (IDT) is a disc resident table which contains one 8 -word entry for each user ID code in the system. entries are kept sorted according to the ID codes. the first code, Z999 the last. AOOO would be Each entry has the form shown in Table 5. TABLE 5. WORD 0 1-3 ID CODE ENTRY FORMAT CONTENTS User ID code. PASSWORD. 4 Time allowed in minutes. 5 Connect time used to date. 6 Disc allowed in sectors. 7 D i s c u se d t o d ate . The 46 The user ID is the internal representation of the user iden­ tification code such as AGIO. Bits 14 through 10 identify the ID letter ( A = I, B = 2, . . . , Z = 32g) and bits 9 through 0 identify the ID number (0-999). Password is a one to six character string. are appended if less than six characters long. is given in minutes. Zeros Time allowed and used Disc allowed and used is given in sectors. Words four through seven are 16-bit integers in the range 0 to 65535. The following two words, located on base page, refer to the IDT: IDLOC = disc address of IDT. IDLEN = length in words of IDT. Directory. The directory is a table which contains all necessary information about each program or file in the system library. are two directories on each disc. There A directory entry consists of eight words and has the format shown in Figure 9. Word O I 2 Contents User ID Code Program Comments Bit 15=1 if protected Bit 15=1 if entry is a file 5 6 or File Name Bit 15=1 if semi-compiled Start of program ptr. Starting core address Date Date entry last referenced Disc address 7 -length in words 3 4 F i g u r e 9. D i r e c t o r y E n t r y Format 47 The user ID is the system representation of the user ID code in the same format as in IDT. Words one through three are the name of the program or file in ASCII characters, packed two characters per word. If fewer than six letters, spaces (40g) are appended. The start of program pointer is used when "Getting" programs to tell where in core to start reading in the program. COMMON data to be passed between programs. It is used to allow Date is the day-of-year and year the program or file was last accessed. It is used by the PURGE command to remove infrequently used programs and files from the system. The disc address in standard disc format and program length are given for system access to the entry. Entries are made in the directory alphabetically according to words zero through three. There are two pseudo entries in the directory table to denote the beginning and end of the directory. They have the form as shown in Figure 10. O I 2 3 4 O O O O O O I 2 177777 177777 177777 First 3 Entry 177777 O 5 6 177777 O 4 5 6 7 O 7 Fi g u r e 10. Last Entry 177777 O O Directory Pseudo-Entries 48 A core resident table called DIREC exists on base page. contains information about the disc directories. It Its structure has the form shown in Table 6. TABLE 6. BASE PAGE DIREC FORMAT Word 0 1-4 Contents -length in words of first directory track. Same as first four words of first disc directory track. 5 Unused. 6 Disc address of first directory track. 7-13 Same as 0-6 but applied to second directory track. 14-20 Same as 0-6 but applied to third directory track. 21-27 Same as 0-6 but applied to fourth directory track. 28-34 Same as 0-6 but applied to fifth directory track. 35-41 Same as 0-6 but applied to sixth directory track. 42-48 Same, as track. 0-6 but applied to seventh directory . 49-55 Same as .0-6 but applied to eighth directory track. y 49 A disc address of zero implies that there is no such directory track. When word 0 is zero, words 1-4 are meaningless. DIREC values are assigned values as given in Table 7. TABLE 7. DIREC VALUES Contents Word 0-13 Directory information for disc subchannel 0. 14-27 Directory information for disc subchannel I. 28-41 Directory information for disc subchannel 2. 42-55 Directory information for disc subchannel 3. Disc Availability Table. The available disc table (ADT) is a disc resident table which contains one two-word entry for each area of the disc which is unallocated. Figure 11 shows the format of an ADT entry and the terminating pseudo entry. O Disc address O I- Length of Area 1 ADT Entry Figure' 11. 177777 O Terminating ADT Entry ADT E n t r y Format 50 ADT entries are sorted according to word. zero. Entries are originally set one for each track available on the disc with word s one set to the maximum number of sectors on that track. As programs .are stored on the discs, the ADT is searched for the first entry containing sufficient disc storage space. After the program has ‘ been stored, the ADT entry sector count will be decreased by the amount used. A length of zero sectors indicates a track has been filled and is no longer available for program storage. As programs and files are removed from the system, the released area is added, back to the ADT. Two ADT entries containing disc space released in adjacent areas will be combined to form a single ADT entry. Besides the entries for unallocated areas, there are ADT entries for each of the two loader tracks, five TSB system tracks, 16 user tracks, IDT track, ADT track, and two disc directory tracks. Word one of each of these entries is set to zero so they will not be allocated for program storage. In addition, during the loading process, all defective tracks are removed from the ADT. The ter­ minating ADT entry as shown, in Figure 11 denotes the end of the table. Since track zero is always allocated as a system track, any possible disc address is guaranteed to be bounded by two ADJ entries. The following two words on base page refer to the ADT: ADLOC = disc address of ADT. ADLEN = -length of ADT in words. 51 Files Usage Table. The files usage table (FUSS) is a disc resident table used to control access of files by multiple users. is divided vinto 16 subtables of 16 words per user. It Each subtable lists the disc addresses of files currently being accessed by the corresponding user. FUSS is essential for preventing simultaneous write access by two users of the same file, except for privileged and semi-privileged users, and for preventing Killing a file when a user has access to it. capability. The first user to access a file obtains write All subsequent, but simultaneous, users get read-only access except for users AOOO through A999 who always get read-write access. A user's FUSS table entries are set by the FILES and ASSIGN routines. These are both called from BASIC programs. FUSS entries are cleared by BYE, HELLO, KILLID, and sometimes by KILL. The disc address of FUSS may be obtained by the instruction: LDA FUSS,I Command Table. The command table (COMTABLE) is a list of all user and system operator commands, containing their ASCII codings and core or disc addresses. Table 8. The structure of COMTABLE is defined in 52 TABLE 8. Section Label COMTABLE FORMAT Description COMl Codes for commands which are executed immediately by the system. COM2 Codes for commands which are executed by BASIC. COM3 User commands which are executed by disc resident programs. COM4 System commands, all of which are executed by disc resident programs.. C0M5 Core starting addresses for those commands which are listed under COM! and COM2. C0M6 Disc addresses for those commands listed under COM3 and COM4. These addresses are filled in by the TSB Loader. Each command in COMTABLE is recognized by the subroutine SCOM (search for command) only by its first three letters. This search routine takes the first three letters of any line input without a statement number and converts each letter into a number from 0 to 31g, and then packs the three numbers into one word as three five bit bytes. An example of HELLO is given in Figure 12. 53 Letter: ASCII Offset H HO 101 E L 105 101 114 101 7 4 13 L X E L 7 4 15 14 13 12 11 10 O I X = ignored difference H O O X I I Figure 12. I 6 9 O 8 O 7 I 2 13 6 $ 4 3 2 1 0 O O I O I I O I 3 COMTABLE Entry Coding Format As shown in Figure 21, the COMTABLE entry for HELLO is 16213g. In addition, all operator commands have bit 15 set to one. This indicates the command is valid only from the system operator console. Some codes in COM2, COM3, and COM4 are set to minus one (all ones). These do not correspond to any possible three letter code. Their function is to generate room in C0M5 and C0M6 for core and disc addresses of routines called indirectly (such as FILES) or for tables (such as FUSS). In the case of CTAPR, the purpose is to generate a 54 status type for printing compiler tape errors without a direct command from the user. DISC ORGANIZATION 1000D BASIC is designed to operate on either the HP7900A disc drive or the HP7901A disc drive. TSB can operate up to two HP7900A drives or four HP7901A disc drives. for the same amount of total disc space. specified during system loading. Either system provides The disc drive type is This section describes format of the HP7900 disc system, format of the HP7901 disc drive, system disc format, and user disc format. HP7900 Disc Format. Two HP7900 disc drives may be used on TSB. Each drive contains a fixed disc and a removable disc. arranged into subchannels from zero to three. Discs are A minimum TSB system would consist of subchannel zero which corresponds to the first re­ movable cartridge in disc drive one as shown in Figure 13. Subchannel O ____ I_____ I Drive I (cartridge) Subchannel I (fixed) Subchannel 2 (cartridge) ____ I____ I Subchannel 3 (fixed) Drive 2 Fi g u r e 13. H P 7 9 0 0 Disc O r g a n i z a t i o n 55 HP7901 Disc Format. Four HP7901 disc drives may be used on TSB, giving exactly the same configuration as exists on TSB with HP7900 disc drives. However, use of HP7901 drives allows greater flexibility in disc handling since all discs are removable cartridges. Figure 14 shows the organization of TSB using HP7901 drives. Subchannel O (cartridge) Drive I I !Subchannel 2 (cartridge) Drive 3 Subchannel I (cartridge) Drive 2 Figure 14. I Drive I Subchannel 3 (cartridge) HP7901 Disc Organization Al I discs are directly interchangeable between 7900 and 7901 disc drives. Discs in subchannels one through three are inter­ changeable and may be run on any other existing subchannel. However, the disc in subchannel zero may only be run in subchannel zero since TSB system and system tables are stored on that subchannel. System Disc Organization. The disc in subchannel zero is referred to as the system disc and must be present on a minimum TSB system. It contains a copy of the TSB system, user swap tracks. 56 and TSB system tables as shown in Table 9. TABLE 9. SYSTEM DISC ORGANIZATION Subchannel 0 TRACK SECTOR 0 0-2 TSB Disc Bootstrap Loader. I 0-23 TSB LOADER. 2 0-47 CORE RESIDENT TSB (Part I). 3 0-47 CORE RESIDENT TSB (Part 2). 4 0-47 DISC RESIDENT TSB (Part I). 5 0-47 DISC RESIDENT TSB (Part 2). 6 0-47 DISC RESIDENT TSB (Part 3). 7 0-35 USER O SWAP TRACK. 8 0-35 USER I SWAP TRACK. 9 0-35 USER 2 SWAP TRACK. 10 0-35 USER 3 SWAP TRACK. 11 0-35 USER 4 SWAP TRACK. 12 0-35 USER 5 SWAP TRACK. 13 0-35 USER 6 SWAP TRACK. 14 0-35 USER 7 SWAP TRACK. 15 0-35 USER 8 SWAP TRACK. 16 0-35 USER 9 SWAP TRACK. CONTENTS 57 TRACK SECTOR 17 0-35 USER 10 SWAP TRACK. 18 0-35 USER 11 SWAP TRACK. 19 0-35 USER 12 SWAP TRACK. 20 0-35 USER 13 SWAP TRACK. 21 0-35 USER 14 SWAP TRACK. 22 0-35 USER 15 SWAP TRACK. 23 0-35 ID TABLE. 24 0-35 AVAILABLE DISC TABLE. 25 0-35 DIRECTORY TRACK I . 26 0-35 DIRECTORY TRACK 2. 0-47 USER AVAILABLE PROGRAM STORAGE. 27-202 CONTENTS User/library Disc Organization. Disc subchannels one through three provide additional disc storage space for library programs and files. These discs are added to or removed from TSB through the DISC-UP and DISC-DN commands respectively. described in Table 10. Subchannel format is 58 TABLE 10. USER/LIBRARY DISC ORGANIZATION Subchannels 1-3 TRACK SECTOR CONTENTS O O DISC LABEL. O I A D T , DIRECTORY I , DIRECTORY 2 LENGTHS. O 2 SUBCHANNEL AVAILABLE DISC TABLE. I 0-35 SUBCHANNEL DIRECTORY I. 2 0-35 SUBCHANNEL DIRECTORY 2. 3-202 0-47 USER AVAILABLE PROGRAM STORAGE. CHAPTER V . UNIQUE FEATURES OF IOOOD BASIC WTC-IOOOD BASIC has four features which distinguish it from HP2000B BASIC. These are: CHAIN statement, (3) (I) ASSIGN statement, (2) FORMAT command, and (4) extended DISC command. This chapter presents the details of these four features. ASSIGN Statement Extremely powerful files manipulation capabilities give BASIC the ability to process large quantities of data. the capability of accessing 16 files at once. Each program has However, for each file named in a FILES statement, the user loses 128 words from his system area. Therefore, for relatively long programs, over 300 statements, four or five files is generally the maximum number which can be referenced. Use of the ASSIGN statement allows a user program to reference a virtually unlimited number of files. It enables a program to assign a new working file to replace a file set up by a FILES statement. Statement format is: S t a te m e m t # ASSIGN F ile Name, F i l e #, R etu rn V a ria b le 60 File Name is the name of a file given as a literal string of up to six characters (seven if first character is "$") enclosed in quotes or a string variable leading to a literal string. ' / in a string variable may not begin with A file name The "$" symbol as a first character indicates a system file. File number is a number of simple variable whose value is between I and 16, indicating the position of the file to be replaced. The return variable is one of the following five values which is returned to the program when ASSIGN is executed. The value returned depends on the outcome of execution: 0 - The file is available for reading.and writing. 1 - The file is available on a read-only basis because it is being accessed by another terminal. For users A000 through A999, a return code of one indicates that the named file is being accessed by another terminal. The file is still available for reading and writing. 2 - The file is available on a read-only basis because it is a system library file. 3 - The requested file does not exist or it is protected and .the user attempting to "ASSIGN" it is not the owner. 4 - The file number in the ASSIGN statement is out of range. It does not correspond to one of the positions reserved by the "FILES" statement. A flow chart of the ASSIGN statement syntax processor is given in Figure 15. The first step is to search the ASSIGN statement for a 61 file name. If the name starts with a dollar sign ($), the reference is to a public library file. This sets a flag indicating that the directory search routine is to perform a search using ID code AOO O . After the name has been found, a test is made to determine if the name is in the form of an alphabetic character followed by a dollar sign. If not, the routine goes to the next section. to a string variable is assumed. table for the string variable. Otherwise, a reference ASSIGN syntax searches the symbol If not found, an error return occurs. If found, the name pointed to by the string variable is packed into the file name buffer. The second step in checking ASSIGN syntax is to search for a file reference number. or a simple variable. file reference.number; or a simple variable. This may be either a one or two digit number If a digit is found, the routine stores the This may be either a one or two digit number If a digit is found, the routine stores the. file number and proceeds to the next section. If a simple variable is found, the symbol table is searched for the variable name. error return occurs if an entry is not found. An Otherwise, the symbol value is loaded, converted to an integer and saved. If the value is not defined, an. error condition occurs. The final step is to search for a return variable. Syntax will only accept a simple variable which has an entry in the symbol table. Any other condition results in an error return. 62 Fi g u r e 15. A S S I G N S y n t a x P r o c e s s i n g F l o w Diagram. 63 Fi g u r e 15. (Continued) 64 ^ File number in xX r a n g e / B DLOOK Search directory for file File found File protected Set return variable to 4 Return to SCHBL Set return variable Iy this user ' Write current file to disc C F i g u r e 16. A S S I G N E x e c u t i o n F l o w Diagram. 65 F i g u r e 16. (Continued) 66 Upon completion of syntax checking, another overlay program is called to execute the ASSIGN statement. Statement execution is shown in Figure 16. ASSIGN processing is responsible for replacing the old file by the new one, setting the return variable to the correct value, and updating the file table for the new file entry. The first step it to test if the file number references a file location given in a FILES statement. If out of range, the return variable is set equal to four and the scheduler is called to set up execution of the next BASIC statement. Prior to returning, ASSIGN execution checks to see if the user has attempted an abort. If so, the user program is stopped. If the file number is in range, DLOOK searches the disc direc­ tories for the entry given in the file name. If no entry can be found, the return variable is set to a value of three and a cell is made to execute the next BASIC statement. If an entry is found, its type is checked to determine whether it is a program or a file. If a program, control returns to the next BASIC statement with the return variable set to three. If the entry is a file, a test is made to determine if it has been protected by a user other than that wishing to ASSIGN it;. If protected, control returns to the next BASIC state­ ment with return variable set to three. If the above tests show the entry to be an unprotected file, the contents of the old file buffer 67 of 128 words are written to the disc. The routine now tests for access to a file in the public library by a user other than A O O O . If so, the value of the return variable is set to two and a flag is set indicating the user is. to be allowed read-only access. The next step is to read in the files usage table (FUSS) and clear the entry to the old file in the user's section. A test is made to determine if the new file is being accessed by another user. If it is, the value of return variable is set to one and the file is flagged as read-only. If the user is ID code AOOO through A999, the return variable is set to one but the file is not flagged as read­ only. The files usage table is updated, written back to the disc, and parameters in the user's program area files table are set to reference the new file. Prior to.terminating ASSIGN execution, a final test is made to determine if the file was flagged as read-only. If not, the return variable value is set to zero, otherwise its value remains unchanged. CHAIN Statement The CHAIN library routine processes, a CHAIN statement in the 68 user's program. It consists of two disc resident routines, one which checks syntax, the other performs CHAIN execution. extended version of that in HP2000B. 1000D CHAIN is an It allows the user program to reference a program through a string variable and supply a starting statement number for the CHAINED program. Figure 17 is a flow chart of CHAIN syntax. CHAIN syntax processing is very similar to the first section' of ASSIGN syntax processing. The first step performed by CHAIN syntax is to dump all current file buffers of 128 words each back to the disc. It then searches for a program name. Names starting with a dollar sign set a flag indicating that a directory search is to be made using ID code A000. If the name consists of a letter followed by a dollar sign, the symbol table is searched for that string variable. If not found, an error message is printed. Otherwise, the name pointed to by the string is set as the program name. A search is made to determine if a starting sequence number has been supplied. This parameter may be either an integer value or a simple variable. If it is given as a number, the value is stored. If it is given as a simple variable, the symbol table is searched for that entry. If no match occurs, an error is printed. Otherwise, the value is loaded, converted to integer format and stored. then calls the CHAIN execution overlay. CHAIN execution. Syntax Figure 18 is a flow chart of 69 CHAIN Load program name First letter / Write file buffers to disc , Error return /Null program name Bad name in CHAIN Set to search AOOO Pack name in buffer Quote found String operator Operator defined Get name from string and put in buffer F i g u r e 17. C H A I N S t a t e m e n t Sy n t a x Processor. I 70 Comma follows x. name Search for simple variable Variable found Value defined Load value of simple variable Digit Get statement number / Bad 'name in CHAIN Valid number Error return Read in CHAIN overlay Figure I?. (Continued) 71 DLOOK Search directory , for \ program / Read I COMMON area SWAP arc Read user program in core Found ABCHK Check for aborts File Read rogram from disc SEMIC Set up pointers for, \ Error return Too big Update DATE in directory / ABCHK Check for aborts Priority=A Remove user and insert in QUEUE Write director ' disc BASIC Move name to user's TTY table j Fi g u r e 18. ^Exit to Scheduler v (SCHl) C H A I N E x e c u t i o n F l o w Chart 72 CHAIN execution searches the disc directories for the named program. An error occurs if the entry cannot be found. entry type is checked. message is printed. Next, the If a file has been referenced, an error Otherwise, the entry is a program and a test is made to determine if it will fit in core. If it won't, an error message is printed. If the entry is a valid program which will fit into available user space, the entry's DATE word in directory is updated and the pro­ gram's name is copied into the user's teletype table. CHAIN execution then reads in the user's base page area, any common area which existed from the previous program, and appends the new program. It then calls the subroutine SEMIC which sets up pointers for BASIC describing the program as being either uncompiled or semicompiled. It also sets the program starting statement number, to indicate where execution is to begin on the new program. A check is made to determine if an abort attempt was made during the last step. If so, the user's program is stopped. Otherwise, the user's timeout clock is cleared, the user is taken off the queue, re­ inserted with a priority of four, and control returned to the scheduler. 73 FORMAT Command Before a disc may be used on the TSB system, it must be placed into proper user/library disc format. Use of the FORMAT command allows the system operator to format a disc for TSB operation. This command initializes the disc data fields, checks for bad tracks, builds an available disc table for the subchannel and sets up directory tracks. Command format is: FORMAT - < SUBCHANNEL NUMBER >, LABEL Subchannel number is the disc subchannel to be formatted. must be an integer value in the range one to three. will cause an error message to be printed. character label for the disc. It Any other number Label is a one to six A flow diagram for FORMAT is given in Figure 19. The first step in processing a FORMAT command is to scan the console input buffer for a disc subchannel number in the range one to three. If not found, an error message is printed. If a valid sub­ channel is read, the next step is to search for a one to six character label. Labels of less than six characters will have the remaining label field filled with spaces. Labels greater than six characters will be truncated to only the first six characters. 74 FORMAT Get subchannel number Valid subchanne Print error message Terminate disc label Set up test pattern Label found Print error message Terminate / Read / in FORMAT overlay- I Fi g u r e 19. F O R M A T C o m m a n d F l o w Chart 75 Test upper 24 sectors j Bad tracks=0 Set disc driver for error return Track Error occurred / Test lower 24 sectors Cannot use thi disc Terminate Error occurred Track is OK Make ADT entry Index to next track Track Figure 19 (Continued) 76 Restore disc driver to normal mode Write dummy Directory to ; TR I SEC 0/ Write disc label to TR 0 SEC 0 Print number of bad tracks Write ADT & DIREC length! to j TR 0 SEC I / ' Terminate Write ADT to TR 0 SEC 2 F i g u r e 19. (Continued) 77 The second step is to build a test pattern of 3072 words to be used in locating bad tracks. 3072 words is exactly 24 sectors or one surface of a disc cartridge. After the test pattern has been built, the, FORMAT overlay program is called. The first step of FORMAT overlay is to clear the bad tracks counter and set, the disc driver to return upon detection of an error condition. The main loop initializes the data field of each sector and reads and writes the test pattern on each disc surface. This is a two step process, the top disc surface is checked first, followed by testing of the lower surface of each track or block of 24 sectors. If an error condition occurs, the data field of the bad sector is marked as being defective and a test is made to determine what track the error occurred on. the disc may not be used. If it is track zero, one, or two, FORMAT prints an error message and aborts. If the error occurs on a track other than zero, one, or two, FORMAT skips placing the track number in the A D T . This prevents BASIC from accessing bad tracks. Tracks which are free from errors have their disc addresses added to the subchannel available disc table. Disc addresses are base addresses; they contain no subchannel information. After an entry is placed in the A D T , the routine initializes and checks the next disc track. After all 203 disc tracks have been checked the.disc driver 78 is restored to its normal operating m o d e . The disc label is written to track zero, sector zero in the form: LBTSXXXXXX wh e r e : LB => DISC label follows. TS => Time-Shared BASIC disc. XXXXXX = One to six character disc label. The negative lengths of the ADT and subchannel directories are written to track zero, sector one. sector two. The ADT is written to track zero, A dummy directory is written to track one, sector zero. FORMAT terminates by printing the number of bad tracks found during the initialization process. The formatted disc may now be used on I the TSB system. DISC Command DISC subchannels one through three are used to provide additional disc storage, for user/library programs and files. An initial TSB configuration consists of only subchannel zero, the system disc. This is the state of TSB following initial system generation, system update, or restart from SLEEP. Additional disc subchannels must be added to 79 TSB through the DISC-UP command. Disc subchannels, except subchannel zero, are removed from TSB using the DISC-DN command. User/library discs are interchangeable among subchannels one through three, and between a TSB system operating with HP7900 disc drives and one with HP7901 disc drives. This section describes the operation of the DISC-UP and DISC-DN commands. DISC-UP Command. The.DISC-UP command is used by the system operator to inform TSB that a new disc subchannel is to be added to the system. Command format is: DISC-UP, <subchannel number> Subchannel number is an integer in the range one to three, referencing the disc to be added to the system. DISC-UP is given in Figure 20. A flow diagram of . 80 Get disc subchannel number DISC-UP Print error message Valid x subchannel Terminate Compute BASE PAGE DIREC for subchannel Disc already Read disc label / Print Wd i s c on / system Terminate Read disc label disc Read in DISC-UP overlay F i g u r e 20. Read in ADT & DIREC lengths Terminate DISC-UP Command Flow Diagram 81 Add subchannel bits. Update System ADT Read in disc ADT I Set BASE PAGE DIREC for subchannel Lead in disc directory / --- f one Add subchannel bits f Add subchannel bits \I Write back directory two < Read in disc directory I two Print disc on system. Print disc label Fig u r e 20. (Continued) Write back directory one Terminate 82 The first step in DISC-UP processing is to search for and isolate the subchannel number. Bad input or any value not in the range one to three will cause an error message to be printed. The next step is to compute the location of the disc subchannel's base page entry in DIREC. If the first word in BP DIREC is nonzero, the disc is already up. An error message along with the label of the disc in that subchannel will be printed. If the first word in BP DIREC is zero, the disc label field is read. The third and fourth characters in the label field must be "TS", indicating it is a time share disc. If not, an error message is printed indicating the disc is not a time share disc and may not be used. If the disc is a time share disc, the label is saved and the lengths of the disc subchannel ADT and directory tracks are read. The next step is to read the system ADT into core and find where to insert the new subchannel ADT. If an ADT overflow occurs, entries from the new disc subchannel ADT are removed until the combined ADT will fit in core. Subchannel bits are added to the ADT entries from the new disc and these entries are merged into the system ADT at the correct location. The updated system ADT is then written back to the system disc. After updating ADT, DISC-UP updates the base page DIREC entries to point to the new disc subchannel. It then adds subchannel bits to all entries on the subchannel's two directory tracks. 83 DISC-UP terminates by printing the subchannel number and its disc label on the operator console. DISC-PN Command. Disc subchannels are removed from TSB by using the DISC-DN command. Command format is the same as DISC-UP. A flow diagram of DISC-DN is given in Figure 21. DISC-DN processing is essentially a reversal of DISC-UP processing. The first step is to isolate the disc subchannel and test if it is already off the system. If the subchannel has not been removed from T S B , a test is made to determine if any user is currently accessing files on that subchannel. If files are in use, an error message is printed and the disc is not removed. If no files are in use, the system ADT is read into core and scanned for entries referring to the disc to be brought down. These entries are removed from the system ADT and placed in a temporary A D T . The system ADT is written back to the system disc. Subchannel information is removed from all entries in the temporary ADT and this table is written onto the disc subchannel being brought down. The two subchannel disc directories are processed by DISC-DN to remove subchannel references. Base page DIREC is cleared for the downed disc and a message is printed on the system console to indicate the subchannel has been removed from T S B . 84 Get disc subchannel / C ( \ DISC-DN Print error 7 message - V Terminate Compute BASE PAGE DIREC for subchannel Disc already down Read 'in FUSS table Read in System ADT Figure 21. D I S C - D N C o m m a n d Flow Diagram. 85 Remove ADT entries for this disc Write disc DIREC one back Write System ADT to disc Read in disc DIREC two Remove subchannel bits from disc ADT Remove subchannel bits Write subchannel ADT back to disc Write disc DIREC two back Read in disc DIREC one Print disc removed from system j Remove subchannel bits Terminate F i g u r e 21. (Continued) CHAPTER V I SUMMARY AND RECOMMENDATIONS . SUMMARY This thesis has described IOOOD BASIC as one solution in an attempt to provide low cost computer services for both commercial arid educational users. Chapter I presented background material on the historic development of time sharing techniques. It described why Western Telecomputing Corporation initiated the project of developing its own time share BASIC system. Chapter 2 defined many of the terms used in describing time share operation. It presented a description of essential.operating system requirements, placing emphasis on hardware capabilities and the restrictions which they imposed on TSB design. Chapter 3 defined TSB from two operating viewpoints. first part described TSB from the user's viewpoint. The It described how the system software capabilities appear to the user. The second part was a TSB description from the operator's point of view. Chapter 4 was a detailed presentation of TSB system modules and overall system organization. major TSB modules. The first part outlined each of the It defined their purpose, structure, and 87 communication with other modules. The second part gave specific information about TSB system table organization. Structure of the tables was said to be the defining framework around which all modules of TSB were written. Finally, the chapter discussed how the system and tables were organized on the discs. . BASIC. Chapter 5 discussed in detail four unique features of IOOOD These were the ASSIGN statement, extended CHAIN statement, FORMAT command, and DISC command. Each of these features were added to TSB either to enhance system operation or provide useful additions to the BASIC language processor. RECOMMENDATIONS Although WTC-I000D BASIC meets all the design specifications and performance requirements as outlined in the previous chapters, one design consideration has been purposely avoided. This deals with the problems of error detection and correction by the system. This is a problem which warrants further study. In the design of I000D, it was assumed that if the hardware was functioning properly, the software should be designed in such a way that no errors would ever occur. system which can have no errors. This implies a software Unfortunately, the time share software is an extremely complex program and its operation is entirely random, dependent upon the operations taking place at each 88 of the 16 terminals. Thus, the programmer cannot guarantee that the program is capable of handling the infinite number of special cases which might occur at any time during normal operation. Furthermore, BASIC has been written so that every instruction must be correctly decoded and executed by the computer and that all data transfer must take place without loss of even a single bit. Only very slight attempts at error correction have been made. For example, if the disc drive recognizes it has made a data error, it signals the computer and an attempt will be. made to perform the transfer an additional ten times. BASIC stops. If it fails all these transfers, No provisions are made to lock out the bad data track after system initialization. Thus, to insure system reliability the following provisions should be added to BASIC. an error. First, attempt to establish what constitutes Upon doing so, set up a system of error severity levels. This should be based upon the consequences each error may incur upon the system. Next, devise a scheme to attempt an orderly recovery from the error. For example, if an attempt to store data on a section of the disc fails, flag that section as being defective and attempt to write to another section of the disc. Finally, an algorithm should be devised so that if. an error occurs which causes system operation to stop, a recovery of the system is possible without loss of previous data. BIBLIOGRAPHY 90 BIBLIOGRAPHY Crandall, R o n , and McEvoy, Dennis, 2000B Time Shared BASIC Internal Maintenance Specifications, Hewlett Packard Company, Cupertino Division, California, 1971, 226 pp. Instruction Manual for the MTC-200 Communication Multiplexor, Western Telecomputing Corporation, Bozeman, Montana, 1973, 48 pp. Kampe, Thomas W., "The Design of a General Purpose Microprogram Controlled Computer with Elementary Structure", in Computer Structures: Readings and Examples, pp. 341-347, compiled by C. Gordon Bell and Allen Newell, McGraw-Hill, New York, 1971. Kemeney, John. G., and Kurtz, Thomas E., BASIC Programming, John Wiley & Sons, Inc., New York, 1968, 122 pp. I POOP: Operator's Guide, Western Telecomputing Corporation, Bozeman, Montana, 1974 I POOD: User's Guide, Western Telecomputing Corporation, Bozeman, MT 2000B: A Guide to Time Shared BASIC, Hewlett Packard Company, Software Publications, Cupertino Division, California, 1970. 2000B: Operator's Guide to Time Shared BASIC, Hewlett Packard Company, Software Publications, Cupertino Division, California, 1970 Walsh, Larry, 2000C Course Notes, Hewlett Packard Company, Cupertino Division, California, 1971, 420 pp. APPENDIX APPENDIX A HARDWARE REQUIREMENTS IOOOD BASIC system consists of a Hewlett Packard 2100 series computer, a moving head disc mass storage device, an operator's console, a paper tape reader, a user input/output processor, and a supervisory software program. Figure 22 shows the logical organi­ zation of the system. user terminal operator console up to 16 user terminals or data sets user terminal Figure 22. HP 2100 Series Computer Disc Storage user I/O Interface Paper tape reader WTC-1000D System Configuration. .93 The system computer controls the allocation of resources amont the users. It controls the execution of user programs, operations of the mass storage devices, communication between the system operator and T S B , and communication between the system and users through the I/O processor. Table 11 lists the hardware re­ quirements for the system computer. Table 12 lists the computer input/output configuration. TABLE 11. HP2100 Series Computer Requirements 1. 16K words of main memory. 2. 2 channels of direct memory access (DMA). 3. Extended arithmetic unit (EAU). 4. Power fail/Auto restart. 5. Memory parity check. 6 . Computer controlled clock (Time-base generator). 7. Paper tape reader and interface. 8 . Moving-head disc memory. 9. a. HP7900A b. HP7901A Operator console and interface. 10. User I/O processor and interface. 11. Up to 16 user terminals or data sets. 94 TABLE 12. Hardware Configuration I/O CHANNEL CONTENTS Disc Interface IO-Il8 WTC-2OOB Multiplexor. 12S IS8 Computer Controlled Clock Paper Tape Reader . 14S Operator's Console 15S The moving-head disc storage device is used for storage of the TSB system, public library, and user files and programs. drive is required for the basic configuration. One disc Optionally, one additional HP7900 or three HP7901 disc drives may be added, to the System. . The operator communicates with the TSB system through the operator console. From this console the operator is able to start T S B , add new accounts to the systemi, modify existing accounts, and remove accounts from T S B . The operator may use the console to generate reports on TSB system utilization, add or remove disc storage, and systematically shut down the system. The system console is also used to keep a running listing of all user logging activity. The main communication between the users and TSB is handled over the user I/O interface system. User communication is processed 95 by the WTC-200B Communications Multiplexor. This device is capable of processing up to 16 simultaneous user terminals. The paper tape reader is used to load the initial system or system update tape into the computer by the TSB loader program. It is also used to read in the TSB bootstrap loader during system restart. APPENDIX B : IOOOD BASIC CORE MAP BEGINNING OCTAL CORE LOCATION CONTENTS O 23 100 243 272 A, B registers and I/O interrupt locations System temporary storage Core resident information about disc tables System status variables Multiplexor driver temporaries 307 435 622 . System linkage variables General use constants Language processor constants and addresses 1152 ' Error jump table 1305 1311 1605 1626 . Beginning of user swap area Subroutine return addresses General usage Syntax, compile, and execution information temporaries 12112 user input/output buffers 13324 14000 Power fail/restart processor Statement syntac processors ' 14066 LET statement syntax 14111 14112 DIM statement syntax COM statement syntax 14133 14173 ■ DEF statement syntax FILES statement syntax 14173 14173 14174 14200 CHAIN statement syntax ■ ASSIGN statement syntax REM statement syntax GOTO and GOSUB statement syntax 97 BEGINNING OCTAL CORE LOCATION H2L7 14317 14356 14362 14366 IF statement syntax FOR statement syntax NEXT statement syntax RETURN, END, and STOP statement syntax DATA statement syntax . 14430 . READ statement syntax 14440 14452 INPUT statement syntax . PRINT statement syntax MAT statement syntax Formula syntax checker 14557 15000 15436 16553 20614 22000 22341 23676 24322 24641 25252 26072 27432 30160 31362 ' 32011 32257 32502 32720 33417 34157 CONTENTS •Syntax subroutines Compilation and decompilation Main execution loop and execution processors Execution utility programs Formula evaluation routines - Execution utility routines Arithmetic subroutines Error routines List routines Matrix execution Output routines Library functions (SIN, COS, etc.) ASCII to binary number conversion Print name table 7900/7901 DISC driver System console driver Multiplexor driver Teletype tables (Queue) Clock driver 98 BEGINNING OCTAL CODE LOCATION. 34254 Scheduler 35566 35732 Output character routine Command table 36263 Library subroutines Overlay program area 37300 CONTENTS MONTANA STATE UNIVERSITY LIBRARIES CO milill HilIII 111 762 10015/174 7 I N378 Sh 1+1+5 cop.2 Shema, John Sidney Development of time shared basic system processor for Hewlett _______Packard 2100 series.. *IAMC AIMD AOPWKa« u2 -J,u, -dh'A II2.i y*\iar s /6- " SIi ?, c(ien «11(Q 'QL/u /fii** - j“ ^ A'37?