IMD 1.18: 21/01/2023 0:12:47 PRQ-SFT-NBD-5 3RCC PERQ MORE DOCUMENTATION DISTRIBUTION FLOPPY Copyright (C) Three Rivers Computer Corporation, 1981 single density, double sided D.5 Group name Command file DOCUMENTATION.MORE DOC.CMD   between 2 and 36, inclusive. Parameters: X - the integer to be read. F - the file from whic 19 Jul 81 Module RunRead; Abstract: RunRead exports procedures to read and write run files. Design: h X is to be read. Field - the size of the field X is in. B - the base of X. It may be any intege If and when the format of run files is changed, the constant RFileFormat in module Code must be changed. This is r between 2 and 36, inclusive. Errors: PastEof if an attempt is made to read F past thnecessary so that the procedures to read run files will not fail. Exports const RunReadVersion = '1.0'; Importe Eof. NotNumber if non-numeric input is encountered in the file. LargeNumbes Code from Code; Procedure ReadRunFile( var RunFile: RunFileType; Seg: Integer; var Header: RunInfo;r if the number is not in the range -32768..32767. BadBase if the base is not in 2 var FirstSeg, FirstUserSeg, LastSeg: pSegNode; ImportsWanted: Boolean ); Pro..36. - 129 - PERQ Operating System Interface - RS232Baud cedure ReadSegNames( var RunFile: RunFileType; Seg: Integer; FirstUserSeg: pSegNode ); Procedure R 19 Jul 81 Module RS232Baud; Abstract: RS232Baud is used to set the RS232 baud rate with optional ineadRunFile( var RunFile: RunFileType; Seg: Integer; var Header: RunInfo; var Firteger ); Abstract: Reads a string in free or fixed format. If free format is selected, spput enable. Exports Procedure SetBaud(Baud: String; Enable: Boolean); Exception BadBaudRate; Abstract: aces are skipped and characters are read until another space is encountered. Parameters: X Raised if Baud is not a valid baud rate. Procedure SetBaud(Baud: String; Enable: Boolean); Abstract:  - the string to be read. F - the file from which X is to be read. Max - the declared maximum length Sets the baud rate to baud specified by Baud arg. Parameters: Baud - string of new baud rate of the string. Len - the size of the field. Len <= 0 selects free format. Error (e.g. "2400"). Enable - says whether to allow enable RS232 input. Side Effects: s: PastEof if an attempt is made to read F past the Eof. Procedure ReadX( var F: FileType; var X: integer; BChanges status of RS232. Errors: Raises BadBaudRate, if string is illegal. : integer ); Abstract: Reads an integer in free format with base B. B may be any integer - 130 - PERQ Operating System Interface - RunRead  „:Ør[;ièkf[*i¸ Úd9k*K1i`Úd@jô&IiHk56ki[Ìi(rìi``˼)€½Ë€½œ[ÿ¸Ë€½œÿ¸êË€JP¸¼€ê ÁÊϺ ŠZ Ïš:c›Éꜭdå¸cœÛÉêœÛœ4Ï@œœÛP¸Ë has been Reset to the desired file. ReadRunFile does not close the file. Seg - Segment nurts procedures to write run files. Design: If and when the format of run files is changed, the constant RFileFmber for dynamic allocation. Header - The RunInfo record. FirstSeg - Set to point to the first segormat in module Code must be changed. This is necessary so that the procedures to read run files will not fail. Expoment in the run file. FirstUserSeg - Set to point to the first user segment in rts const RunWriteVersion = '1.0'; Imports Code from Code; Procedure WriteRunFile( var RunFile: RunFileType; Header: Ru the run file. LastSeg - Set to point to the last segment in the run file. nInfo; FirstSeg, FirstUserSeg: pSegNode ); Procedure WriteRunFile( var RunFile: RunFileType; Heade ImportsWanted - True if Import entries are to be read from the run file. r: RunInfo; FirstSeg, FirstUserSeg: pSegNode ); Abstract: ReadRunFile writes a r - 131 - PERQ Operating System Interface - RunRead 19 Jul 81 Procedure ReadSegNamun file from a structure that represents that run file. Parameters: RunFile - A files( var RunFile: RunFileType; Seg: Integer; FirstUserSeg: pSegNode ); Abstract: Re variable which has been Rewritten to the desired file. WriteRunFile does *not* close the eadSegNames reads .Seg file names from a run file and adds them to a structure that represents that run file.  file. Header - The RunInfo record. FirstSeg - A pointer to the first segment in the run  Parameters: RunFile - A file variable which has been Reset to the desired file and  file. FirstUserSeg - A pointer to the first user segment in the run file.  already read with ReadRunFile. ReadSegNames does not close the file. Seg - Segment number f - 133 - PERQ Operating System Interface - Screen stSeg, FirstUserSeg, LastSeg: pSegNode; ImportsWanted: Boolean ); Abstract: ReadRuor dynamic allocation. FirstUserSeg - A pointer to the first user segment in the run file. nFile reads a run file and builds a structure that represents that run file. The run file is read up to,  - 132 -  but not including, the names of the .Seg files. Parameters: RunFile - A file variable which  PERQ Operating System Interface - RunWrite 19 Jul 81 Module RunWrite; Abstract: RunWrite expo ¼)€½Ë€½œ[ÿ¸Ë€½œÿ¸êË€JP¸¼€ê ¼c£Éê aΟ£^­Ñ^cæÉê Ϧc£ÉêNÅ_ÁX(Ï ÁX`êÅXc£ÉConsole:É````ê¼c£Éê a ÏVcœÛÉêœÛœ4Ï@œœÛP¸Ë¼)€½Ë€½œ[ÿ¸Ë€½œÿ¸êË€JP¸¼€ê Ì›c› c£ÉÉÿ`ÿ`êc£ÉêÁ_Ï:c›Éêc›Éc› É`êc›Éê › ÿ¸c› É˼)= /På¸cœ9ɺ› ä3ÏÍð› !'ÏÍã› @'Ïc£ÉêNÅ_ÁX(Ï ÁX`êÅXc› É``êc› É˼)"= /På¸cœ9ɺc› ÉcœÉ˼)= /På¸cœ9ɺcœÉê ¼˼3œd¸cœbÉcœbÉêažXŠX'ÏN€½Ë€½œÿ¸œJ``êË€J.CMDä4¼€ÏcœÉË€½º.CMDÿå¸êc£ɜcæÉ````êÀ(ÏÀÅXÁX`êÍÄc› ÉcœÉ˼)= /På¸cœ9ɺcœÉê œ'ÏÍ‘€½Ë€½œÿ¸œJ``êË€J.RUNä4¼€  19 Jul 81 Module Screen; Abstract: Module Screen is the PERQ screen driver. Exports ImpordowP = ^WindowType; {$endc} WindowType = Packed Record {$ifc VarWin then} winNumber: Integer; ts Raster from Raster; Const ScreenVersion = 'V3.9'; VarWin = false; {if true, then can have an arbitr {this window number} {$endc} winBY, winTY, winLX, winRX, ary number of windows and storage for them has to be allocated off a heap. If false then there are 17  { Limits of window area } winHX, winHY, winMX, winMY, - 134 windows max, and storage is in screens global data. NOTE: There are still bugs in VarWin true} Type- PERQ Operating System Interface - Screen 19 Jul 81 { Limits of useabl FontPtr = ^Font; Font = Packed Record { Contains character sets } Height:integer; e area } winCurX, winCurY, winFunc: integer; winKSet: FontPtr;  { Height of the KSet } Base: integer; { distance from top of characters to bas winCrsChr: char; winHasTitle, winCursorOn, defined: boolean; {$ifc VarWin then} e-line } Index: Array [0..#177] of { Index into character patterns } P winNext: WindowP; {$endc} end; {$ifc VarWin then} Const MaxWIndx = 32767; {$elsec} Const acked Record case boolean of true: (Offset: 0..767; { position of character in  MaxWIndx = 17; {$endc} Type WinRange = 0..MaxWIndx; LineStyle = (DrawLine,EraseLine,XorLine); LS = patterns } Line: 0..63; { Line of patterns containing char } String[255]; Procedure ScreenInit; Procedure ScreenReset; Procedure SPutChr(CH:char); Procedure SSetCursor(X,Y: integer);  Width: integer); { Width of the character } false:(Loc:integer; W Procedure SReadCursor(var X,Y: integer); Procedure SCurOn; Procedure SCurOff; Procedure SCurChr(C: char); Procedure SChrFunidd: integer) end; Filler: array[0..1] of integer; Pat: Array [0..0] of ic(F: integer); Procedure SSetSize(Lines: integer; complemented, screenOff: Boolean); Procedure CreateWindow(WIndx: WinRange; nteger; { patterns go here } { We turn off range checking to } { acc OrgX, OrgY, Width, Height: integer; Title: string); Procedure ChangeWindow(WIndxess patterns, hence allowing } { KSets of different sizes } end; {$ifc VarWin then} Win: WinRange); Procedure GetWindowParms(var WIndx: WinRange; var OrgX, OrgY, Width, Height: integer; var ha  Copyright (C) 1981 Three Rivers Computer Corporation 720 Gross Street Pittsburgh, PA 15224 (412) 621-62 CAPITALS literal lowercase or LowerCase metaname 50 PERQ Introductory User Manual 19 Jul 81 This document  ^ control key CR carriage return SHIFT is not to be reproduced in any form or transmitted in whole or in part, without the prior written authorizat shift key | or ion of Three Rivers Computer Corporation. The information in this document is subject to change without not - 1 - PERQ Introductory User Manual - Introduction 19 Jul 81 2. Introductice and should not be construed as a commitment by Three Rivers Computer Corporation. The Company assumes no reion. PERQ is Three Rivers Computer Corporation's personal computer which provides an integrated computing system forsponsibility for any errors that may appear in this document. Three Rivers Computer Corporation will make eve a single user. All PERQs come with the following hardware features: a) 16-bit micro programmed processor b) High-ry effort to keep customers apprised of all documentation changes as quickly as possible. The Reader's Comments card is distrib- uted with this document to request users' critical evalu- ation to assist us in preparing future documentation. PERQ is a trademark of Three Rivers Computer Corporation.  - ii - PERQ Introductory User Manual - Notation Conventions. 19 Jul  PERQ Introductory User Manual Donald A. Scelza 81 1. Preface: Notation Conventions. The notations used below have been clearly and consistently used througho Diana Connan Forgy Brad A. Myers This mut this document. ______ _______ SYMBOL MEANING anual provides an introduction to the use of the Three Rivers Computer Corporation PERQ Computer.  [] optional feature {} 0 to n repetitions  End(x: Integer); Procedure SFullWindow; Const SScreenW = 48; {for use when want Screen in RasterOp or Line} Var  Effects: Changes the char function - 137 - PERQ SScreenP: RasterPtr; {for use when want Screen in RasterOp or Line} SCursorOn: boolean; SFunc: integer; Operating System Interface - Screen 19 Jul 81 Procedure SSetSize(Lines: integer; complemented, screenOf { Raster-op function for SPutChr } Procedure SSetCursor(x,y: integer); Abstract: Moves the cursf: Boolean); Abstract: Change the size of the screen so rest of memory can be used for otsTitle: Boolean); Procedure ChangeTitle(Title: string); Procedure SetFont(NewFont: FontPtr); Function GetFont: FontPtr; Pror to the specified screen position. Parameters: x and y - Screen position where the next character goes. ocedure SClearChar(c: Char; funct: Integer); Procedure Line(Style: LineStyle; X1, Y1, X2, Y2: integer; Origin:  Side Effects: Changes the cur char positions AND sets line to be empty (so BS won't work); RasterPtr); Procedure SBackSpace(c: Char); Procedure RefreshWindow(WIndx: WinRange);  - 136 - PERQ Operating System Interface - Screen 19 J - 135 - PERQ Operating System Interface - Screen 19 Jul 81 Exception WBadSize; {pul 81 Procedure SReadCursor(var x,y:integer); Abstract: Returns the current screen cords for chars. arameter to SSetSize bad} Abstract: Raised if the lines parameter to SSetSize is not a  Parameters: x and y - set to the Screen position where the next character will go. multiple of 128 or is <=0. Also raised if a window is totally below area to release so will disappear then Procedure SCurOn; Abstract: Turns the char cursor on. Side Effects: Changes SC if window # 0 or is the current window, then Raises WBadSize. Exception BadWNum; {inursorOn global variable Procedure SCurOff; Abstract: Turns the char cursor off. Side Effects:dx is invalid} Abstract: Raised if a window number parameter is illegal (not defined o Changes SCursorOn global variable Procedure SCurChr(C: char); Abstract: Set the characr out of range). Exception WTooBig; Abstract: Raised if parameters for new window specify an area thter to be used as the cursor. Side Effects: Changes the cursor character Procedure SChrFunc(F: integeat would extend off screen. Procedure StartLine; Procedure ToggleCursor; Procedure NewLine; Procedure SaveLiner); Abstract: Set the function to be used for drawing chars to the screen. Side ce. Virtual addresses are mapped into a 20-bit physical address. ly a user name and password to be allowed access to the machine. After the operating system has been loaded onto a mach - 2 - PERQ Introductory User Manual - Turning the PERQ on and off19 Jul 81 3. Turine, the names defined are "no user" and "" (press the Carriage Return key). See "User Control" in the Utility Programs Maning the PERQ on and off. The PERQ's power switch is located in the groove in the front panel. Pushing the switch to the nual for instructions on how to add other user names. After you have successfully logged in, the command interpreter, right turns on the PERQ. The fans start; if you do not hear them check to see if the machine is plugged in. If so, check ifShell, will be loaded and you will be able to execute commands. Before turning the PERQ off, you should always log off usin the small neon light in the lower right hand side of the back of the machine is glowing. If the light is out, check the eleg the Bye program. If you just power down, some temporary files on the disk will not be cleaned up. Type: BYE OFF ctrical outlet. If there is power at the outlet or the light is glowing and you still do not hear the fans then call your to log off and turn the power off on the machine automatically. If this is not possible, you can always turn the machine  local service representative. PERQ takes about two minutes to boot after it is turned on allowing the disk to spin up tooff by moving the power switch to the left. See "BYE OFF" in the Utility Programs Manual.  speed. At this point the Diagnostic Display (DDS) reads 999. If the machine still has not booted then try pressing t - 3 - PERQ Introductory User Manual - Control Characters 19 Jul 81 4. Control Characters. The Boot button on the back of the keyboard. If this does not cause the machine to boot, please call your local servicehere are a number of special control characters that are recognized by the PERQ operating system. These control characters areresolution graphics using a 1024 X 768 bit mapped raster display c) Standard keyboard with special function keys  representative. After the PERQ boots, you will be asked to enter the time of day. The time and date is given in the for d) 12-megabyte Winchester technology disk drive e) RS232 & GPIB I/O interfaces f) 256k bytes of main memory g)m: DD MMM YY HH:MM:SS The time notation uses a 24-hour clock. If you were logging in on the Pointing tablet h) Speech output Optional features are: a) 24 megabyte disk b) 4k X 48-bit writable control 27th of March, 1981 at 2:30 in the afternoon you'd type 27 mar 81 14:30:00 The seconds are opt store c) 1 megabyte floppy drive d) Speech input PERQ provides a large, 32-bit, segmented virtual address spaional and the spaces in the date can be replaced by hyphens (27-Mar-81). Next, you will be asked to login. You must supp  if not window # 0 or is the current window, then makes the window undefined. Procedure Scontain CR, LF, or FF. Parameters: Title - new string. Side Effects: Changes title oBackSpace(c: Char); Abstract: Move the cursor back over c; c should not be CR or LF. Parameters: n screen Design: Handles all so that can remake window so doesn't think it is off screen at  curLine - the line displayed; it is not modified. Side Effects: Moves the cursor back thetop. Procedure CreateWindow(WIndx: WinRange; OrgX,OrgY,Width,Height: integer; Title width of the last char of curLine (does not erase char). Procedure SClearChar(c: char; funct: Integer); :string); Abstract: Creates new window for Windx (or overwrites old values for that windo Abstract: Deletes the c from screen; c should not be CR or LF. Parameters: c - char tow) and makes it the current window. Writes title (IN CURRENT FONT) if title <> ''. The title must  be erased. funct - RasterOp function to use in deleting char. It should be RXor if chars a not contain CR, LF, or FF. Parameters: WIndx - index to use for the window created. OrgXher things (if smaller). Parameters: Lines - the number of lines in the displayed part of the re black on white and RXNor if chars are white on black. Side Effects: erases the last  screen. It must be a multiple of 128 and > 0. Complemented describes the off part of the scchar of line; - 138 - PERQ Operating System Interface - Screen reen and screenOff determines whether it is displayed (false) or not; if displayed 19 Jul 81 Procedure SPutChr(CH: Char); Abstract: Write a char into the current window Par, then complemented determines whether it is erased white or black. Errors: If lines aameters: Ch - char to write. If #200 bit is not set, checks to see if char is one of Bell, bad value then Raises WBadSize. If a window is totally below area to release and disa BS, FF, LF, CR and does something special. Side Effects: Writes char to screen, moves ppears then if window # 0 or is the current window, then Raises WBadSize. Side Effects: cursor; may do a NewLine (and scroll) if at the end of the line. Procedure ChangeTitle(Title: string);  Changes the values describing windows. If a window is totally below area to release and disappears then Abstract: Changes the title of the current window (and displays new one). The title must not   - erases the last character typed by the user. OOPS or ^U - erases the last line typed by the user. ^C -  command file and then executes them. It does not distinguish between upper and lower case letters; you can use whichever youtyped once causes a current program to abort the next time that it asks the operating system for input. ^C - typ prefer. The general form of a Shell command line is a command or program name, followed by any number of optional paramed twice causes the current program to abort immediately. ^S - causes program output to the screen to be suspeeters, followed by any number of optional switches. Some of the switches take parameters. Some example command lines fnded. ^Q - allows output to the screen to resume after a ^S. ^SHIFT C - causes a dump of the runtime stack ollow. Compile SourceProgram/Sy:32 would compile a program telling the Pascal compiler to allocate 3and an immediate return to the Shell. If a command file was being executed, it is aborted and control is ret2 symbol table blocks. Compile is the name of the command calls the Pascal compiler. SourcePrograurned to the keyboard. ^SHIFT D - causes a dump of the runtime stack to be printed and the preliminam is the command line parameter. It is the name of the program to be compiled. /Sy:32 is a switch that tells try debugger (called Scrounge) can then be entered. If the debugger is not entered, the original program will rhe compiler to allocate 32 in-memory symbol table blocks. All switches begin with a "/". An example oesume execution. If the debugger is used, the user can request that the program be resumed after investigating f a program that takes a number of parameters on the command line is the Copy program. The form is:  the state. For a more complete description of the debugger, see the "PERQ Utility Pro- grams Manual."  Copy SourceFile DestinationFile An example of a program that takes multiple switches is the Linker. An - 4 - PERQ Introductory User Manual - The Command I example Linker command line is: Link SourceProgram/Verbose/StackSize:1024 When you supply a command line nterpreter 19 Jul 81 5. The Command Interpreter, The Shell. The command interpreter for the PERQ operating systeto the Shell it sees if the first symbol on the line is the name of a file that can be executed (a "run file"). If itm runs as a separate user program. It is possible for the user to replace the command interpreter with his own. The nam is, that program is loaded and run. If the symbol was not the name of a run file then the Shell does a unique substri used to perform simple input line editing and program control. The valid control characters are: BACK SPACE or ^He of the command inter- preter supplied with the system is the Shell. The Shell takes commands from the user terminal or  window and erases its area on screen - 139 - PERQ Operating System Interfaceont Returns: font currently in use Procedure ScreenReset; Abstract: Erases scr - Screen 19 Jul 81 Errors: Raises BadWNum if WIndx invalid Raises WToeen; Removes all window (releases their memory); sets Window 0 to have a boundary but a blank oBig if window would extend off the screen Procedure RefreshWindow(WIndx: WinRange); Abstract: Redraw title Side Effects: Erases or sets all parameters; font set to system font Procedure ScreenInit;s window outline and title area (but not title text) Parameters: Window to refresh (bet Abstract: Sets FirstWindP to NIL and sets up default window; NOTE: CALL THIS PROCEDter be already created) Errors: Raises BadWNum if WIndx undefined Procedure GetWindowParms(var WIndx:URE ONCE AT SYSTEM INITIALIZE Side Effects: Sets FirstWindP to NIL Calls: ScreenRese WinRange; var OrgX, OrgY, Width, Height: integer; var hasTitle: Boolean); Abstract: Ret; Procedure Line(Style: LineStyle; X1, Y1, X2, Y2: integer; Origin: RasterPtr); Abstract: turns parameters for current window Parameters: All set to current window's values Procedure ChangeWi Draws an absolute line; Parameters: Style - function for the line. X1, X2, Y1, Y2 are ndow(WIndx: WinRange); Abstract: Writes out current window's parameters and changes to new oend points of line. Origin is pointer for Screen. Side Effects: Draws a line on the screen ne Parameters: WindX - new window's number Errors: Raises BadWNum if WIndx undefined - 141 - PERQ Operating System Interface - Screen 1 and OrgY - the upper left corner of the outside of the new window (chars are at least 5 bits in from  Procedure SetFont(NewFont: FontPtr); Abstract: Changes font to be NewFont Parameters:  that). Width and Height - total outside values for window (NOT the width and h NewFont - font to use Side Effects: Changes font in current window so all further writes eight of the character area). Title - title for window. If not '' then hairlines and a black a (including titles) are in this font. - 140 - PERQ Operating System Inrea are put around window. Side Effects: Writes current values into current window; creates a new terface - Screen 19 Jul 81 Function GetFont: FontPtr; Abstract: Returns current f  done when the microcode is confused about where the heads are. Opening the floppy door during a disk operation usuectory may contain other directories and files. ____________ __ ____ ___ ____ _____ Introduction to Path and ally causes this to happen. The light is located 5/8 inches from the left margin (about 6 characters from the left). The nFile Names The route that is traveled to reach a filename is called a PATH. A full path name specifies deng lookup of the symbol against a small set of commonly used commands. You can get a list of these commands by typing "?" ext light is used when the file system is attempting to fix up a file at run-time. This is needed occasionally when a file sCR. If a match is found then the Shell executes the command. If no match is found, an error message is displayed. ystem operation has not completed normally. This light appears 1-1/2 inches from the left margin (about 15 characters fr - 5 - PERQ Introductory User Manual - The Command Interpreter 19 Jul 81 Edit, Coom the left). The last light defined by the current system is used for swapping. While a swapping operation (swap in or swmpile, and Link use the name of the last file that was accessed if no argument is specified. Once a file is specified as ap out) is in progress, this light is "lit." The swapping light appears about 2-1/4 inches from the left margin (about 2a parameter to one of these commands its name need not be supplied again. The PERQ Utility Programs Manual gives you more4 characters from the left).  details on these programs. - 7 - PERQ Introductory User Manual - Specifying a Filename 19 Jul 81 7. Specifying a Filename. The PERQ f - 6 - PERQ Introductory User Manual - The "Lights" 19 Jul 81 6.ile system is described in detail in the PERQ File System Utilities Manual. This is a brief overview, a short introduction to The "Lights". The PERQ does not have a front panel full of lights like many computers. To show the occurrence of path and filenames, a description of the various ways to specify a filename, and an explanation of the wildcard convention. certain long operations, the PERQ simulates these lights by inverting small squares on the top of the PERQ screen. If the  ________ __ ___ ____ ____ ______ Overview of the PERQ File System The PERQ file system has a hierarchistandard system window is displayed, the lights will appear inside the title line. Currently, three lights are used by tcal structure. This is reflected in the manner in which file names are specified. Files are stored on devihe PERQ operating system. The leftmost is used to show when the PERQ is doing a disk or floppy recalibration. This is ces, which are divided into partitions. Each partition contains a number of files and directories; each dir  start. Procedure ToggleCursor; Abstract: Inverts Cursor picture. Side Effects: , PStart, PEnd, ExcSeg, RaiseAP: Integer); Abstract: Scrounge is called when uncaught signals are noticed Changes the picture on the screen. Procedure NewLine; Abstract: Moves the cursor to the ne or when the user types ^SHIFT-D. It allows looking around at local and global variables and thext line scrolling if necessary; does not do a CR. Side Effects: Changes the cursor position  stack trace. If ^SHIFT-D then can continue with program; otherwise, aborts when exit. and may scroll. Procedure SaveLineEnd(x: Integer); Abstract: Saves x as the end of a line. Pa Parameters: ES - segment number of exception. ER - routine number of exception. Prameters: x - the xPos of the end of a line. Side Effects: Puts x at the end of LineEnStart - offset of start of parameters to exception. PEnd - offset of end of parameters to exception. ds table; increments lastLineEnd; if table is full then scrolls table. Procedure SFullWindow; Abs ExcSeg - the segment number of the exceptions module if (ES = ExcSeg) and (ER = ErrDump) then is ^SHIFT-tract: Changes the parameters of the current window to be the full screen. Side Effects: D. For now, can't tell ^SHIFT-C. RaiseAP - the offset for AP for Raise itself (caller is  Changes the size of the current window. Does NOT refresh or change the title line or erase anyth person who did the raise). - 143ing or move the cursor - 142 - PERQ Operating System Inte - PERQ Operating System Interface - Stream 19 Jul 81 Module Stream; Abstract: This modrface - Scrounge 19 Jul 81 Module Scrounge; Abstract: This module contains the procedure Scroungule implements the low-level Pascal I/O. It is not intended for use directly by user programs, but rather the compile which allows a small amount of debugging. Since there are no symbol tables or microcode support for breakpoints, yer generates calls to these routines when a Reset, Rewrite, Get, or Put is encountered. Higher-level character I/O fou can look at the stack trace and examine variables by offsets. The types of the variables have to be specifiunctions (Read and Write) are implemented by the two modules Reader and Writer. In this module, the term "file buffe9 Jul 81 Procedure StartLine; Abstract: Resets Curline and variables describing the current line ed by the user. Exports Procedure Scrounge(ES, ER, PStart, PEnd, ExcSeg, RaiseAP: Integer); Procedure Scrounge(ES, ER hin a single partition as they cannot cross partition boundaries. Generally there are three partitions on a 1 path name: device:partition>{directory>}filename with up to 9 directories listed. This is usefu2-megabyte disk and five on a 24-megabyte disk. Examples of partition names are BOOT and USER. ___________ l if you want to access a file on a different device from the one you're using. 2. You can 3. Directories are easy to create, destroy, rename, and move around which are hierarchical in structure. There  use the default device that was deter- mined at boot time: :partition>{directory>}filename  can be multiple directories in a partition. These are - 8 - PERQ Introduct Using this syntax enables you to look for a file in a different partition. 3. You can use the defory User Manual - Specifying a Filename 19 Jul 81 denoted by the symbol > and can take names of up to 25 ault device and partition that were set at boot time: >{directory>}filename The search vice, partition, directories, and filename, in that order. The syntax of a path name is: [[[device]:partiti characters. There can be up to 9 directories listed in a full path name. The symbol: .. ison]>]{directory>}[filename] where there may be a maximum of nine directories listed. ______ 1. Dev a convenient way of referring to a parent node in a tree. It goes up one node. An example of its use is: ice names are usually assigned by the user. Examples of devices include floppy and hard disk. The syntax SYS:BOOT>NEW>..>filename This will look up filename in SYS:BOOT, rather than in SYS:BOOT>NEW>. The sy used to denote a device name is: device: Each PERQ is given a name, which is usually the device mbol . refers to the current directory. ________ 4. Filename is the last thing spname of the hard disk. _______ A device is accessable when it is mounteecified in a file specification. A filename can have up to 25 characters. The names of all of the directd. See the description of "Mount" in the PERQ Utilities Programs Manual. __________ 2. Parories and the filename cannot exceed 80 characters. When you boot, the system takes as default device and titions are set and named at device initialization time. Each device is divided into a fixed number of parti partition the device and partition that you booted from. For example, the system might come up with a default of: tions; the recommended size for a partition is 10,080 or fewer 256-word blocks. Files must fit entirely wit SYS:BOOT> ____ __ _______ _ ________ Ways to Specify a Filename 1. You can specify a full  file window } FEoln : boolean; { end of line flag } FEof : boolcked files, in elements for packed files } BlockNumber : integer; { next ean; { end of file } FNotReset : boolean; { false if a Reset logical block number } Buffer : pStreamBuffer;{ I/O buffer } LengthInBlocks: integer; { file length r variable" refers to F^ for a file variable F. Exports Imports FileDefs from FileDefs; const StreamVersion has been performed on this file } FNotOpen : boolean = '1.12'; IdentLength = 8; { significant characters in an identifier } type pStreamBuffer = ^StreamBuffer; ; { false if file is open } - 144 - PERQ Operating System Interface - Strea StreamBuffer = record case integer of { element size: } 0: (W: array[0..255] of integer); { 1 or more words, m 19 Jul 81 FNotRewrite: boolean; { set false if a Rewrite  or > 8 bits } 1: (B1: packed array[0..0] of 0..1); { 1 bit } 2: (B has been performed on this file } FExternal2: packed array[0..0] of 0..3); { 2 bits } 3: (B3: packed array[0..0] of 0..7); { 3 bits } 4: (B4: packed ar : boolean; { not used - will be permanent/temp file ray[0..0] of 0..15); { 4 bits } 5: (B5: packed array[0..0] of 0..31); { 5 bits } 6: (B6: packed array[0..0] of flag } FBusy : boolean; { IO is in progress } FKind  0..63); { 6 bits } 7: (B7: packed array[0..0] of 0..127); { 7 bits } 8: (B8: packed array[0..0] of 0..255); {: FileKind); 1: (skip1 : 0..3; ReadError : 0..7); 2: (skip2 : 0..15; WriteEr 8 bits } 9: (C: packed array[0..255] of char); { for character structured } end; ror: 0..3) end; EolCh, EofCh, EraseCh, NoiseCh: ControlChar; {self explanatory} OmitCh : set of  ControlChar = 0..#37; { ordinal of an ASCII control characterControlChar; FileNum : integer; { POS file number } Index : integer; { current word in b } FileKind = (BlockStructured, CharacterStructured); FileType = { file of Thing } packed record uffer for un-packed files, current element for pFlag: packed record case integer of 0: (CharReady : boolean; { character is in acked files } Length : integer; { length of buffer in words for unpa  of a current directory the file system provides a search list. This gives the user the ability to erating system there is nothing special about extensions. How- ever, there are certain conventions that are used in the sysspecify a set of directories to be searched, in a specific order, when a filename is specified. tem. An extension is found by finding the last "." in the filename and taking the following symbols. Backup files con ________ __________ Wildcard Convention A number of PERQ programs use a wildcard convention when looking uventionally have a "$" as the last character of their last extension; they take the form Name.Ext$. Following is a listp files. The wild cards are as follows: * matches 0 or more characters. & matches 1 or more characters. of the standard extensions and how they are used. .PAS - Pascal source files usually have this extension. .SE # matches exactly 1 character. '0 matches any digit. 'A or 'a matches any alphabetic. G - The Pascal compiler produces a .SEG file when it compiles a .PAS file. .SEG files are used as input to the L '@ matches any non-alphanumeric. '* matches *. Other wild cards can be quoted also. There can be any ninker and contain the code that will be executed when the program is run. .RUN - Files produced by the Linker haveumber of wildcards in file specifica- tions to programs that handle this convention. Examples of wildcard usage a this extension. .MICRO - PERQ microcode files have the extension .MICRO. They can be used as input to the microre: Dir *.Pas Dir &Boot* The first command gives a di assembler, PRQMIC. .BIN - The runnable version of PERQ microcode is contained in .BIN files. These files are pthen starts at the first directory speci- fied. 4. You can just type: rectory of all files with a .pas extension. The second command gives a directory of all files that have one or mo - 9 - PERQ Introductory User Manual - Specifying a Filename 19 Jul 81 filename are characters followed by the characters "boot", followed by zero or more characters. For more details on the filend the search begins at the current directory (which may be set by you, using Shell's PATH command). This  system, see the PERQ File System Utilities Manual. - 10 -  can involve any device, any partition, and any directory in that partition. Setting the defaul PERQ Introductory User Manual - Default File Extensions 19 Jul 81 8. Default File Extensions. An extension t path doesn't affect the default device and partition used in forms 1, 2, and 3. Along with the concept is a standard sequence of characters that appears at the end of a filename following the last period. In the PERQ op eam 19 Jul 81 CharFile: boolean ); Procedure StreamOpen( var F: FileType; var  - 146 - PERQ Operating System Interface - Stream 19 Jul 81 Exception NotOpen; Name: PathName; WordSize, BitSize: integer; CharFile: boolean; Abstract: Raised when an attempt is made to use a file which is not open. exception NotReset(  OpenWrite: boolean ); Procedure StreamClose( var F: FileType ); Procedure GetB( var F: Filetype ); Procedure PutB( FileName: PathName ); Abstract: Raised when an attempt is made to read a file which is opvar F: Filetype ); Procedure GetC( var F: Filetype ); Procedure PutC( var F: FileType ); Procedure PReadln( var F: Filetypen but has not been reset. Parameters: FileName - name of the file or device. Exception NotRewrite( e ); Procedure PWriteln( var F: Filetype ); Procedure InitStream; Function StreamName( var F: FileType ): PathName; FuncFileName: PathName ); Abstract: Raised when an attempt is made to write a file which is opin blocks } LastBlockLength:integer; { last block length in bits } SizeInWords : integer; { element tion FullLn( var F: Text ): Boolean; Procedure StreamKeyBoardReset( var F: Text ); Exception ResetError( FileName: PathNsize in words, 0 means packed file } SizeInBits : 0..16; { element sizame ); Abstract: Raised when unable to reset a file--usually file not found but also ce in bits for packed files } ElsPerWord : 0..16; { elements per word ould be ill-formatted name or bad device name. Parameters: FileName - name of the file or defor packed files } Element: { Thing } record case integer of {The File window} vice. Exception RewriteError( FileName: PathName ); Abstract: Raised when unable to rewrite a  1: (C: char); 2: (W: array[0..0] of integer) end end; ChArray = packed array[1..1file--usually file unknown device or partition but also could be ill-formatted name or ] of char; {For read/write character array} Identifier = string[IdentLength]; IdentTable = array[0..1] bad device name. Parameters: FileName - name of the file or device. Exception NotTextFile( FileName:of Identifier; var StreamSegment: integer; { Segment buffer for I/O buffers } Procedure StreamInit( var F PathName ); Abstract: Raised when an attempt is made to open a non-text file to a character: FileType; WordSize, BitSize: integer; - 145 - PERQ Operating System Interface - Str-structured device. Parameters: FileName - name of the device.   These files are used to communicate definitions between programs that may be in different languages, for examphe keyboard. If any step fails it is possible to look at the Diagnostic Display and see where in the boot sequence thele, between Pascal and microcode. .CMD - A number of programs on the PERQ accept commands from a file as well a failure occurred. The Fault Dictionary provides a list of the DDS values and explanations of their meanings. In the first s from the keyboard. Files that contain the commands usually have this extension. .DR - In the PERQ filpart of the boot sequence, microcode is executed out of a small ROM. This ROM covers the lower 2k of standard control store de system directories are files. These files appear in a directory listing with the extension .DR. .uring this part of the boot sequence. This microcode runs a simple diagnostic on the processor and memory systems. If there KST - Character set definitions are kept in files that have the extension .KST. .MBOOT, .BOOT - When the PERQ  are any errors, the microcode halts. The value in DDS gives the reason that the machine halted. Once these diagnostics hav is booted it reads the microcode interpreter and Pascal operating system from files that have the extensione been passed, the microcode makes a decision about which device is to be used for booting. Currently, there are thre .MBOOT and .BOOT. .DOC - Formatted documentation has this extension. .HELP - Files containing help about a subse possible boot devices. 1. The first possible boot device is another PERQ. The microcode determines if there ystem use this extension. - 11 - PERQ Introductory User Manual - Booting the is a PERQ Link Board plugged into the I/O Option slot of the machine. If the board is plugged in, and there is anMachine 19 Jul 81 9. Booting the Machine. The PERQ can be booted in one of two ways. First, when the machineother PERQ on the other end of the link, the booting PERQ will wait for commands from the link. 2. The se is powered up it will go through the boot sequence. Second, the machine can be booted by pressing the Boot button on thecond choice of boot devices is a floppy disk. The microcode checks to see if there is a floppy in the floppy dr back of the keyboard. In either case the same sequence of events happens. The boot sequence for PERQ has three steps. As ive. If there is a floppy in the drive, PERQ will check to see if the floppy is a boot floppy. If so, the secoroduced by the micro placer PRQPlace. .REL, .RSYM, .INT - These three file types are temporary files theach of these steps progresses, the Diagnostic Display, DDS, will be incremented. The DDS is a three-digit number display.at are produced by the micro assembler and placer. They can be deleted after a .BIN file has been created. .DFS - On earlier models of the PERQ, it is found on the inside of the machine behind the front cover; on later PERQs it's under t   device times out. Parameters: FileName - name of the device. - - 148 - PERQ Operating System Interface - Stream 19 Jul 81 Exception IdNotDefined(  147 - PERQ Operating System Interface - Stream 19 Jul 81 Exception UndfDevice; AbstractFileName: PathName; Id: Identifier ); Abstract: Raised when an undefined identifier is read. Param: Raised when an attempt is made to reference a file which is open to a character-structured deviceeters: FileName - name of the file or device. Id - the identifier which was read. Exception No, but the device number is bad. In the current system (lacking automatic initialization of file vtNumber( FileName: PathName ); Abstract: Raised when a number is expected on a file, but something ariables), this may be caused by referencing a file which has never been opened. Exception NotIdentifier( F else is encountered. Parameters: FileName - name of the file or device. Exception LargeNumberileName: PathName ); Abstract: Raised when an identifier is expected on a file, but som( FileName: PathName ); Abstract: Raised when a number is read from a file, but it is too ething else is encountered. Parameters: FileName - name of the file or device. Exception NotBoolean(large. Parameters: FileName - name of the file or device. Exception BadBase( FileName: PathName; Bas FileName: PathName ); Abstract: Raised when a boolean is expected on a file, but se: Integer ); Abstract: Raised when an attempt is made to read a number with a numeric baen but has not been rewritten. Parameters: FileName - name of the file or device. Exception PastEof(omething else is encountered. Parameters: FileName - name of the file or device. Exception BadIdTabl FileName: PathName ); Abstract: Raised when an attempt is made to read past the end of te( FileName: PathName ); Abstract: Raised by ReadIdentifier when the identifier table is he file. Parameters: FileName - name of the file or device. Exception UnitIOError( FileName: PathNam bad. Parameters: FileName - name of the file or device. Exception IdNotUnique( FileName: PathName; e ); Abstract: Raised when IOCRead or IOCWrite returns an error status. Parameters: Id: Identifier ); Abstract: Raised when non-unique identifier is read. Parameters: FFileName - name of the device. Exception TimeOutError( FileName: PathName ); Abstract: Raised when aileName - name of the file or device. Id - the identifier which was read.  If you type "Details Boots" the Details program will provide you with a list of all of the valid boot characters. Once aves just like the press on the pen. For programs which do not distinguish between the buttons, the other buttons also and part of the boot will be done from the floppy. 3. The third alternative is booting from hard disk. The micro a boot has been chosen, the microcode interpreter and PERQ operating system are loaded into the PERQ. Control is thcode tries to boot from the hard disk. If all of these fail, then the DDS will contain an indication of when transferred to the third portion of the boot sequence. In the third portion of the boot sequence, the interpreter micat the error is. See the Fault Dictionary Manual for an explanation of the display number. After the boot device has brocode does any initialization that is needed and then starts to execute the PERQ operating system. The PERQ operating een chosen, the second part of the boot sequence can begin. In this part, the PERQ reads 3k words of microcode from system system also increments the DDS. If there were no errors during the boot sequence, the machine will be running the selected boot device. This microcode is in two sections, a more extensive diagnostic (VFY) and a system boot loader (SYand the DDS will read 999. SB). VFY attempts to verify that all of the CPU and Memory systems are working. Any failures that VFY discloses are di - 13 - PERQ Introductory User Manual - The Pointing Device 19 Jul 81 10. The Pointing Device. splayed on the DDS. If all went well, the microcode determines what set of interpreter microcode and system Pascal code PERQs are supplied with a bit pad and pen. In the normal mode, the cursor on the screen follows the movement of the pen. I is to be loaded. It does this by - 12 - PERQ Introductory User Manual - Booting thef the pen is in the upper-left corner of the tablet, the cursor will be in the upper-left corner of the screen. The PERQ c Machine 19 Jul 81 checking to see if any key is being held down on the keyboard. If a key is being held down, thaan read the pen position when the pen is near the tablet surface. If you press down on the pen, a small switch will close. t key specifies which boot is to be done. If no key is held down, the default boot will be done. The default is the same as This is called a "press" of the pen. The editor and some other programs use the pen for pointing and drawing. As a holding down "a". Hold the key down until a pattern flashes on the screen. Any of the 26 alphabetic keys can be used to spen option, the pen can be exchanged for a four-button puck. This sits on the tablet and has a circle with cross hairs for poscify a boot. All lower-case characters cause a boot from the hard disk. Upper case characters cause a boot from floppy. ition- ing. The four buttons are arranged in a diamond as shown below. In all cases, the top (yellow) button on the puck beh   CharFile: boolean ); Abstract: Initializes, but does not open, the file variable F.  (otherwise it is opened for reading). Errors: ResetError if unable to reset the file.  Automatically called upon entry to the block in which the file is declared. (To be written whe RewriteError if unable to rewrite the file. NotATextFile if an attempt is made to open a non-text n the compiler generates calls to it.) Parameters: F - the file variable to be initialized.  file to a character structured device. Procedure GetB( var F: Filetype ); Abstract: Advan WordSize and BitSize are the size of an element of the file. CharFile - deteces to the next element of a block-structured file and gets it into the file buffer variable. Parametersrmines whether or not the file is of characters. - 149 - PERQ : F - the file to be advanced. Errors: NotOpen if F is not open. NotReset ifOperating System Interface - Stream 19 Jul 81 Procedure StreamClose( var F: FileType ); Abstrac F has not been reset. PastEof if an attempt is made to read F past Eof. t: Closes the file variable F. Parameters: F - the file variable to be closed. Procedur - 150 - PERQ Operating System Interface - Stream 19 Jul 81 Procedure GetC( var F: Fie StreamOpen( var F: FileType; var Name: PathName; WordSize, BitSize: integer; CharFile: boolean; letype ); Abstract: Advances to the next element of a character-structured file and gets  OpenWrite: boolean ); Abstract: Opens the file variable F. This procedure corresponds to it into the file buffer variable. Parameters: F - the file to be advanced. Errors: N both Reset and Rewrite. Parameters: F - the file variable to be opened. Name -otOpen if F is not open. NotReset if F has not been reset. PastEof if an attempt is made to read  the file name. WordSize - number of words in an element of the file (0 indicates a packed fiF past Eof. TimeOutError if RS: or RSX: times out. UnitIOError if IOCRead doesn't return IOEIOC orse that is not in the range 2..36. Parameters: FileName - name of the file or device. Base -le). BitSize - number of bits in an element of the file (for packed files). Cha numeric base (which is not in the range 2..36). Procedure StreamInit( var F: FileType; WordSize, BitSize: integer; rFile - true if the file is a character file. OpenWrite - true if the file is to be opened for writing  program can be continued after the point where the exception was raised. It is usually a bad idea to continue from uncaught e use the profile in your own programs. See the Profile module in the Operating System Interface manual. xceptions. The user can also abort the program and return to the Shell.  - 16 - Table of Contents  - 15 - PERQ Introductory User Manual - Profiles  19 Jul 81 1 Preface: Notation Conventions. 2 Introduction. 3 Turning the PERQ on and 19 Jul 81 12. Profiles. Profiles can be used to tailor the operating system to a particular user. The p off. 4 Control Characters. 5 The Command Interpreter, The Shell. 7 The "Lights". 8 ct like a press. The editor, however, assigns different functions to the other three buttons (see the "Editor Quick Guide").rofile is a text file which contains commands that define characteristics of certain utility programs. For example, a pr ___ /\ Key / y\ /\ /\ y = Yellow / \/ \ ofile can tell the Login program to initialize the default path and searchlist. Each user of the system can have his own  w = White \w /\ g/ g = Green \/ \/ b = Blue \ b/ \/ profile. With the UserControl program, a profile file can be assigned to a user. Each profile has entries for only those u - 14 - PERQ Introductory User Manual - Run-time Ertility programs for which the user desires to define characteristics. The format of the profile file is as follows: #rors 19 Jul 81 11. Run-time Errors. When the operating system or a user program discovers an error program1 #program2 ... For examplcondition, it raises an "exception" (see the "PERQ Pascal Exten- sions" manual for an explanation of exceptions). If an exe: #Login Path Sys:User>YourDirectory SearchList Sys:Boot>Library CursorFunction 7 #RandomUtception is not handled, it is given to the preliminary debugger, called Scrounge (see the "PERQ Utility Programs Manuaility MaxSize 100 The format of each list of entries in the profile is defined by the utility program that uses the prl"). First, a dump of the user state is produced and then the user is asked if he wants to debug. If not, the program is ofile. You should read the documentation for a particular utility to determine whether it reads the profile, and if so, waborted and control returns to the Shell and any active command files are terminated. If the user decides to debug, the hat entries can be included in the profile. Currently, the only program that uses the profile is Login. You may, however,  dure StreamKeyBoardReset( var F: Text ); Abstract: Clears the keyboard input buffer and the file variable - 153 - PERQ Operating S IOEIOB. UndfDevice if F is open, but the device number is bad. Procedure PutB( var F: Filetype ); A F so that all input typed up to this point will be ignored. Parameters: F - file to be cleabstract: Writes the value of the file buffer variable to the block-structured file and advancered. Procedure InitStream; Abstract: Initializes the stream package. Called by System. Functions the file. Parameters: F - the file to be advanced. Errors: NotOpen if F is not op FullLn( var F: Text ): Boolean; Abstract: Determines if there is a full line in the keyboard input en. NotRewrite if F has not been rewritten. Procedure PutC( var F: FileType ); Abstract:  buffer. This is the case if a carriage-return has been typed. This function is provided in order that Writes the value of the file buffer variable to the character- structured file and advances the file.  a program may continue to do other things while waiting for keyboard input. If the file i Parameters: F - the file to be advanced. Errors: NotOpen if F is not open. s not open to the console, FullLn is always true. Parameters: F - file to be checked.  NotRewrite if F has not been rewritten. UnitIOError if IOCWrite doesn't return IOEIOC or IOEIOB.  Returns: True if a full line has been typed. Errors: NotOpen if F is not open.  TimeOutError if RS: or RSX: times out. UndfDevice if F is open, but the device number is bad.  NotReset if F has not been reset. - 152 - PERQ Operating System Interface  - 151 - PERQ Operating System Interface - Stream 19 Jul 81 - Stream 19 Jul 81 Function StreamName( var F: FileType ): PathName; Abstract: Re Procedure PReadln( var F: Filetype ); Abstract: Advances to the first character following an end-of-line.turns the file name associated with the file variable F. For block-structured files, the full path name  Parameters: F - the file to be advanced. Procedure PWriteln( var F: Filetype ); Abstract:  including device and partition is returned. For character-structured files, the device nam Writes an end-of-line. Parameters: F - the file to which an end-of-line is written. Procee is returned. Parameters: F - file variable whose name is to be returned.   PERQ Operating System Interface This Manual describes eac Operating System Interface - AllocDisk 19 Jul 81 Module AllocDisk; Abstract: AllocDisk allocatesh module in the PERQ Operating System. It gives an abstract for each module, a list of the constants, types, va and deallocates disk pages. Each disk in the file system is divided into named partitions and each has some number riables, exceptions, procedures, and functions that the module exports, and information about each exported prof contiguous pages on it. The number of pages in a partition is specified when the partition is created (usinocedure or function. Copyright (C) 1981 Three Rivers Computer Corporation 720 Grg the Partition program). Segments can be created within a partition, i.e., segments may not span partitions. The oss Street Pittsburgh, PA 15224 (412) 621-6250 PERQ Operating System Interface 1 entire disk can be thought of as a partition (the Root Partition). A DiskInformationBlock (DiskInfoBlock or 9 Jul 81 This document is not to be reproduced in any form or transmitted in whole DIB) contains all the fixed information about a disk, including its partion names, locations and sizes. It a or in part, without the prior written authorization of Three Rivers Computer Corporation. The information in lso contains a table used to locate boot segments. A disk can be 'mounted' which means that its root partition iSpecifying a Filename. 11 Default File Extensions. 12 Booting the Machine. 14 The Pointing Device. this document is subject to change without notice and should not be construed as a commitment by Three Rive 15 Run-time Errors. 16 Profiles. rs Computer Corporation. The Company assumes no responsibility for any errors that may appear in this document. - iii -  Three Rivers Computer Corporation will make every effort to keep customers apprised of all documentation changes as quickly as possible. The Reader's Comments card is distributed with this document to request users' critical evaluation to assist us in preparing future documentation. PERQ is a trademark of Three Rivers Computer Corporation. - ii - PERQ   CtrlCPending: Boolean; { true if one control-C typed } {$ifc SysTiming then} LoadTime, OldLoadTime: DoubleWowhen the control-c is read. You can get the CtlC out of the IO buffers by using the IOKeyClear rd; ExecuteTime, OldExecuteTime: DoubleWord; SwapTime, OldSwapTime: DoubleWord; MoveTime, OldMoveTime: DoubleWord routine. Const ErrCtlCAbort = 5; {******} Exception CtlCAbort; Abstract: CtlCAbort is raise; IOTime, OldIOTime: DoubleWord; PrintStatistics: Boolean; - 154 - PERQ Oped by the KeyBoard interrupt routine when the second of two adjacent control-c's is typed. It israting System Interface - System 19 Jul 81 {$endc} shouldReEnableSwapping: Boolean; Sav also raised by the Stream package when a control-c is read. If you handle this exception you should clear ystem Interface - System 19 Jul 81 Program System; Abstract: System is the main program of theedSwapId: Integer; DefScrComp: Boolean; { when have to shrink screen, screen complemented?  operating system. Exports const MainVersion = 'D'; DebugSystemInit = False; FirstDDS = 199; Shel} DefScrOff: Boolean; { when have to shrink screen, screen off? } DemoInt: Integer; lConst = 'Shell.'; LogConst = 'LogIn.'; PFileConst = 'Default.Profile'; SysTiming = True; { Gat { reserved for Demo system } {*** WARNING!! IF YOU CHANGE THE EXPORTED PROCEDURES AND {*** EXCEPTIONS, SURE Ther System timing statistics. If this constant is changed, IO, Loader, Memory, Movemem, System, and SheHE NUMBERS FOR THE FOLLOWING {*** EXCEPTIONS ARE UPDATED AND RECOMPILE SCROUNGE {*** IF CHANGED } {**ll should be re-compiled, and the System should be re-linked. } Type DoubleWord = ^Integer; var UsrCm* WARNING!! DO NOT CHANGE THE ORDER OF THE ^C {*** EXCEPTIONS } Procedure Command; Procedure SetDDS( Display: IdLine: String[255]; SystemVersion: Integer; SystemInitialized: Boolean; UserMode: Boolean; CmdFile: Text; nteger ); Procedure SysVers( n: integer; var S: string ); Const ErrCtlC = 4; {******} Exception CtlC; Abstract: DDS: Integer; LastFileName, RFileName, StrVersion, ShellName: String; CmdSegment: Integer; InPmd: Boolean;  CtlC is raised by the KeyBoard interrupt routine when a control-c is typed. If you handle this SysDisk: Integer; SysBootChar: Integer; NextSSize: Integer; NextSComplemented: Boolean; NextSOff: Boolean; exception you should clear CtrlCPending in your handler. If you are catching control-c's to t InCmdFile: Boolean; CurUserID, CurGroupID: 0..255; CurUserName, CurPFile: String; DefCursFunct: Integer; ry to prevent aborts, you should enable CtlCAbort also, since the Stream package will raise it  cated as doubly linked lists of pages. The Free List of a segment is a doubly linked list of free pages. Module AXPARTCHARS]; DeviceRecord = record {entry in the DeviceTable} InfoBlk: DiskAddr; {where the DiskAllocDisk maintains this list, as well as the DeviceTable and PartTable. It contains procedures for mounting and dismounInfoBlock is} InUse : boolean; {this DeviceTable entry is valid} RootPartition: PartString {name of this diting disks and partitions, as well as allocating and deallocating space within a partition. When allocating pagsk} end; PartRecord = record {entry in the PartTable} PartHeadFree : DiskAddr; {pointer tes, the module updates the PartInfoBlock every MaxAllocs calls on AllocDisk. Since the system may crash some time betwo Head of Free List} PartTailFree : DiskAddr; {pointer to tail of Free List} PartInfoBlk : DiskAddr; {pointereen updates, the pointers and free list size may not be accurate. When a partition is mounted, the pointers are c to PartInfoBlock} PartRootDir : DiskAddr; {pointer to Root Directory} PartNumOps : integer; {how many opehecked to see if they point to free pages. If not, the head of the pointer is found by looking at the "filler" word orations done since last update of PartInfoBlock} PartNumFree : FSBit32; {HINT of hf the block the free head points to (which presumably was allocated after the last update of PartInfoBlock). Tow many free pages} PartInUse : boolean; {this entry in PartTable is valid} PartMounted : boolean; {thishe filler word has a short pointer to the next "free" page, and forms a linked list to the real free list header. Lik partition is mounted} PartDevice : integer; {which disk this partition is in} PartStart : DiskAddr; {Diewise, if the Free tail does not have a next pointer of 0, a deallocate is presumed to have been done since a PartIsk Address of 1st page} PartEnd : DiskAddr; {Disk Address of last page} PartKind : PartitionType; {RonfoBlock update, and NextAdr pointers are chased to find the real end of the Free List. ot or Leaf} PartName : PartString {name of this partition} end; var DiskTable : array [0..MAXDISKS-s known to the system as an entry in the DiskTable. A Partition Information Block (PartInfoBlock or PIB) contains al - 1 - PERQ Operating System Interface - AllocDisk 19 Jul 81 Export Imports Arith from Aritl of the fixed information about a partition. A partition can also be 'mounted', and this is usually done as part h; Imports ReadDisk from ReadDisk; const MAXDISKS = 2; {Floppy and HardDisk} MAXPARTITIONS = 10; {Maximum numbof mounting the disk itself. Partitions mounted are entries in the PartTable. Within a partition, segments are alloer of mounted partitions} MAXPARTCHARS = 8; {how many characters in a partition name} type PartString = string[M   line editing buffer. Const ErrCtlShftC = 6; {******} Exception CtlShftC; Abstract:  is the version number of the current system. Parameters: n - the minor version number of thCtlShftC is raised by the KeyBoard interrupt routine when a control- shift-c is typed. If you handle thie system. S - will be set to the current minor version of the system. s exception you should clear CtrlCPending in your handler. When this is raised by the KeyBoard in - 156 - PERQ Operating System Interface - System 19 Jul 81 Procedure Command;terrupt routine, the KeyBoard type-ahead buffer is cleared. You cannot prevent this. If your p Abstract: This procedure alternately loads Shell and the user programs whose runfile rogram uses a Text file and you want to clear the line editing buffer for that file, you should cnames are generated by Shell. It is invoked by the main program in System and can be exited all the Stream routine StreamKeyBoardReset(F) (assuming F is the name of the file). If F is a Text only if the user types ^C or if a runtime error occurs.  file which is attached to the console, this will get rid of the character F^ points to and clear Stre - 157 - PERQ Operating System Interface - Sy CtrlCPending in your handler. When this is raised by the KeyBoard interrupt routine, the KeyBoam's line editing buffer. Const ErrExitProgram = 7; {******} Exception ExitProgram; Abstract: ard type-ahead buffer is cleared. If you want to prevent this, you must catch CtlC also. If yo ExitProgram is raised to abort (or exit) a program. The default handler for CtlCAbort and Scroungeur program uses a Text file and you want to clear the line editing buffer for that file, you should raise this exception. WARNING: Only System and Loader should handle this exception. Any module call the Stream routine StreamKeyBoardReset(F) (assuming F is the name of the file). If F is a Text  may raise it to exit a program. Procedure SetDDS; Abstract: SetDDS sets the diagno - 155 - PERQ Operating System Interface - System 19 Jul 81 stic display to a particular value. Parameters: DDS - Desired value of the diagnostic display. Proced file which is attached to the console, this will get rid of the character F^ points to and clear Stream's ure SysVers( n: integer; var S: string ); Abstract: This procedure provides the caller with a string that 1] of DeviceRecord; PartTable : array [1..MAXPARTITIONS] of PartRecord; Procedure InitAlloc; Procedure DeviceMount(docedure InitAlloc; Abstract: Initialize the AllocDisk module. Side Effects: Sets allisk: integer); Procedure DeviceDismount(disk : integer); Function MountPartition(name : string) : integer; Procedure Dismoun InUse and PartInUse to false. Procedure DeviceMount(disk : integer); Abstract: Mount the device stPartition(name : string); Function FindPartition(name : string) : integer; Function AllocDisk(partition : integer) : DiskAdpecified by disk if not already mounted. Parameters: Disk - a device; it should be zerodr; Procedure DeallocDisk(addr : DiskAddr); numblks : integer); Function WhichPartition(addr : DiskAdd for HardDisk and 1 for Floppy. Environment: Expects DiskTable to be initialized. r) : integer; Procedure DisplayPartitions; prodedure DeallocChain(firstaddr,lastaddr : DskAddr;  - 3 - PERQ Operating System Interface - AllocDisk 19 Jul 81 S - 2 - PERQ Operating System Interface - AllocDisk 19 Jul 81 numblks :ide Effects: Sets the DiskTable for device; loads PartTable with Part names for the device.  integer); Exception NoFreePartitions; Abstract: Raised when too many partitions are accessed at one ti Errors: Error if no free partition slots in PartTable. NOTE: No mention is made if device has partitions me. The limit is MAXPARTITIONS. Exception BadPart(msg, partName: String); Abstract: Rwith the same names as those already loaded. Procedure DisplayPartitions; Abstract: Daised when there is something wrong with a partition. This means that the Scavenger should be run. Paraisplays information about the current partitions on the screen. Environment: Assumes PartTameters: msg - the problem and partName is the partition name. Print error message as: ble and DiskTable set up. Calls: AddrToField; IntDouble, WriteLn. Procedure DeviceDismount(disk : integ WriteLn('** ',msg,' for ',partName); Exception PartFull(partName: String); Abstract: er); Abstract: Removes device disk (0 or 1) from DiskTable and removes all its partitions. Raised when there are no free blocks in a partition to be allocated. This means that some files should be del Parameters: Disk - a device (0= HardDisk; 1=Floppy). Side Effects: Sets DiskTable[eted and then the Scavenger should be run. Parameters: partName - the full partition Prdisk]. InUse to false and removes all of disk's partitions. Calls: DismountPartition.  xports const Ether3MBaud = False; { no support for 3 MBaud EtherNet } Ether10MBaud = False; { no support for 10 Msers = array[0..MaxUsers] of UserRecord; Function FindUser(UserName: String; var UserRec: UserRecord): BBaud EtherNet } type Double = array[0..1] of Integer; oolean; Abstract: This function is used to see if a user exists in the user file. Pa - 158 - PERQ Operating System Interface - UserPass 19 Jul 81 rameters: UserName - the name of the user that we are looking for. UserRec - a var parameter th Module UserPass; Abstract: This module provides facilities for dealing with the password and accounts file for at is used to return the information about the user UserName if he is in the file. PERQ. The login and protection facilities for PERQ provide a very simple user validation. This system is not co - 159 - PERQ Operating System Interface - UserPass 19 Jul 81 mpletely secure. Exports type IDType = 0..255; PassType = ^Integer; { a two word value } Results: This procedure returns true if the user UserName was in the user file. It returns false,UserRecord = packed record InUse: boolean; { is this entry in use. } Name: String[31]; { Na otherwise. Function ValidUser(UserName, Password: String; var UserRec: UserRecord): Boolean; me of the user } UserID: IDType; { The user ID of the user. } GroupID: IDType; { The groupAbstract: This function is used to determine if a user name and password match. Paramete ID of the user. } EncryptPass: PassType;{ The encrypted password. } Profile: String; { Path nars: Username - the name of the user that we want to check. Password - the password for the user. me of the profile file. } end; Function FindUser(UserName: String; var UserRec: UserRecord): B UserRec - filled with user information if the user name and password match. Results: stemDefs 19 Jul 81 Module SystemDefs; Abstract: SystemDefs exports common system Const and Type oolean; Function ValidUser( UserName, Password: String; var UserRec: UserRecord): Boolean; Function AddUsedefinitions. The intent is that SystemDefs should not export Procedures or Vars since these require a Seg filr(UserName, Password: String; Group: IDType; ProPath: String): Boolean; Procedure NewUserFile; Procedure Lie. It is also intended that SystemDefs be reasonably short so that it doesn't take long to import. EstUsers; Function RemoveUser(UserName: String): boolean; const PassFile = '>System.Users'; const MaxUsers = 10; type U unction MountPartition(name : string) : integer; Abstract: Searches for partition name in PartTable and mohe index of the partition from which to allocate the block. Returns: Disk Address ounts it if not mounted already. Tries to read the head and tail of free list to see if valid. f newly freed block; Side Effects: Updates the partition info to note block freed. Changes  Parameters: name - partition name of form "dev:part>" where "dev" and ">" are optional.  header in buffer of block. Writes new head of free list with its next and prev fields set to zero and its fillFunction FindPartition(name : string ) : integer; Abstract: Searches through partition table looking for a Returns: Index in PartTable of partition for name or zero if not found. Side Effects: partition named name. If found, returns its index in the table. Parameters: name - parti If not mounted already, then reads in PartInfoBlk and sets PartTable fields; tries to read ttion name of form "dev:part>" or ":part>" or "part>"; where the final ">" is optional in all he head and tail of free list to see if valid. Errors: If no free slots for partiti forms. If dev isn't specified - then searches through all partition names. on then Raises NoFreePartitions. If can't find free list head or tail then Raises BadPart If dev is specified - then only checks those partitions on that device. Name may be in any case. . Calls: FindPartition. Procedure DismountPartition(name : string); Abstract: R - 4 - PERQ Operating System Interface - AllocDisk 19 Jul 81 emoves partition name from PartTable. Parameters: name - partition name of form "dev:part>" where "dev" an Returns: index in PartTable of FIRST partition with name name (there may be more than one pd ">" are optional. Side Effects: Writes out part information in table if partition Iartition with the same name in which case it uses the oldest one) or zero if not found or namenUse is mounted. - 5 - PERQ Operating System Interface - AllocDisk  malformed. Calls: UpperEqual. Design: No device name specified is signaled by di 19 Jul 81 Calls: UpdatePartInfo, ForgetAll Function AllocDisk(partition: integer) : sk=MAXDISKS; otherwise disk is set to be the device which the device part of name specifies FDiskAddr; Abstract: Allocate a free block from partition. Parameters: Partition is t  If the password is valid for the user then return true. Otherwise, returns false. Side Effect valid users. Parameters: UserName - the name of the user that is to be removed. Results: s: This function changes the file PassFile. Function AddUser(UserName, Password: String; Group: IDType;  If the user could be removed the return true. Otherwise return false.  ProPath: String): Boolean; Abstract: This function is used to add a new user to the user fi - 161 - PERQ Operating System Interface - UtilProgress le or change the parameters of an already existing user. Parameters: Username - the name of 19 Jul 81 Module UtilProgress; Abstract: Routines to show progress of utilities. Exports Procedure the user that we want to add or change. Password - the password for the user.  LoadCurs; Procedure ShowProgress(NumLines: Integer); Procedure QuitProgress; Procedure LoadCurs; AbstracGroup - the group number for the new user. ProPath - the path name of the profile file for this t: Set up the cursor so that we can show compilation in progress. Calls:  user. Results: If the user could be added or changed, then returns true. Otherwise, reNew, Dispose, IOLoadCursor, IOCursorMode, IOSetCursorPos. Procedure QuitProgress; Abstract: No more pturns false. Side Effects: This function changes the file PassFile. rogress to report, turn off the cursor. Calls: IOCursorMode. Procedure ShowProgress(NumLines: Integer - 160 - PERQ Operating System Interface - UserPass 19 Jul 81 Procedure NewUserFile; ); Abstract: Indicate progress - move the cursor down one scan line. Parameters: Num Abstract: This procedure is used to create a new user file. Side Effects: This procLines - the number of scan lines to move the cursor. Side Effects: CursPos is modified. Calls: edure creates a new file. It destroys any information in the current file. Procedure ListUsers;  IOSetCursorPos. - 162 - PERQ Operating System Interf Abstract: This procedure is used to supply a list of the valid users. Function RemoveUserace - Virtual 19 Jul 81 Module Virtual; Abstract: Virtual is the PERQ virtual memory manag(UserName: String): boolean; Abstract: This procedure is used to remove a user from the list of er. It supervises the segment tables and exports procedures for swapping memory segments. Virtual is the portion of the turns block addr to whatever partition it belongs to. Parameters: addr - block to deallocate Side  ( Byte0 : FSBit8; Byte1 : FSBit8; Byte2 : FSBit8;Effects: adds addr to free list; increments PartNumFree Calls: AddToTail, WhichPartition, Up Byte3 : FSBit8 ) end; Function DoubleAdd(a,b : FSBit32) : FSBit32; FuncdatePartInfo Procedure DeallocChain(firstAddr,lastAddr : DiskAddr; numBlks : integer); Absttion DoubleSub(a,b : FSBit32) : FSBit32; Function DoubleNeg(a : FSBit32) : FSBit32; Function DoubleMul(a,b : FSBit32) : FSBiract: Deallocates a chain of blocks. Parameters: firstAddr and lastAddr - addresses oft32; Function DoubleDiv(a,b : FSBit32) : FSBit32; Function DoubleInt(a : integer) : FSBit32; Function IntDouble(a : FSBit blocks to deallocate (inclusive) and numBlks is number of blocks to free 32) : integer; Function DoubleBetween(a,start,stop : FSBit32) : boolean; Function DoubleMod(a,b : FSBit32) : FSBit32; Funct Side Effects: Frees first and last addr using AddToTail; middle blocks not changed. Calls:ion DoubleAbs(a : FSBit32) : FSBit32; Function DblEql(a,b : FSBit32) : boolean; Function DblNeq(a,b : FSBit32) : boolean; er set to next free block. Decrements PartNumFree. Errors: Raises PartFull if no free block AddToTail, ChangeHeader, WhichPartition, DoubleAdd, FlushDisk, UpdatePartInfo, DoubleInt s in partition. Raises BadPart if free list inconsistent. Calls: ReadHeader, ChangeHeader, Flu NOTE: No checking is done to see if numBlks is correct. shDisk, UpdatePartInfo. Function WhichPartition(addr : DiskAddr) : integer; Abstract: Given a disk ad - 7 - PERQ Operating System Interface - Arith 19 Jul 81 Module Arith; Abstractdress; find the partition it is in. Parameters: addr - a disk address Returns: index: Implements interim Double precision arithmetic package. This module is needed until Pascal compiler supports ty of partition addr falls inside of or zero if none Calls: DoubleBetween NOTE: DOESN'T CHECK IF ENTpe long. Exports Imports FileDefs from FileDefs; { to get FSBitnn } type MyDouble = packed record cRY IN TABLE IS MOUNTED OR INUSE!!! - 6 - PERQ Operating System ase integer of 1: ( Lsw : integer; Msw : integer Interface - AllocDisk 19 Jul 81 Procedure DeallocDisk(addr : DiskAddr); Abstract: Re ); 2: ( Ptr : FSBit32 ); 3: egId; Status: IOStatPtr; BootSerialNum: Double; BootSegId: SegId; SwapSId: SegId;  S - Segment to put in the head field. Errors: EdgeFailure if MakeEdge can't find the previo - 163 - PERQ Operating System Interface - Virtual 19 Jul 81 Function Returnus segment number. - 164 - PERQ Operating System InterfaSegment: SegmentNumber; Abstract: ReturnSegment finds the segment number of the caller of ce - Virtual 19 Jul 81 Procedure DeleteSegment( var S: SegmentNumber ); Abstract:  PERQ memory manager which must remain memory resident at all times. PERQ physical memory is segmented into separatethe procedure which called ReturnSegment by searching the call stack. Result: ReturnSegment ly swappable items (called segments) which may contain either code or data. Design: See the Q-Code Reference Manual. = Segment number of the caller. Design: This routine depends on the PERQ running a single process  Exports const VirtualVersion = '2.4'; Imports Memory from Memory; Imports IO_Unit from IO_Unit; Imports DiskIO from operating system where the caller is in the same process as the memory manager. Procedure ReleaseSegme DiskIO; Function ReturnSegment: SegmentNumber; Procedure ReleaseSegmentNumber( Seg: SegmentNumber ); Function NewSegmntNumber( Seg: SegmentNumber ); Abstract: ReleaseSegmentNumber releases a segment number to the entNumber: SegmentNumber; Procedure MakeEdge( var E: MMEdge; S: SegmentNumber ); Procedure DeleteSegment( var S: SegmentNumb list of segment numbers which are not in use. Parameters: Seg - Segment number to return to the seer ); Procedure SwapOut( var E: MMEdge ); Procedure SwapIn( E: MMEdge; S: SegmentNumber; P: MMPosition ); Procedure Compacgment number free list. Function NewSegmentNumber: SegmentNumber; Abstract: NewSegt; Procedure KeepSegments; Procedure FindHole( Fsize: MMIntSize; ForUserSegment: Boolean ); Procedure IncIOCount( S: SegmementNumber allocates the next unused segment number. Errors: NoFreeSegments if therentNumber ); Procedure DecIOCount( S: SegmentNumber ); Procedure SwapSegmentsIn( S1, S2, S3, S4: SegmentNumber ); var Scre are no unused segment numbers. Procedure MakeEdge( var E: MMEdge; S: SegmentNumber ); Abstract: MakeenLast: Integer; Keep1, Keep2, Keep3, Keep4: SegmentNumber; Kludge: record case Integer of 1: (A: DiskAdEdge makes an MMEdge record which the head field set to a certain segment number and the tail field set to the dress); 2: (D: Double) end; BlockHeader: IOHeadPtr; BlockAddress: Double; BlockSId: S previous segment number (in physical address order). Parameters: E - MMEdge record to build.  Function DoubleSub(a,b : FSBit32) : FSBit32; Abstract: Subtracts b from a. Parameters: System Interface - Arith 19 Jul 81 Function IntDouble(a : FSBit32 ) : integer; Abstract:  a and b - doubles. Returns: a-b Design: a+(-b) Function DoubleNeg(a : FSBit3 Returns the low word of a. Parameters: a - a double. Returns: low word 2 ) : FSBit32; Abstract: Does a two-s complement negation of argument. Parameters: a Errors: Micro-code raises OvflLI (in Except) if a will not fit in one word. Function D - number to negate. Returns: -a Function DoubleAbs(a : FSBit32 ) : FSBit32; Abstract: oubleBetween(a,start,stop : FSBit32) : boolean; Abstract: Determines whether a is between start a Does an absolute value of argument. Parameters: a - number to abs. Returns: nd stop (inclusive). Parameters: a - a double to test; start is low double and stop is|a| - 9 - PERQ Operating System Interface - Arith  high. Returns: true if a >= start and a <= stop else false Function DblEql(a,b : 19 Jul 81 Function DoubleMul(a,b : FSBit32) : FSBit32; Abstract: Multiplies a and b. ParameteFSBit32): boolean; Abstract: Determines whether a = b. Parameters: a and b - doublesrs: a and b - doubles. Returns: a*b Function DoubleDiv(a,b : FSBit32) : FSBit32; . Returns: true if a = b; else false. Function DblNeq(a,b : FSBit32): boolean; Abstract:  Abstract: Divides a by b. Parameters: a and b - doubles. Returns: a/ determines whether a <> b. Parameters: a and b - doubles. Returns: true if Function DblLeq(a,b : FSBit32) : boolean; Function DblLes(a,b : FSBit32) : boolean; Function DblGeq(a,b : FSBit32) : boolean;b Function DoubleMod(a,b : FSBit32) : FSBit32; Abstract: Mods a by b Parameters:  Function DblGtr(a,b : FSBit32) : boolean; - 8 - PERQ Operating System Int a and b - doubles. Returns: a mod b Function DoubleInt(a : integer) : FSBit32; Abstract: erface - Arith 19 Jul 81 Function DoubleAdd( a,b : FSBit32) : FSBit32; Abstract:  Converts a into a double. Parameters: a - integer. Returns: Double of a; Adds two doubles together. Parameters: a and b - doubles to add. Returns: a+b  if a is negative then does a sign extend. - 10 - PERQ Operating  lue as S on exit. Procedure SwapOut( var E: MMEdge ); Abstract: SwapOut swaps a data segment out to d are not moved into the screen area, as segments cannot jump over one another. Errors: isk. Parameters: E - An edge where the head is the segment to be swapped and the tail CantMoveSegment if attempt to move a segment with non-zero IO count. Procedure KeepSegme is the previous segment. Result: E.T and E.H both are set to the number of the new free nts; Abstract: KeepSegments marks the segments Keep1 through Keep4 as not RecentlyUsed sosegment. Errors: PartNotMounted if the swapping partition is not mounted. SwapError if att that they won't be swapped out. Procedure FindHole( Fsize: MMIntSize; ForUserSegment: Boolean ); Abstract: empt to swap segment out while swapping is disabled. Procedure SwapIn( E: MMEdge; S: SegmentNumber; P:  FindHole attempts to find a hole (free memory) of a certain size. It performs a first-fit search. IMMPosition ); Abstract: SwapIn swaps a segment in from disk. Parameters: E - An edgf a hole cannot be found, memory is compacted, and another first-fit search is performed.DeleteSegment returns a segment to the free memory list. This is done (for example) when the segment's reference describing where to put the segment in memory. The head is a free segment which are filled e and IO counts both reach zero. Parameters: S - Number of the segment to be destroyed. To  by the segment to be swapped in. The tail is the previous segment. S - The segmenfacilitate segment table scanning loops that contain calls to DeleteSegment: 1) If S wast to swap in. P - The position (low end or high end) to use within the head segment of the edg resident, it is changed to be the number of the segment which represents the free memore. Errors: SwapInFailure if attempt to swap in a segment which was never swapped out.y. This may not be the same as the original value if the original segment is coalesced  - 165 - PERQ Operating System Interface - Virtual 19 Jul 81  with an adjacent free segment. 2) If S was not resident, it is changed to be the number of tProcedure Compact; Abstract: Compact compacts physical memory by moving as many segmehe segment which preceded it in the segment table. 3) MMFirst is set to have the same vants as possible toward low addresses. System segments (those with a reference count greater than one)   19 Jul 81 Function DblLeq(a,b : FSBit32) : boolean; Abstract: Determines whether a <= b.  Imports GetTimeStamp from GetTimeStamp; const ClockVersion = '1.5'; type TimeString = String; Procedure SetTStamp( St Parameters: a and b - doubles. Returns: true if a <= b; else false. Function Dbamp: TimeStamp ); Procedure SetTString( String: TimeString); Procedure GetTString( var String: TimeString ); Procedure StampTlLes(a,b : FSBit32) : boolean; Abstract: Determines whether a < b. Parameters: a andoString( Stamp: TimeStamp; var String: TimeString ); Procedure StringToStamp( String: TimeString; var Stamp: TimeStamp); E b - doubles. Returns: true if a < b; else false. Function DblGeq(a,b : FSBit32) : boolean; Axception BadTime; Abstract: Raised when a string passed does not represent a valid time. bstract: Determines whether a >= b. Parameters: a and b - doubles. Returns:  Procedure SetTStamp( Stamp: TimeStamp ); Abstract: Sets time to be time specified by Stamp.  true if a >= b; else false. Function DblGtr(a,b : FSBit32) : boolean; Abstract: determines whet Parameters: Stamp - new time. Side Effects: Changes current time. her a > b. Parameters: a and b - doubles. Returns: true if a > b; else false.  - 13 - PERQ Operating System Interface - Clock 19 Jul 81 Procedure Set - 12 - PERQ Operating System Interface - Clock 19 TString( String: TimeString); Abstract: Sets time to be time specified by String. Parameters: Jul 81 Module Clock; Abstract: Clock implements the PERQ human-time clock. Times are represented internally  String - the string of the new time. Side Effects: Changes current time. Errors: by a TimeStamp record which has numeric fields for Year, Month, Day, Hour, Minute, and Second. Times may also be expressed Raises BadTime if string is invalid (malformed or illegal time). Procedure GetTString( var String by a string of the form YY MMM DD HH:MM:SS where MMM is a three (or more) letter month name and HH:MM:SS is time of day: TimeString ); Abstract: Returns the current time as a string. Parameters: String - on a 24-hour clock. The clock module exports routines for setting and reading the current time as either the string to be set with the current time. Procedure StampToString( Stamp: TimeStamp; var String: TimeString ); A a <> b; else false. - 11 - PERQ Operating System Interface - Arith  a TimeStamp or a character string, and exports routines for converting between TimeStamps and strings. Exports  t/output references to a data segment. A non-zero IO count prevents a segment from bei - 167 - PERQ Operating System Interface - Writer 19 Jul 81 Module Wng moved, swapped, or destroyed. Parameters: S - Segment number. Errors: riter; Abstract: Writer is the character output module of the Stream package. It is called by code generated by UnusedSegment if S is not in use. FullMemory if S is not resident and there isn't enough  the Pascal compiler in response to a Write or Writeln. It is one level above Module Stream and uses Stream's outpu memory to swap it in. - 166 - PERQ Operating System Interface - Virtual t routines. Exports Imports Stream from Stream; Procedure WriteBoolean( var F: FileType; X: Boolean;  19 Jul 81 Procedure DecIOCount( S: SegmentNumber ); Abstract: DecIOCount decrements  Field: integer ); Procedure WriteCh( Var F: FileType; X: char; Field: integer ); Procedure WriteChArray( var F: the IO count of a data segment by one. If the reference and IO counts both become zero: 1) if the FileType; var X: ChArray; Max, Field: integer ); Procedure WriteIdentifier( var F: FileType; X: int segment is a data segment, it is destroyed; 2) if the segment is a code segment, it is destroyed only if it eger; var IT: IdentTable; L, Field: integer ); Procedure WriteInteger( var F: FileType; X: intege is in the screen or is non-resident. Parameters: S - Number of the segment. Errors: r; Field: integer ); Procedure WriteString( var F: FileType; var X: String;  UnusedSegment if S is not in use. Procedure SwapSegmentsIn( S1, S2, S3, S4: SegmentNumber ); Abstract:  Field: integer ); Procedure WriteX( var F: FileType; X, Field, B: integer ); Procedure WriteBoolean( var F: FileType; X: Eventually, a swap-out pass is performed. Parameters: Fsize - Minimum size of the hole. T SwapSegmentsIn ensures that when it returns, S1, S2, S3, and S4 are resident. Parameters: his is an internal size--Fsize=n means n+1 blocks. ForUserSegment - True, if this hole is  S1, S2, S3, S4 - segments to swap in. Errors: NilPointer if one of the segments is zero. to be used for a user segment. System segments may not be allocated in the screen area.  UnusedSegment if one of the segments is not really in use. FullMemory if there  Procedure IncIOCount( S: SegmentNumber ); Abstract: IncIOCount increments the count of inpuisn't enough memory to swap one of the segments in.  e is used to convert a string to uppercase. Parameters: Str - the string that is to be converted. s: This procedure will change both Src and BrkChar. Errors: None Procedure GetSymbol; Results: This procedure does not return a value. Side Effects: This procedure changes Str.  Abstract: This procedure removes the first symbol from the beginning of a strinbstract: Returns a string for the time specified by Stamp. Parameters: Stamp - time to get s Errors: None Function UniqueCmdIndex; Abstract: This procedure is used to do atring for. String is set with time represented by stamp. Procedure StringToStamp( String: TimeString; var Sta unique lookup in a command table. Parameters: Cmd - the command we are looking for. mp: TimeStamp ); Abstract: Converts a string into a time stamp. Parameters: String - CmdTable - a table of the valid commands. The first valid command in this table must start at in the string containing time. Stamp - TimeStamp set with time according to String. Errors: Radex 1. NumCmds - the number of valid command in the table. - 15 - PERQ ises BadTime if string is invalid (malformed or illegal time). Operating System Interface - CmdParse 19 Jul 81 Results: This procedure returns the  - 14 - PERQ Operating System Interface - CmdParse 19 Jul 81 Module CmdParse; Abstractindex of Cmd in CmdTable. If Cmd, was not found then return NumCmds + 1. If Cmd was not unique : Simple command parsing routines. const CmdPVersion = '1.0'; MaxCmds = 30; MaxCString = 255; type CStrithen return NumCmds+2. Side Effects: None Errors: None Procedure RemDelimiterng = String[MaxCString]; CmdArray = Array[1..MaxCmds] Of String; Procedure CnvUpper(Var Str:CString); Function UniqueCmdIs; Abstract: This procedure removes delimiters from the front of a string. Parndex(Cmd:CString; Var CmdTable: CmdArray; NumCmds:Integer) :Integer; Procedure RemDelimiters(Var Src:ameters: Src - the string from which we are to remove the delimiters. DeCString; Delimiters:CString; Var BrkChar:CString); Procedure GetSymbol(Var Src,Symbol:CString; Delimitlimiters - a string containing the characters that are to be considered delimiters. BrkChar - ers:CString; Var BrkChar:CString); Procedure CnvUpper; Abstract: This procedurholds the character that we broke on. Results: This procedure does not return a value. Side Effect arameters: X - the boolean to be written. F - the file into which X is to be written. ble. Field - the size of the field into which X is written. Errors: BadIdTable if the lenField - the size of the field into which X is to be written. Procedure WriteCh( var F: FileType; Xgth of the identifier table is less than 1. Procedure WriteInteger( var F: FileType; X: integer; : char; Field: integer ); Abstract: Writes a character in a fixed format. Parameters:  Field: integer ); Abstract: Writes a decimal integer in fixed format. Parameters X - the character to be written. F - the file into which X is to be written. Field - the size of t: X - the integer to be written. F - the file into which X is to be written. Field - he field into which X is to be written. - 168 - PERQ the size of the field into which X is to be written. Procedure WriteString( var F: FileType; var X: Operating System Interface - Writer 19 Jul 81 Procedure WriteChArray( var F: FileType; var X: ChArray; String; Field: integer ); Abstract: Writes a string in fixed format. Para Max, Field: integer ); Abstract: Writes a packed character array in fixed formatmeters: X - the string to be written. F - the file into which X is written. Field - th. Parameters: X - the character array to be written. F - the file into which X is to be write size of the field into which X is written. - 169 - PERQ Operating System Interfacten. Field - the size of the field into which X is to be written. Max - thee - Writer 19 Jul 81 Procedure WriteX( var F: FileType; X, Field, B: integer ); Abstract:  declared length of X. Procedure WriteIdentifier( var F: FileType; X: integer; var IT: IdentTab Writes an integer in fixed format with base B. Parameters: X - the integer to be written. le; L, Field: integer ); Abstract: Writes an identifier from a table in fixed format. Parameters:  F - the file into which X is to be written. Field - the size of the field into which X is to be  X - the ordinal of the identifier in the range 0 to L. F - the file to which X is written.  written. B - the base of X. It is an integer whose absolute value must be betwee Boolean; Field: integer ); Abstract: Writes a boolean in fixed format. P IT - the table of identifier names indexed from 0 to L. L - the largest identifier ordinal defined by the ta  - 17 - PERQ Operating System Interface - Code  { segment name } pFNString = ^FNString; FNString = String[FileLength]; { file name  19 Jul 81 Module Code; Abstract: Code.Pas defines constants and types shared by the Linker and} - 18 - PERQ Operating System Interface - Code 19 Jul 81  the Loader. These include definitions of the run file and of offsets in the stack segment. Design: When the  QVerRange = 0..255; { range of QCode version numbers } pSegNode = ^SegNode; pImpformat of run files is changed, the constant RFileFormat must also be changed. This is necessary to prevent the procedurNode = ^ImpNode; { Segment information record:} SegNode = record SegId : SNArray;es which read run files from failing. Exports const CodeVersion = '1.4'; RFileFormat = 1; QC { segment name } RootNam : pFNString; { file name withoug. Parameters: Src - the string from which we are to remove the symbol. Symbol - a stringodeVersion = 2; { Current QCode Version Number } FileLength = 100; { max chars in a file  that is used to return the next symbol. Delimiters - a string that defines what characters are to name } SegLength = 8; { max chars in a segment name } StackLeader = 2; { numbe be considered delimiters. Any character in this string will be used to terminate the next symbol. r of leader words in stack before } { XSTs (must be even) } { Currently contains  BrkChar - used to return the character that stopped the scan. Results: initial TP and GP } DefStackSize = #20; { default stack segment size (in blocks) } DefHeapSize This procdure does not return a value. - 16 - PERQ Operating System Interf = #4; { default heap segment size (in blocks) } DefIncStack = #4; { default stack size iace - CmdParse 19 Jul 81 Side Effects: This procedure removes the firstncrement (in blocks) } DefIncHeap = #4; { default heap size increment (in blocks) } FudgeStack symbol from Src and places it into Symbol. It places the character that terminated the s = #2000; { fudge space between system and user GDB's } { this must hold all loader variables at }can into BrkChar. Errors: None  { maximum configuration in LoadStack } type SNArray = packed array[1..SegLength] of Char;   - iii -  | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  Labels for Source Systems Page 1/4 |------------------------------------------------------ | | | | Group name Command filn 2 and 36, inclusive. Errors: BadBase if the base is not in 2..36. ---------| | | | PRQ-SFT-ABD-5  - 170 - PERQ Operating System Interface  | | 3RCC PERQ SYSTEM D.5 BOOT FLOPPY | | Copyright (C) Three Rivers Computer C- Table of Contents 19 Jul 81 1 AllocDisk 8 Arith 13 Clock 15 CmdParsorporation, 1981 | | single density, double sided D.5 | | e 18 Code 21 ControlStore 24 DiskIO 32 Dynamic 34 Except 37 Fi | |---------------------------------------------------------------| | leAccess 41 FileDefs 42 FileDir 45 FileSystem 54 FileTypes 55 FileUtils  | | PRQ-SFT-BSD-5 | | 3RCC PERQ SYSTEM D. 62 GetTimeStamp 63 GPIB 67 IO 68 IOErrMessages 69 IOErrors 70 I5 SOURCE DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single densitO_Init 71 IO_Others 75 IO_Private 86 IO_Unit 94 Lights 95 Loader 96 y, double sided D.5 | | | | Group n Memory 108 MoveMem 109 PERQ_String 114 PMatch 117 RandomNumbers 118 Profame Command file | | | | Oile 120 Raster 121 ReadDisk 127 Reader 130 RS232Baud 131 RunRead 133 S.SOURCE SRC.CMD | | | | RunWrite 134 Screen 143 Scrounge 144 Stream 154 System 158 SystemDefs 159 ---------------------------------------------------------------| |  UserPass 162 UtilProgress 163 Virtual 168 Writer  | | PRQ-SFT-CSD-5 | | 3RCC PERQ SYSTEM D.5 IO SOURCE DISTRIBUTION FLOPPY Next : pSegNode end; { Import information record } ImpNode = record : (ProgramSegment: boolean; SegBlkFiller : 0..127; QVersion : QVer SId : SNArray; { name of imported segment } FilN : pFNString; Range; ModuleName : SNArray; FileName : FNString;  { file name of imported segment } XGP : integer; { global NumSeg : integer; ImportBlock : integer; GDBSize  pointer of import } XSN : integer; { internal number of import }  : integer; SumOfLocals : integer); false:(Block: array[0..255] of integ Seg : pSegNode; Next : pImpNode end; er) end; CImpInfo = record case boolean of { Import List Info - as gene - 19 - PERQ Operating System Interface - Code 19 Jul 81 { Run filerated } { by the compiler } true: ( ModuleName: SNArray; : } RunElement = (RunHeader,SysSegment,UserSegment, Import,SegFileNames); RunInfo = { module identifier } FileName: FNString  record { run header } RFileFormat:integer; Version: integer; S { file name } ); false:( Ary: array [0..0] of integer) t .Pas or .Seg } GDBSize : integer; { size of this segment's GDB } ystem: boolean; InitialGP: integer; CurOffset: integer; StackS XSTSize : integer; { size of this segment's XST } GDBOff : integer; ize: integer; StackIncr: integer; HeapSize: integer; HeapIncr:  { StackBase offset to GDB } ISN : integer; { segment number  integer; ProgramSN: integer; SegCount: integer end; Rinside Linker } CodeSize : integer; { number of blocks in .Seg file } unFileType = file of Integer; { Segment file: } pSegBlock = ^SegBlock; SegBlock = packed reco SSN : integer; UsageCnt : integer; ImpList : pImpNode; rd case boolean of { .SEG file definition } { first block: } true  | |---------------------------------------------------------------| | --------------------| | | | PRQ-SFT-GBD-5  | | PRQ-SFT-ESD-5 | | 3RCC PERQ UTILITY PROGRAM SOURCE DISTRIBUTION | | 3RCC PERQ UTILITY PROGRAM BINARY DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  Computer Corporation, 1981 | | single density, double sided D.5 | |  | | | | Group name Comman | | Group name Command file | | d file | | | | UTILITY.SOURCE  | | UTILITY.BINARY BIN.CMD LINK.CMD | | e | | | | OS.IO.SOURCE SRC.CSRC.CMD | | | |--------------------------MD | | | |--------------------------------------------------------------------| Labels for Source Systems Page 2/4 |--------------------------------------------| | | | PRQ-SFT-DBD-5 ---------------------------------------------------| | | | P | | 3RCC PERQ SYSTEM D.5 BINARY DISTRIBUTION FLOPPY | | Copyright (C) RQ-SFT-FSD-5 | | 3RCC PERQ FILE UTILITY PROGRAM SOURCE DISTRIBUTION FLOPPY | |Three Rivers Computer Corporation, 1981 | | single density, double sided D.5 | |  Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  | | Group name Command file | |  | | | | Group name Command file  | | OS.BINARY BIN.CMD LINK.CMD | |  | | | | UTILITY.FILE.SOURCE SRC.CMD  OS.MISCELLANEOUS MISC.CMD | |  | | | |------------------------------------------- ports types defining the format of PERQ micro-instructions and procedures to load and call routines in the control-st SFF: 0..63; H: 0..1; B: 0..1; JmpCnd:0..255) end; More. Exports type MicroInstruction = { The format of a micro-instruction as produced by the micro-asicroFile = file of MicroBinary; { A file of micro-instructions. } Procedure LoadControlStore( var F: MicroFile sembler. } packed record case integer of 0: (Word1: integer; Word2: integer; Word); Procedure LoadMicroInstruction( Adrs: integer; MI: MicroInstruction ); Procedure JumpCo3: integer); 1: (Jmp: 0..15; Cnd: 0..15; Z: 0..255; SF: 0..15; ntrolStore( Adrs: integer ); Procedure LoadControlStore( var F: MicroFile ); Abstract: Loads the c F: 0..3; ALU: 0..15; H: 0..1; W: 0..1; B: 0..1; ontents of a MicroFile into the PERQ control-store. The file whould be opened (with Reset)  A: 0..7; Y: 0..255; X: 0..255); 2: (JmpCnd: 0..255; Fill1: 0..255;  before calling LoadControlStore. It is read to EOF but not closed; thus it should be closed after cal SFF: 0..63; ALU0: 0..1; ALU1: 0..1; ALU23: 0..3) end; ling LoadControlStore. Parameters: F - The MicroFile that contains the micro-instructions to MicroBinary = { The format of a micro-instruction and its address as produced by the micro-assembler.  be loaded. Procedure LoadMicroInstruction( Adrs: integer; MI: MicroI } record Adrs: integer; MI: MicroInstruction end; nstruction ); Abstract: Loads a single micro-instruction into the PERQ control-st - 21 - PERQ Operating System Interface - ControlStore 19 Jul 81 TransMicro = ore. Parameters: Adrs - The control store address to be loaded. MI - The micro-instruction { The format of a micro-instruction as needed by the WCS QCode. } packed record case integer of  to be loaded. - 22 - PERQ Operating System Interface - ControlStore  end; SegFileType = file of SegBlock; - 20 - PERQ Operating 0: (Word1: integer; Word2: integer; Word3: integer); 1: (ALU23: 0..3; AL System Interface - ControlStore 19 Jul 81 Module ControlStore; Abstract: The ControlStore module exU0: 0..1; W: 0..1; ALU1: 0..1; A: 0..7; Z: 0..255;   | | PASCAL.SOURCE SRC.CMD | | ------------------------| Labels for Source Systems Page 3/4 |------------------------- | |---------------------------------------------------------------| | --------------------------------------| | | | PRQ-SFT-JBD-5  | | PRQ-SFT-SSD-5 | | 3RCC PERQ MORE PASCAL COMPI | | 3RCC PERQ MICROCODE SOURCE DISTRIBUTION FLOPPY | | CopyrighLER SOURCE DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, doublt (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5 | | e sided D.5 | | | | Group name  | | Group name Command file | |  Command file | | | | PASCAL.MO | | MICROCODE.SOURCE SRC.CMD RE.SOURCE SRC.CMD | | | |-------- | | | |---------------------------------------------------------------------------------------------------------------| | | | -------| | | | PRQ-SFT-KSD-5  | |---------------------------------------------------------------| |  PRQ-SFT-IBD-5 | | 3RCC PERQ PASCAL COMPILER BINARY DISTRIBUTION FLOPPY  | | PRQ-SFT-HSD-5 | | | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  3RCC PERQ PASCAL COMPILER SOURCE DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981  | | | | Group name Command file  | | single density, double sided D.5 | |  | | | | PASCAL.BINARY BIN.CMD L | | Group name Command file | | INK.CMD | | | |--------------------------------------- ER = 1; {device code of FloppyDisk} a Disk Address can be distinguished from a Segment Address by the 19 Jul 81 type Temporary segments go away when processes are destroyed. Permanent segments per 19 Jul 81 Procedure JumpControlStore( Adrs: integer ); Abstract: Transfers control of the PE upper two bits (in 32 bits). These bits have a nonzero code to which disk the address is part of. RECORDIRQ micro engine to a particular address in the control-store. NOTE 1: Values may not beOBITS = #140000; {VirtualAddress upper 16 bits of disk} DISKBITS = RECORDIOBITS + (HARDNUMBER*(#20 loaded onto the expression stack before calling JumpControlStore. If you wish to pass values 000)); FLOPBITS = RECORDIOBITS + (FLOPPYNUMBER*(#20000)); The following definitions tell how many entriethrough the expression stack, the following code should be used rather than calling LoadControlStore. s are in the three pieces of the random index. The first piece (Direct) are blocks whose DiskAddresses are actual LoadExpr( LOr( Shift(Adrs,8), Shift(Adrs,-8) ) ); InLineByte( #277 {JCS} ); NOTE 2:ly contained in the Random Index (which is part of the FileInformationBlock). The second section has a list of  Microcode called by JumpControlStore should terminate with a "NextInst(0)" microcode jump blocks each of which contain 128 Disk Addresses of blocks in the file, forming a one-level indirect addressing  instruction. Parameters: Adrs - The address to jump to.  scheme. For very large files, the third section (DblInd) has DiskAddresses of blocks which point to other blocks wh - 23 - PERQ Operating System Interface - DiskIO ich contain 128 DiskAddresses of blocks in the file, forming a two level indirect scheme. DIRECTSIZE  19 Jul 81 Module DiskIO; Abstract: This module implements the basic low-level operations to dis = 64; { Entries in FIB of blocks directly accessable } INDSIZE = 32; { Entries in FIB ok devices; it services the Hard Disk and the Floppy. When dealing with the floppy here, the structures on the hard df 1 level indirect blocks } DBLINDSIZE = 2; { Entries in FIB of 2 level indirect blocks } FILESPERDisk are mapped to the structures on the floppy. Exports Imports Arith from Arith; Imports FileDefs from FileDefs; IRBLK = 16; { 256 / SizeOf(DirEntry) } NUMTRIES = 15; { number of tries at transfer before Imports IOErrors from IOErrors; const HARDNUMBER = 0; {device code of Shugart Disk} FLOPPYNUMBaborting } - 24 - PERQ Operating System Interface - DiskIO   | | Group name Command file | |  | | DOCUMENTATION DOC.CMD | |  | | MICROCODE.SUPPORT.SOURCE SRC.CMD | |  | |---------------------------------------------------------------| |  | |---------------------------------------------------------------| |  | | PRQ-SFT-NBD-5 | | 3RCC | | PRQ-SFT-LBD-5 | | 3RCC PERQ PERQ MORE DOCUMENTATION DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | |  MICROCODE BINARY DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | sin single density, double sided D.5 | | |gle density, double sided D.5 | | | |  | Group name Command file | |  Group name Command file | |  | | DOCUMENTATION.MORE DOC.CMD | | | | MICROCODE.BINARY BIN.CMD | | MICROCODE.SUPPORT.BINARY SUPBIN.CMD SUPLNK.CMD  | |---------------------------------------------------------------| Labels for Source Systems  | | | |--------------------------------------------------- Page 4/4 |---------------------------------------------------------------| | ------------| | | | PRQ-SFT-MBD-5  | | PRQ-SFT-OSD-5 | | 3RCC PERQ TEST PROGRA | | 3RCC PERQ DOCUMENTATION DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers ComputeM SOURCE DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, | | 3RCC PERQ MICROCODE SUPPORT SOURCE DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corr Corporation, 1981 | | single density, double sided D.5 | | poration, 1981 | | single density, double sided D.5 | |  | | Group name Command file | |   which contains SegIDs of files along with their names. Directories are hash coded by file name to make lookup t of the FileInformationBlock; the FIB has Logical Block -1 } 4: ( FSDatafast. They are often sparse files, i.e., contain unallocated blocks between allocated blocks. The file name is a  : FSDataEntry; {The Random Index is a hint of the DiskAddresses of SimpleName, since a directory can only contain entries for files within the partition (and thus device) where the direct the blocks that form the file. It has three parts as noted above. Notiory itself is located. DirEntry = packed record InUse : boolean; {tce that all three parts are always there, so that even in a very large file, sist until explicitly destroyed. Bad Segments are ill-formed segments which are not readable by the Segment rue if this DirEntry is valid} Deleted : boolean; {true if entry deleted but not expsystem. SpiceSegKind = (Temporary, Permanent, Bad); PartitionType = (Root, UnUsed, Leaf); unged} Archived : boolean; {true if entry is on backup tape} UnUs {A Root Partition is a device} DeviceType = (Winch12, Winch24, FloppySingle, FloppyDouble, ed : 0..#17777; {reserved for later use} ID : SegID; File UnUsed1, UnUsed2); MyDble = Array [0..1] of integer; DiskCheatType = record case inname : SimpleName end; DiskBuffer = packed record case integer of teger of 1: ( Addr : DiskAddr );  - 25 - PERQ Operating System Interface - DiskIO 19 Jul 81  2: ( Dbl : MyDble { should be IO.Double but d 1: ( Addr : array [0..(DISKBUFSIZE div 2)-1] of DiskAddr on't import IO in export section } ); 3: ); 2: ( IntData : array [0..DISKBUFSIZE-1] of  ( Seg : SegID ); 4: (  FSBit16 ); 3: ( ByteData  Lng : FSBit32 ) end; A directory is an ordinary file: packed array [0..DISKBUFSIZE*2-1] of FSBit8 ); {4 is forma  | | Group name Command file | |  | single density, double sided D.5 | |  double sided D.5 | | | | Group nam | | DEMO.SOURCE SRC.CMD | | e Command file | | | | TES DEMO.SIGGRAPH.SOURCE SIGSRC.CMD | | |T.SOURCE SRC.CMD | | | |-- |---------------------------------------------------------------| | -------------------------------------------------------------| |  | | PRQ-SFT-RBD-5 | | 3RCC PERQ DEMONSTRATION PROGRAM BINARY DISTRIBU| | PRQ-SFT-PBD-5 | | 3RCC PERQ TEST PROGRAM BINARY DISTRIBUTION FLOPPY TION FLOPPY| | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  | | | | Group name Command  | | | | Group name Command file file | | | | DEMO.BINARY BI | | | | TEST.BINARY BIN.CMDN.CMD LINK.CMD | | DEMO.SIGGRAPH.BINARY SIGBIN.CMD SIGLNK.CMD | |  LINK.CMD | | | |--------------------------------- | |---------------------------------------------------------------| Labels for Non-Sour------------------------------| | | | PRQ-SFT-QSD-5 ce Systems Page 1/3 |---------------------------------------------------------------| |  | | 3RCC PERQ DEMONSTRATION PROGRAM SOURCE DISTRIBUTION FLOPPY| | Copyright (C) Th | | PRQ-SFT-ABD-5 | | ree Rivers Computer Corporation, 1981 | | single density, double sided D.5 | |  3RCC PERQ SYSTEM D.5 BOOT FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 |  ddr; SegKind : SpiceSegKind; NumBlksInUse : integer;  tail of the free list} NumFree : FSBit32;  {segments can have gaps, block n may exist when block  {Hint of how many blocks are on the free list} RootDirID : SegID;  n-1 has never been allocated. NumBlksInUse says how many data  {where to find the Root Directory} BadSegID : SegID; blocks are actually used by the segment} LastBlk : FSBit16;  {where the bad segment is} {when booting, the boot character is  {Logical Block Number of largest block allocated}  indexed into the following tables to find where code to be boot loaded is found }  LastAddr : DiskAddr; {DiskAddr of LastBlk } LastNegBlk : FSBit1 BootTable : array [0..25] of DiskAddr; {qcode} InterpT6; {Logical Block Number of largest pointer block able: array [0..25] of DiskAddr; {microcode} PartName : packed array  the first DIRECTSIZE blocks can be located quickly. The blocks in the Random index  allocated} - 26 - PERQ Operating System Interface - DiskIO  have logical block numbers that are negative. The logical block number of  19 Jul 81 LastNegAddr: DiskAddr {Block number of LastNe Indirect[0] is -2 (the FIB is -1). The last possible block's number is gBlk} ); {5 is the format of the DiskInformationBlock} 5: (  -(INDSIZE+DBLINBDSIZE+1)} Direct : array [0..DIRECTSIZE-1] of  {The Free List is a chain of free blocks linked by their headers }  DiskAddr; Indirect: array [0..INDSIZE-1] of  FreeHead : DiskAddr; {Hint of Block Number of the head of  DiskAddr; DblInd : array [0..DBLINDSIZE-1] of DiskAthe free list} FreeTail : DiskAddr; {Hint of Block Number of the   | | Group name Command file |  | | | | UTILITY.BINARY BIN.CMD LINK.CMD | | | OS.IO.SOURCE SRC.CMD  | | | |------------------------------------------------- | | | |--------------------------------------------------------------------| Labels for Non-Source Systems Page 2/3 |----------------------------------------------| | | | PRQ-SFT-DBD-5 --------------------------| | | | PRQ-SFT-IBD-5  | |---------------------------------------------------------------| |  | | 3RCC PERQ SYSTEM D.5 BINARY DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer C | | PRQ-SFT-BND-5 | | 3RCC PERQ SYSTEM D.5 SOURCE DISTRIBUTION Forporation, 1981 | | single density, double sided D.5 | | LOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5  | | Group name Command file | |  | | | | Group name Com | | OS.BINARY BIN.CMD LINK.CMD | | OS.MISCELLANEOUS mand file | | | | OS.SOURCE  MISC.CMD | | | |------------------ SRC.CMD | | | |--------------------------------------------------------------------| | | | PRQ-SFT----------------------------------------| | | | PRQ-SFT-CND--GBD-5 | | 3RCC PERQ UTILITY PROGRAM BINARY DISTRIBUTION FLOPPY | | C5 | | 3RCC PERQ SYSTEM D.5 IO SOURCE DISTRIBUTION FLOPPY | | Copyriopyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5 | |ght (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5 | |  | | Group name Command file  t of a block of a Directory} 6: ( Entry : array [0..FILESPERDIRBLK-1] of rHeader; dskcommand : DiskCommand); Function LogAddrToPhysAddr(addr : DiskAddr) : DiskAddr; Function PhysAddrToLogAddr(disk :  DirEntry ) end; ptrDiskBuffer = ^DiskBuffer; integer; addr : DiskAddr) : DiskAddr; Function LastDiskAddr(DevType : DeviceType) : DiskAddr; Func Header = packed record {format of a block header} SerialNum : DiskAddr; tion NumberPages(DevType : DeviceType) : FSBit32; Procedure DiskReset; Function TryDiskIO(addr : DiskAddr; ptr : ptrDiskBuffe {Actually has the SegID of the file} LogBlock : integer; {logical blocr; hptr : ptrHeader; dskcommand : DiskCommand; numTries: integer) : boolean; Exck number} Filler : integer; {holds a hint to a candidate for the eption DiskFailure(msg: String; operation: DiskCommand; addr: DiskAddr; softStat: integer); Exceptio - 27 - PERQ Operating System Interface - DiskIO 19 Jul 81 n DiskError(msg: String); Exception BadDevice; Var ErrorCnt : Array[IOEFirstError..IOELastError] of integer;  FreeHead} PrevAdr : DiskAddr; {Disk Address of the next block in this  - 28 - PERQ Operating System Interface - DiskIO 19 Jul 81  segment} NextAdr : DiskAddr; {Disk Address of the previous block in  Procedure InitDiskIO; Abstract: Initializes the DiskIO package. Side Effects: C this segment} end; ptrHeader = ^Header; DiskCommand= (DskRead, DskWritereates a new segment (DiskSegment). Sets Initialized. Calls: CreateSegment Function NumberPages(DevT, DskFirstWrite, DskReset, DskHdrRead, DskHdrWrite); {last ones for error reporting} ype:DeviceType) : FSBit32; Abstract: Returns number of pages on a disk. Parameters: [1..8] of char; PartStart : DiskAddr; PartEnd : DiskAddr;  var DiskSegment : integer; {a memory segment for DiskIO} Procedure InitDiskIO; Procedure ZeroBuffer(ptr : ptrDi SubParts : array [0..63] of DiskAddr; PartRoot : DiskAddr; skBuffer); Function WhichDisk(addr : DiskAddr) : integer; Function AddrToField(addr : DiskAddr) : integer; Function FieldToAd PartKind : PartitionType; PartDevice : DeviceType ); {6 is the formadr(disk: integer; fld : integer) : DiskAddr; Procedure DiskIO(addr : DiskAddr; ptr : ptrDiskBuffer; hptr : pt  | | 3RCC PERQ MICROCODE SOURCE DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 19n, 1981 | | single density, double sided D.5 | | 81 | | single density, double sided D.5 | |  | | Group name Command file | |  | | Group name Command file | |  | | DOCUMENTATION DOC.CMD | |  | | MICROCODE.SOURCE SRC.CMD | |  | |---------------------------------------------------------------| |  | |---------------------------------------------------------------| |  | | PRQ-SFT-NBD-5 | | 3RCC PERQ MORE D | | PRQ-SFT-LBD-5 | | 3RCC PERQ MICROCODE BOCUMENTATION DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single denINARY DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density,sity, double sided D.5 | | | | Grou | | 3RCC PERQ PASCAL COMPILER BINARY DISTRIBUTION FLOPPY | | Copyright (C) Three  double sided D.5 | | | | Group namRivers Computer Corporation, 1981 | | single density, double sided D.5 | | e Command file | | | | MIC | | Group name Command file | | ROCODE.BINARY BIN.CMD | | MICROCODE.SUPPORT.BINARY SUPBIN.CMD SUPLNK.CMD | |  | | PASCAL.BINARY BIN.CMD LINK.CMD | |  | |--------------------------------------------------------------- | |---------------------------------------------------------------| | | | | | PRQ-SFT-MBD-5  | | PRQ-SFT-JBD-5  | | 3RCC PERQ DOCUMENTATION DISTRIBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporatio DevType - a device code Function LastDiskAddr(DevType:DeviceType) : DiskAddr; Abstract: Returns Disk  Parameters: addr - the disk address to be converted Calls: MapAddr Function PhysAddrTAddress of last possible page on a disk. Parameters: DevType - device code Calls: NuoLogAddr(disk : integer; addr : DiskAddr) : DiskAddr; Abstract: Translates a mberOfPages Procedure ZeroBuffer(ptr : ptrDiskBuffer); Abstract: Clear buffer to zeroes Param Physical Disk Address to a logical disk address. Parameters: disk - Device code of disk eters: ptr - a pointer to a disk buffer Function WhichDisk(addr : DiskAddr) : integer; Abstract:  addr - Physical address to translate Calls: UnMapAddr  Returns disk device of a DiskAddr Parameters: addr - a DiskAddr that you want the device code fo - 30 - PERQ Operating System Interface - DiskIO 19 Jul 81 Procedure DiskReset; r. - 29 - PERQ Operating System Interface - DiskIO  Abstract: Resets the Hard Disk and recalibrates the drive. Calls: UnitIO Design: 19 Jul 81 Function AddrToField(addr : DiskAddr) : integer; Abstract: Returns a short (one word) disk  Assuming that the disk is at track 201, seek in one track until the Track 0 bit in the disk stataddress by taking the low byte of the most significant word of the Disk Address and the upper byte ous is set; then force the microcode to believe that this is Track 0, and reset the disk controller f the least significant word. Parameters: addr - the Disk Address to get a short address for Functionagain. Procedure DiskIO(addr: DiskAddr; ptr: ptrDiskBuffer; hptr: ptrHeader; dskcommand: DiskCommand);  FieldToAddr(disk: integer; fld : integer) : DiskAddr; Abstract: Returns a DiskAddress given a short addre Abstract: Calls DoDiskIO with DieOnError set true; does 15 retries (3 recalibrates) Pss and the disk device code. Parameters: disk - the disk device code fld - tarameters: see DoDiskIO Function TryDiskIO(addr : DiskAddr; ptr : ptrDiskBuffer; hptr : he short address (returned by AddrToField at some point) Function LogAddrToPhysAddr(addr : DiskAddr) : DptrHeader; dskcommand : DiskCommand; numTries: integer) : boolean; Abstract: Calls DoiskAddr; Abstract: Converts a Logical DiskAddress to a Physical Disk Address. DiskIO with DieOnError set false Parameters: see DoDiskIO Returns: true if transfer  Page 3/3 |---------------------------------------------------------------| |  Page 1/1 |---------------------------------------------------------------| |  | | PRQ-SFT-PBD-5 | | 3RCC PERQ TEST PROGRAM BINARY DISTR | | 3RCC USER LIBRARY SOURCE DISTRIBUTION FLOPPY | | IBUTION FLOPPY | | Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided  | | ****************************************** | | * NOT DISTRI D.5 | | | | Group name BUTED WITH STANDARD SOFTWARE * | | ****************************************** | |  Command file | | | | TEST.BINARY  | | single density, double sided D.5 | |  BIN.CMD LINK.CMD | | | |---------------- | | Group name Command file | -----------------------------------------------| | | | PRQ-S| | | USERLIBRARY SRC.CMD FT-RBD-5 | | 3RCC PERQ DEMONSTRATION PROGRAM BINARY DISTRIBUTION FLOPPY| |  | | | |------------------------------------------------------ Copyright (C) Three Rivers Computer Corporation, 1981 | | single density, double sided D.5 | ---------|  | | | Group name Command file p name Command file | | | |  | | | | DEMO.BINARY BIN.CMD LINK.CMD  DOCUMENTATION.MORE DOC.CMD | | | | | DEMO.SIGGRAPH.BINARY SIGBIN.CMD SIGLNK.CMD | |  |---------------------------------------------------------------| Labels for Non-Source Systems  | |---------------------------------------------------------------| Labels for Internal Use Only  re DisposeP( var P: MMPointer; L: integer ); Procedure DisposeP( var P: MMPointer; L: integer ); Abstract: ode. FullMemory if NewP tries to expand the segment, but there enough physical memory to  Deallocates memory. Parameters: P - Pointer to the memory. L - Length in words, 0 rdo so. - 33 - PERQ epresents a length of 2**16. If L is odd, L+1 words are de-allocated. Errors: BadPointOperating System Interface - Except 19 Jul 81 Module Except; Abstract: Module Except provides thwent ok, false if errors occurred - 31 - PERQ Opeer if the Offset part is odd, if Offset+Length > size of segment, or if the node to be Dispose rating System Interface - Dynamic 19 Jul 81 Module Dynamic; Abstract: Dynamic implements Pascal overlaps some node that is already free. NilPointer if P is nil.  dynamic allocation - New and Dispose. Memory of a given size with a given alignment may be allocated from any data  - 32 - PERQ Operating System Interface - Dynamic 19 Jul 81 Procedure NewP( S: SegmentNumbesegment. If the data segment is full (doesn't contain enough free memory to allocate), the segment is increased r; A: integer; var P: MMPointer; L: integer ); Abstract: Allocates memory. Paramein multiples of the segment's increment size until there is enough free memory to allocate. Similarly, memory that ters: S - Number of segment to allocate from. 0 means the default data segment. was once allocated may be deallocated. Design: Free memory within each segment is linked into a circular freelist  A - Alignment of node in words relative to beginning of segment, 0 represents an alignment of 2**16.  in order of address. Each free node is at least two words long and is of the form: record Next: Integer;  if A is odd, A+1 is used as the alignment. P - Set to point to the memory that was allocat Length: Integer; Rest: 2*Length - 2 words end; Where Next*2 is the address ed. If the data segment is full and cannot be increased, P is set to nil. of the next free node and Length*2 is the number of free words. Exports const DynamicVersion = '1.3'; Imports ML - Length in words, 0 represents a length of 2**16. If L is odd, L+1 words are allocated. Errors: emory from Memory; Procedure NewP( S: SegmentNumber; A: integer; var P: MMPointer; L: integer ); Procedu FullSegment if the segment has reached its maximum size and there isn't enough room for the n  Perq.Files - PERQ Files Information Perq.Files is a list of the files distributed with the Three Riv ---------------------------- SYSTEM.PAS D.5 SYSTEM.PAS Operating systemers Computer Corporation PERQ. Source files are included in this list, but please note that they are included with  main program. SYSTEMDEFS.PAS D.5 SYSDEF.PAS Common system definitions. LIGHTS.PAS  the PERQ only if a source license is purchased. The User Library programs are also listed, but must be ordered from 1.1 LIGHTS.PAS Definitions of the lights. ARITH.PAS 2.2 ARITH.PAS  Trust - The Three Rivers Users' Society. Copyright (C) 1981 Three Rivers Computer Corporation 720 Gross St Double precision arithmetic for the disk system. SHELL.PAS 1.18 SHELL.PAS reet Pittsburgh, PA 15224 (412) 621-6250 Modified: 19 Jul 81 JPS System D.5. 13 Jul  Top-level command processor. LINK.PAS 3.10 LINK.PAS Q-Code linker. LOGIN.PAS 81 BAM (removed PDM.Seg stuff from Perq.Files) 10 Jul 81 BAM (fixed version numbers)  1.13 LOGIN.PAS Login program. PROFILE.PAS 1.0 PROFILE.PAS  6 Jul 81 BAM (removed EF1) 12 Jun 81 JPS 11 Jun 81 BAM 1 Jun 8 Module for accessing the profile. USERPASS.PAS 1.3 USERPA.PAS Lookup user name/password p1 BAM 4 Apr 81 DAS 21 Apr 81 JPS 4 Apr 81 JPS 31 Mairs. LOADER.PAS 2.3 LOADER.PAS Perq Q-Code loader. CODE.PAS 1.5 CODE.PAar 81 JPS 30 Mar 81 DAS 28 Mar 81 DAS 26 Mar 81 DAS S Run file and seg file definitions. RUNREAD.PAS 1.0 RUNREA.PAS Proce16 Mar 81 DAS 6 Mar 81 JPS. 4 Mar 81 JPS and DAS. 17 Feb 81 JPS. dures to read run files. RUNWRITE.PAS 1.0 RUNWRI.PAS Procedures to write run files. DYNAMIC 26 Jan 81 JPS. 22 Dec 80 JPS. 21 Nov 80 JPS. 20 Nov 80 .PAS 1.3 DYNAMI.PAS Dynamic allocation routines - New and Dispose. PERQ_STRING.PAS 2.3JPS. 10 Nov 80 JPS. 23 Oct 80 JPS. >OS.SOURCE - O PERQST.PAS String manipulation package. MEMORY.PAS 2.5 MEMORY.PAS PERATING SYSTEM SOURCES file name version file name on floppy --------- short description.  Memory manager. VIRTUAL.PAS 2.4 VIRTUA.PAS The Swapper. MOVEMEM.PAS 1.4  is also defined in Except.Dfs as 0. Since the microcode must know this, it is strongly suggested that it not b Long Integer } Procedure InitExceptions; Abstract: InitExceptions telle modified. The routine number of InitExceptions is not needed by the compiler or PERQ.Micro, but it has been assigns the microcode what segment number to use when raising its own exceptions. The segment number is ed routine number 1 so that its number will not change when new exceptions are defined. This means that new ethe one that the system assigns to this module. Side Effects: ExcSeg is set to the current segment number.xceptions may be defined without requiring that the operating system be re-linked. Exports const ExceptVersion  The current segment is kept resident. Procedure RaiseP( ES, ER, PStart, PEnd: Integer ); Abstract: = '2.5'; Procedure RaiseP( ES, ER, PStart, PEnd: Integer ); Procedure InitExceptions; Exception Abort( Message: String ); RaiseP is called to raise an exception. The compiler generates a call to RaiseP in response to: Exception Dump( Message: String ); Exception XSegmentFault( S1,S2,S3,S4: Integer ); { segment fault } Exception XStackOverf raise SomeException( original parameters ) in the following way: Pushe following things: 1) Definitions of the microcode generated exceptions. 2) A procedure to tell the microcode wlow; { stack overflow } Exception DivZero; { division by zero } Exception MulOvfl; { overflow in mhich segment number these exceptions are defined in. 3) The default handler of all exceptions. The compileultiplication } Exception StrIndx; { string index out of range } Exception StrLong; { string to be assigned is too long } r enables this handler in every main program. 4) A Pascal routine to search the stack when an exception is Exception InxCase; { array index or case expression out of range } Exception STLATETooDeep; { parameter in STLATE instructio raised. Design: The file Except.Dfs is included into PERQ.Micro as well as into this module. It definn is too large } Exception UndfQcd; { execution of an undefined Q-code } Exception UndfInt; { es routine numbers for the exceptions generated by the microcode. Note that there must be agreement between tundefined device interrupt detected } Exception IOSFlt; { segment fault detected during I/O } Exception MParity; { memoryhese constants and the routine numbers of the exception definitions. No program checks these--if you add or remo parity error } Exception EStack; { E-stack wasn't empty at INCDDS } Exception OvflLI; { Overflow in conversion to integve exception definitions you must be sure to update Except.Dfs in the appropriate way. The routine number of RaiseP er from - 34 - PERQ Operating System Interface - Except 19 Jul 81 Set RS232 baud rate with optional enable input. GPIB.PAS 1.2 GPIB.PAS Routines for deali Other Input/output manager procedures and functions. IO_UNIT.PAS 5.4 IOUNIT.PAS ng with the Perq IEEE-488 bus. RANDOMNUMBERS.PAS 1.2 RANDOM.PAS High-qualitThe basic UnitIO procedures and functions. IO_PRIVATE.PAS 5.7 IOPRIV.PAS Interrupt procedures y random number generator. CMDPARSE.PAS 2.0 CMDPAR.PAS Command parser. UTILPROGRESS.PAS and private definitions. IO_INIT.PAS 5.7 IOINIT.PAS Input/output manager initialization. FMOVEME.PAS Memory manager utility to move segments. SCROUNGE.PAS 0.11 SCROUN.PAS  1.9 UTILPR.PAS Progress module for utilities. STREAM.PAS 1.12 STREAM.PAS  The preliminary debugger. CLOCK.PAS 1.5 CLOCK.PAS Get, set, convert time and da Stream package base routines - Get and Put. WRITER.PAS 2.2 WRITER.PAS Stream pacte as TimeStamp or String. GETTIMESTAMP.PAS 1.4 GETTIM.PAS Get time and dakage output conversion routines. READER.PAS 2.1 READER.PAS Stream package input conversionte as TimeStamp. EXCEPT.PAS 2.5 EXCEPT.PAS The exceptions module. EXCEPT.DFS 1. routines. VRD.DFS 1.0 VRD.DFS Variable Routine Descriptor Definitions 2 EXCEPT.DFS Definitions of the exceptions--common to microcode and Pascal. EE common to Pascal and microcode >OS.IO.SOURCE - INPUT/OUTPUT SYSTEM SOURCE MODULES file nB.DFS 1.0 EEB.DFS Exception Enable Block definitions--common to Pame version file name on floppy --------- short description. ---------------------ascal and microcode RD.DFS 1.1 RD.DFS Routine dictionary definiti------- SCREEN.PAS 3.9 SCREEN.PAS Screen manager. RASTER.PAS - RASTER.ons--common to microcode and Pascal. ACB.DFS 1.1 ACB.DFS ActivatiPAS Raster-op definitions. IOERRORS.PAS 1.2 IOERRO.PAS Input/output eron control block definitions--common to microcode and Pascal. CONTROLSTORE.PAS 1.1 CONTRO.PAS ror number constants. IOERRMESSAGES.PAS 1.1 IOERRM.PAS Names for the Input/output errors. IO.PAS Load controlstore and jump to controlstore. RS232BAUD.PAS 1.1 RS232B.PAS  4.8 IO.PAS Input/output manager. IO_OTHERS.PAS 5.5 IOOTHE.PAS  := TP. Push ExcSeg onto the MStack. Push Error onto the MStack. Push Saion, and to prevent unlimited recursion in an exception handler that has a bug. If an exception hveTP-ParameterSize+1 onto the MStack. Push SaveTP+1 onto the MStack. call RaiseP. andler is found, the original parameters are pushed onto the MStack and the handler is called with CParameters: ER - Routine number of the exception to be raised. ES - Segment number of the exception ALLV. If no exception handler is found, HandleAll is called. NOTE: *** RaiseP may not coto be raised. PStart - Pointer to the original parameters (as an offset from the base of the stntain any exception handlers. *** RaiseP must be guaranteed to be resident. ack). PEnd - Pointer to the first word after the original Parameters: (as an offset fro - 36 - PERQ Operating System Interface - FileAccess m the base of the stack). Calls: - 35 - PERQ Operating 19 Jul 81 Module FileAccess; Abstract: Module handles reading, writing, entering and deleting file System Interface - Except 19 Jul 81 Appropriate exception handler or HandleAll. Ds independent from the directory structure. Exports Imports Arith from Arith; Imports DiskIO from DiskIO; Importesign: See the "PERQ QCode Reference Manual, Q-Machine Architecture" for a description s AllocDisk from AllocDisk; Function CreateSpiceSegment(partition : integer; kind : SpiceSegKi of the format of exception enable blocks and the format of variable routine descriptornd) : SegID; Procedure DestroySpiceSegment(id : SegID); Procedure TruncateSpiceSegment(id : SegID; len : integer); Procedure  original parameters onto the MStack. RAISE SegmentNumber(SomeException) RoutineNumbs. RaiseP searches the exception enable list of each routine in the dynamic chain. When it er(SomeException) ParameterSize The microcode calls RaiseP in the following way: finds one that matches ER and ES it searches the dynamic chain again to see if the specified handler is  Push parameters onto the MStack if appropriate. ParameterSize := WordsOfParameters.  already active. If it is active, RaiseP continues searching the exception lists and dynamic  Error := ErrorNumber, Goto(CallRaise). Where CallRaise does the following: SaveTP chain where it left off. This is done in order to allow a handler to re-raise the same except  FILEUT.PAS File utilities not needed by system. FILETYPES.PAS 1.2 FILETY.PAS  1.7 FILEAC.SEG PMATCH.SEG 2.1 PMATCH.SEG IO.SEG 4.8 IO.SEG IO_OTHERS.SEG 5. Definitions for the file type field. >OS.BINARY - OPERATING SYSTEM SEG AND RUN 5 IOOTHE.SEG IO_UNIT.SEG 5.4 IOUNIT.SEG IO_PRIVATE.SEG 5.7 IOPRIV.SEG IO_INIT.SEG 5.7 FILES file name version file name on floppy --------- short description. - IOINIT.SEG MOVEMEM.SEG 1.4 MOVEME.SEG SCROUNGE.SEG 0.11 SCROUN.SEG CLOCK.SEG 1.5 --------------------------- :LINK - SYSTEM.5=SYSTEM/SYSTEM SYSTEM.SEG D.5 SYSTEM.SEG : CLOCK.SEG GETTIMESTAMP.SEG 1.4 GETTIM.SEG EXCEPT.SEG 2.5 EXCEPT.SEG CONTROLSTORE.SEG 1.1 LINK - SHELL.5=SHELL SHELL.SEG 1.18 SHELL.SEG :LINK - LINK.5=LINK CONTRO.SEG RS232BAUD.SEG 1.1 RS232B.SEG GPIB.SEG 1.2 GPIB.SEG RANDOMNUMBERS.SEG 1.2 RAND LINK.SEG 3.10 LINK.SEG :LINK - LOGIN.5=LOGIN LOGIN.SEG 1.13 LOGIN.SEG POM.SEG CMDPARSE.SEG 2.0 CMDPAR.SEG UTILPROGRESS.SEG 1.9 UTILPR.SEG FILEUTILS.SEG 1.8 FILEUTILESYSTEM.PAS 7.1 FILESY.PAS File system--high-level disk input/output roROFILE.SEG 1.0 PROFIL.SEG USERPASS.SEG 1.3 USERPA.SEG LOADER.SEG 2.3 LOADER.SEG RUNRutines. FILEDEFS.PAS 1.2 FILEDE.PAS Definitions used by the File System. DISKIO.PAS EAD.SEG 1.0 RUNREA.SEG RUNWRITE.SEG 1.0 RUNWRI.SEG DYNAMIC.SEG 1.3 DYNAMI.SEG PERQ_S 3.12 DISKIO.PAS Medium-level disk input/output routines. ALLOCDISK.PAS 2.7 ALLOCD.PAS TRING.SEG 2.3 PERQST.SEG MEMORY.SEG 2.5 MEMORY.SEG VIRTUAL.SEG 2.4 VIRTUA.SEG STREAM.S Allocation of sectors from the disk free list. READDISK.PAS 1.3 READDIEG 1.12 STREAM.SEG WRITER.SEG 2.2 WRITER.SEG READER.SEG 2.1 READER.SEG SCREEN.SEG.PAS Upper-level disk input/output routines. FILEDIR.PAS 2.6 FILEDI.PAS  3.9 SCREEN.SEG IOERRMESSAGES.SEG 1.1 IOERRM.SEG FILESYSTEM.SEG 7.1 FILESY.SEG FILEDEFS.SEG File system directory routines. FILEACCESS.PAS 1.7 FILEAC.PAS File system segment routines. 1.2 FILEDE.SEG DISKIO.SEG 3.12 DISKIO.SEG ALLOCDISK.SEG 2.7 ALLOCD.SEG ARITH.SEG  PMATCH.PAS 2.1 PMATCH.PAS Directory search with wild cards. FILEUTILS.PAS 1.8  2.2 ARITH.SEG READDISK.SEG 1.3 READDI.SEG FILEDIR.SEG 2.6 FILEDI.SEG FILEACCESS.SEG  Segment(id : SegID; firstblk,numblks : integer; ptr : ptrDiskBuffer); Procedure Index(logblk : intthe partition in which to allocate file; kind is the type of the file. Returns: ID of feger; var indblk,indoff : integer); Exception BadLength(len: integer); Abstract: Raised if you try toile created. Errors: Raises NotAFile if block at id does not seem to be a valid FI truncate file to a length < 0. Parameters: len - bad length. Exception NotAFile(id: SegID); Blk. Procedure DestroySpiceSegment(id : SegID); Abstract: Delete a file. Parameters: Abstract: Raised when an operation is attempted and the SegID passed does not seem to be the i id - the SegId of file to delete. Side Effects: removes id from filesystem. Errors: d for a valid file. Parameters: id - the bad id. Procedure Index(logblk : integer; var indblk,indoff  Raises NotAFile if block at id does not seem to be a valid FIBlk. Procedure TruncateSpiceSegm: integer); Abstract: Find the index block and the offset from the top of the block for a ent(id : SegID; len : integer); Abstract: Removes blocks from file to make the new length len. Parlogical block of a file. Parameters: logBlk - the logical block of the file to look up; may be ameters: id - the SegId of file; len is the new length (one greater than the last lo negative. indBlk - the logical block number of the index block which holds the addgical block number since files start at 0). Side Effects: Shortens the file. Erress for logblk. - 37 - PERQ Operating System Interface - FileAccess rors: Raises BadLength is length to truncate file to is < 0. Raises NotAFile if block at id does no19 Jul 81 indoff - the offset in indBlk to use in reading the address (the arrat seem to be a - 38 - PERQ Operating System Interface - FileAccess y index to use in DiskBuffer^.Addr). It is correctly set even if the indBlk  19 Jul 81 valid FIBlk. Procedure ReadSpiceSegment(id : SegID; firstblk,numblks : integer; is the FIBlk. Function CreateSpiceSegment(partition : integer; kind : SpiceSegKind) : SegID; ptr : ptrDiskBuffer); Abstract: Reads one or more blocks from file. ParameterReadSpiceSegment(id : SegID; firstblk,numblks : integer; ptr : ptrDiskBuffer); Procedure WriteSpice Abstract: Creates a new empty file on partition specified. Parameters: partition -  in profile. SYSTEM.5.CONFIG - SYSTEM.CON Description of swappability for use by MakeBoot. EM.nn.BOOT files. CHATTER.PAS 0.6 CHATTE.PAS RS232 dumb terminal program. FLOPPYDUP.PAS  >UTILITY.SOURCE - UTILITIES SOURCES file name version file name on floppy ---------  1.3 FLPDUP.PAS Duplicate floppy disks. EXPANDTABS.PAS 1.0 EXPAND.PAS  short description. ---------------------------- FTPMAIN.PAS 2.2 FTPMAI.PAS  Copy a text file and expand tabs to 8 character columns. DETAILS.PAS 1.7 DETAIL.PAS  File-utility file transfer module. FTP.PAS 2.2 FTP.PAS File transfer.  Print system status information. BYE.PAS 2.2 BYE.PAS Logoff. GOOPLX.PAS 1.5 PLX.PAS RT-11 floppy disk utility. PLXUTIL.PAS 1.3 PLXUTI.PASDBY.MICRO 1.0 GOODBY.MIC Power down microcode. USERCONTROL.PAS 1.2 USERCO.PAS  PLX utility routines. EDITOR.PAS 1.9 EDIT.PAS Editor main program. Add/delete users from the password file. FLOPPY.PAS 2.1 FLOPPY.PAS Test  EDITORI.PAS - EDITI.PAS Editor initialization module. EDITORU.PAS - EDIand format floppies >UTILITY.FILE.SOURCE - FILE SYSTEM UTILITIES SOURCES file name verTU.PAS Editor utilities module. EDITORK.PAS - EDITK.PAS Editor key-sion file name on floppy --------- short description. ---------------------------- TYPEFILE.selection module. EDITORT.PAS - EDITT.PAS Editor termination module. EDITORF.PAS PAS 3.2 TYPEFI.PAS Type file to the console. RENAME.PAS 3.3 RENAME.PAS .SEG >OS.MISCELLANEOUS - OPERATING SYSTEM SPECIAL FILES file name ve - EDITF.PAS Editor file manipulation module. PRINT.PAS 1.3 PRINT.PAS rsion file name on floppy --------- short description. ---------------------------- FIX13. Print a text file on an HP 7310A printer or through the TNW GPIB to RS232 converter. PERQ.FILEKST - FIX13.KST System character set file. SYSTEM.USERS - SYSTEM.USE S.PAS 1.3 PERQFI.PAS Program to gobble this file. PATCH.PAS 1.4 PATCH.PAS  Valid system users and passwords. DEFAULT.PROFILE - DEFAUL.PRO Default log Program to peek and poke into files. MAKEBOOT.PAS 3.9 MAKEBO.PAS Make SYST  te the file. kind - the type of the file. - 39 - PERQ Operating Systeile in blocks} FileBits : 0..4096; {Number of bits in last blk} FileSparse : Boolean; {tm Interface - FileAccess 19 Jul 81 Returns: ID of the file created..Reset( Exceptrue if can be sparse} FileOpenHow : FSOpenType; {howOpen} FileCreateDate : TimeStamp; s: id - the SegId of file. firstBlk - the logical blk # of first to read. numBlks - th Count Form Inx Output Page Select ) e number of blocks to read. ptr - where the data should be put. NOTE: If the blocks speci - 40 - PERQ Operating System Interface - FileDefs fied to read don't exist; ptr^ is filled with zeros. Errors: Raises NotAFile if block at i 19 Jul 81 Module FileDefs; Abstract: Defines some constants and types needed by various people sod does not seem to be a valid FIBlk. Procedure WriteSpiceSegment(id : SegID; firstblk,numblks : int FileSystem doesn't need to import DiskIO in its export section. Exports Imports GetTimeStamp from GetTimeStamp; {Usineger; ptr : ptrDiskBuffer); Abstract: Writes one or more blocks onto file. g TimeStamp} const DBLZERO = nil; {a two word 0} DISKBUFSIZE = 256; {defined by hardware, 256 Parameters: id - the SegId of file. firstBlk - the logical blk # of first to write.  words per sec} type FSBit8 = 0..255; FSBit16 = integer; FSBit32 = ^integer;  numBlks - the number of blocks to write. ptr - where the data should come from. Side Effects:  type SegID = FSBit32; {In SpiceSeg, the virtual address of the -1 block of a file} DiskAddr  Changes the data in the file and may cause new blocks to be allocated and file length changed. Erro = FSBit32; {The virtual address of a DiskBlock} SimpleName = string[25]; {only the filename rs: Raises NotAFile if block at id does not seem to be a valid FIBlk. Function Creain the directory} PathName = string[100]; {full name of file with partition and dev} PartialPathName tSpiceSegment (partition : integer; kind : SpiceSegKind) : SegID Abstract: Cr= string[80]; {file name including all directories} FSOpenType = (FSNotOpen, FSOpenRead, FSOpenWrite, eats a new empty file on the partition specified. Parameters: partition - the partition in which to alloca FSOpenExecute); FSDataEntry = packed record FileBlocks : integer; {Size of f  ting. DELETE.PAS 1.9 DELETE.PAS Delete a file or files. COPY.PAS 3.2 COP.SEG - EDITF.SEG EDITOR.HELP - EDIT.HEL :LINK 1.3 PRINT PRINT.SEG Y.PAS Copy a file to another. APPEND.PAS 2.1 APPEND.PAS Append a fil - PRINT.SEG :LINK 1.3 PERQ.FILES PERQ.FILES.SEG - PERQFI.SEG :LINK e to the end of another. SCAVENGER.PAS 3.1 SCAVEN.PAS Analyze and reconstruct disks and direc1.4 PATCH PATCH.SEG - PATCH.SEG :LINK 3.9 MAKEBOOT MAKEBOOT.SEG - Mtories. DIRSCAVENGE.PAS - DIRSCA.PAS Reconstruct directories. PARTITION.PAS 2.2 AKEBO.SEG :LINK 0.6 CHATTER CHATTER.SEG - CHATTE.SEG :LINK 1.3 FLOPPYPARTIT.PAS Initialize partitions on disks. SETSEARCH.PAS 1.2 SETSEA.PAS DUP FLOPPYDUP.SEG - FLPDUP.SEG :LINK 1.0 EXPANDTABS EXPANDTABS.SEG - EXPAND.SE Change search lists MAKEDIR.PAS 1.3 MAKEDI.PAS Make directories. DIRTREE.PAS 1.2G :LINK 3.2 TYPEFILE TYPEFILE.SEG - TYPEFI.SEG :LINK 3.3 RENAME RENA DIRTRE.PAS Display the directory structure of a partition as a tree. FIXPART.ME.SEG - RENAME.SEG :LINK 3.2 DIRECT DIRECT.SEG - DIRECT.SEG :LINK PAS 0.3 FIXPAR.PAS Fix smashed partition or disk information blocks.  1.9 DELETE DELETE.SEG - DELETE.SEG :LINK 3.2 COPY COPY.SEG - >UTILITY.BINARY - UTILITIES SEG FILES file name version file name on floppy --------- short desc COPY.SEG :LINK 2.1 APPEND APPEND.SEG - APPEND.SEG :LINK 1.7 Dription. ---------------------------- :LINK 2.2 FTP=FTPMAIN FTPMAIN.SEG ETAILS DETAILS.SEG - DETAIL.SEG :LINK 2.2 BYE BYE.SEG - BYE.SEG GOO- FTPMAI.SEG FTP.SEG - FTP.SEG :LINK 1.5 PLX PLX.SEG - PLX.DBY.BIN - GOODBY.BIN :LINK 3.1 SCAVENGER SCAVENGER.SEG - SCAVEN.SEG :LINK SEG PLXUTIL.SEG - PLXUTI.SEG :LINK 1.9 EDITOR EDITOR.SEG - EDIT.SEG ED 2.2 PARTITION PARTITION.SEG - PARTIT.SEG :LINK 1.2 USERCONTROL USERCONT Change the name of a file. DIRECT.PAS 3.2 DIRECT.PAS Print a directory lisITORI.SEG - EDITI.SEG EDITORU.SEG - EDITU.SEG EDITORT.SEG - EDITT.SEG EDITORF! } DefaultDeviceName : SimpleName; {ends in a colon} Function GetDisk(var name : PathName; var  : PathName; id : SegID) : boolean; Abstract: Enters a path name with a SegID id into a directory. partition : integer) : boolean; Abstract: Given a name, GetDisk removes the device and partition  Parameters: name - is the full name (including all directories and optional device and part specifications and finds the partition number. Parameters: name - is the full file name to parse;ition) of the file to enter; it is changed to remove all ">..>" and ">.>"s and remove  the device and partition are optional. The device and partition, if there, are remothe device (the name returned can be entered in the FileID block's FSData.Filename). id - is Seved from the name string. partition - is set to the partition specified or the default. gID of file; Returns: True if file successfully entered; false if device, partition or FileWriteDate : TimeStamp; FileAccessDate : TimeStamp; FileType : integer; {see FileType Returns: False if specified device or partition is malformed or not there. Side Eff.pas} FileRights : integer; {protection code} FileOwner : FSBit8; {UserId of file owner}ects: Mounts the partition if it's not already mounted. Calls: FindPartition, MountPartition FileGroup : FSBit8; {GroupId} Filename : PartialPathName; end; ptrFSData. - 42 - PERQ Operating System Interface - FileDir Entry = ^FSDataEntry; - 41 - PERQ Operating System Interface - FileDir  19 Jul 81 Function GetFileID(name : PathName) : SegID; Abstract: Find the SegID for a path name  19 Jul 81 Module FileDir; Abstract: The directory structure for PERQ FileSystem Exports (does a lookup) Parameters: name - is the full name (including all directories and o Imports FileDefs from FileDefs; Function GetFileID(name : PathName) : SegID; Function PutFileID(var name : PathName; id :ptional device and partition) of the file to look up. Returns: The SegID of the file  SegID) : boolean; Function DeleteFileID(name : PathName) : SegID; Function GetDisk(var name : PathName; or DBLZERO (a constant; this is a double word filled with zeroes) if the file is not there or parvar partition : integer) : boolean; var DefaultPartitionName : SimpleName; {includes device name and ends in a ">" t of name is malformed. Calls: ParseFilename, GetRootDirID, GetIDFromDir. Function PutFileID(var name! de interpreter routines for Perq.Micro (part 3). PERQ.QCODE.4 - QCODE.4 ode kernel. LINK.MICRO 1.1 LINK.MIC 16-bit parallel interface microcode.  Opcode interpreter routines for Perq.Micro (part 4). PERQ.QCODE.5 - QCODE.5  >MICROCODE.BINARY - MICROCODE BIN FILES file name version file name on floppy --------- ROL.SEG - USERCO.SEG :LINK 2.1 FLOPPY FLOPPY.SEG - FLOPPY.SEG :LINK  Opcode interpreter routines for Perq.Micro (part 5). PERQ.QCODE.6 - QCODE.6  1.2 SETSEARCH SETSEARCH.SEG - SETSEA.SEG :LINK 1.3 MAKEDIR MAKEDIR.SEG  Opcode interpreter routines for Perq.Micro (part 6). PERQ.ROUTINE.1 - RO- MAKEDI.SEG :LINK 1.2 DIRTREE DIRTREE.SEG - DIRTRE.SEG :LINK 0.3 UTIN.1 Subroutines for Perq.Micro (part 1). PERQ.ROUTINE.2 - ROUTIN.2  FIXPART FIXPART.SEG - FIXPAR.SEG >MICROCODE.SOURCE - MICROCODE SOURCES file name veSubroutines for Perq.Micro (part 2). PERQ.INIT - PERQ.INI Initialization for Perq.Microrsion file name on floppy --------- short description. ---------------------------- PERQ.M. RO.MICRO 0.5 RO.MIC Raster-op microcode. LINE.MICRO 1.1 LINE.MIC ICRO 2.2 PERQ.MIC Perq Q-code interpreter microcode. PERQ.DFS 1.3 PERQ.DF Line drawing microcode. IO.MICRO 1.7 IO.MIC Input/output microcode. IS Definitions of registers, constants, and entrypoints used by Perq.Micro and other O.DFS 1.2 IO.DFS Definitions of registers, constants, and entrypoi microprograms. PERQ.QCODES.DFS - QCODES.DFS Definitions of QCode instrunts used by IO.Micro and other microprograms. IOE3.MICRO 1.1 IOE3.MIC ction names and numbers. PERQ.QCODE.1 - QCODE.1 Opcode interpreter r Microcode to drive the 3MBaud EtherNet. VFY.MICRO 1.3 VFY.MIC Verify that the hardware outines for Perq.Micro (part 1). PERQ.QCODE.2 - QCODE.2 Opcode interseems to work. SYSB.MICRO 2.4 SYSB.MIC System boot microcode. BOOT.MICRO 4.0 preter routines for Perq.Micro (part 2). PERQ.QCODE.3 - QCODE.3 Opco BOOT.MIC Boot-prom microcode. KRNL.MICRO 1.1 KRNL.MIC Perq microc" urns: - 43 - PERQ Operating System Interface - FileDir 19 Jul 81 or reading disk blocks } Case Integer Of 2: ( Buffer:Array[0..255] Of Integer  SegID of file removed from Directory or DBLZERO (a constant; this is a double word filled  ); 3: ( ByteBuffer: Packed Array [0..511] of FSBit8 ) End; PD with zeroes) if the file is the file is not there or part of name is mal-formed. CalirBlk= ^DirBlk; FileID = integer; BlkNumbers = integer; SearchList = array[1..SEARCHSIZELIST] of PathNls: ParseFilename, GetRootDirID, GetIDFromDir. ame; ptrSearchList = ^SearchList; var FSDirPrefix:PathName; {current default directory including device and part} - 44 - PERQ Operating System Interface - FileSystem  FSSysSearchList: SearchList; - 45 - PERQ Operating System Interface - FileSystem  19 Jul 81 Module FileSystem; Abstract: Supplies the user level routines for file access. Export 19 Jul 81 Function FSLookUp(FileName:PathName; Var BlkInFile,BitsInLBlk: Integer): Fils Imports FileDefs from FileDefs; const FSVersion = '7.0'; { File system version number } BlksPerFile =#eID; Function FSLocalLookUp(FileName:PathName; Var BlkInFile,BitsInLBlk: Integer): FileID; Function F077777; { Max blocks in each file } FirstBlk =0; { Block number of the first data block in a file } LastBSSearch(var slist : SearchList; var FileName : PathName; var BlkInFile, BitsInLBlk: integer) : FileID; Func a sub-directory is malformed. NOTE: IT IS WRONG TO CALL PutFileID FOR A NAME THAT IS ALREADY lk =#077776; { Block number of the last data block in a file. } FIBlk =-1; { Block number of the F IN THE DIRECTORY BUT THIS IS ONLY SOMETIMES CAUGHT IF ATTEMPTED Calls: ParseFilename,ile Information Block } BootLength = 60 + 128; { Size of the bootstrap area on disk--the first n blocks { on t GetRootDirID, GetIDFromDir, PutIDInDir Function DeleteFileID(name : PathName) : SegID; Abstract: Remhe disk. The microcode boot area is 60 blocks, the { Pascal boot area is 128 blocks (32K). } StartBlk =BootLengtoves the directory entry for a path name. Parameters: name - is the full name (including all directorieh; { The block number of the FIBlk of the first user file. } SysFile = -1; { File ID of the system area ons and optional device and partition) of the file to remove from the directory. Ret disk. } SEARCHSIZELIST = 5; { Max number of directories on search list. } type DirBlk= Record { Record f"  1.1 PRQDIS.PAS Perq microcode disassembler. ODTPRQ.PAS 6.1 ODTPRQ.PAS  QCode reference manual MICRO.DOC - MICRO.DOC Microprogrammer's guide. MAKESYSTEM Simple Perq to Perq microcode debugger. ODTUTILS.PAS - ODTUTI.PAS Utility routines.DOC - MAKESY.DOC How to make a new version of the operating system. F for ODTPRQ ODTDUMP.PAS - ODTDUM.PAS The ODTPRQ dump subsystem. >MICROCODE.SUPPORT.BILE.FORMAT - FILE.FOR Describe source file format for Perq software. FAULT.DOC INARY - MICROCODE SUPPORT SEG FILES file name version file name on floppy --------- short descri - FAULT.DOC Fault dictionary for the diagnostic display. EDITOR.DOC - EDITOR.DOCption. ---------------------------- :LINK 1.8 PRQMIC PRQMIC.SEG -  Editor quick guide. SEGMENT.DOC - SEGMEN.DOC Segment file format.  short description. ---------------------------- PERQ.BIN 2.2 PERQ.BIN IO.BIN  PRQMIC.SEG PRQMIC.ERROR - PRQMIC.ERR :LINK 2.0 PRQPLACE PRQPLACE.SEG - PRQ 1.7 IO.BIN VFY.BIN 1.3 VFY.BIN SYSB.BIN 2.4 SYSB.BIN BOOT.BIN 4.PLA.SEG :LINK 1.1 PRQDIS PRQDIS.SEG - PRQDIS.SEG :LINK 6.1 ODTPRQ 0 BOOT.BIN KRNL.BIN 1.1 KRNL.BIN LINK.BIN 1.1 LINK.BIN ODTPRQ.SEG - ODTPRQ.SEG ODTUTILS.SEG - ODTUTI.SEG ODTDUMP.SEG - ODTDUM.SEG  >MICROCODE.SUPPORT.SOURCE - MICROCODE SUPPORT SOURCES file name version file name on floppy ------ >DOCUMENTATION - DOCUMENTATION file name version file name on floppy --------- short descriptio--- short description. ---------------------------- PRQMIC.PAS 1.8 PRQMIC.PASn. ---------------------------- UTILITIES.DOC - UTILIT.DOC Utility  Perq microcode assembler. PMEGEN.PAS - PMEGEN.PAS Program to creaprogram manual. PASCAL.DOC - PASCAL.DOC Pascal extensions. FILES.DOC - te PRQMIC.ERROR from PRQMIC.ERR.TEXT. PRQMIC.ERR.TEXT - PRQERR.TXT Source for PRQMIC.ERROR (e FILES.DOC File system user's manual. FEATURES.DOC - FEATUR.DOC Quirror message text). PRQPLACE.PAS 2.0 PRQPLA.PAS Perq microcode placer. PRQDIS.PAS rks, bugs, and oddities in the operating system. QCODE.DOC - QCODE.DOC # it; Procedure FSMount(disk : integer); Procedure FSDismount(disk : integer); Procedure FSSetPrefix(prefixname : PathName); PleID; Abstract: Convert a two-word SegId into a one-word fileID. Parameters: id - a twrocedure FSGetPrefix(var prefixname : PathName); Function FileIDtoSegID(id : FileID) : SegID; Function SegIDtoFileID(id : Seo-word segID Returns: A one-word FileID; it may be positive, negative or zero. Function FileIDtoSegIDgID) : FileID; Procedure FSSetupSystem(bootchar: integer); Procedure FixFilename(var filename : PathName; (id : FileID) : SegID; Abstract: Converts a one-word FileID into a two-word SegID. Parameters:  nulliserror : boolean); Function FSIsFSDev(name: PathName; var devName: String): integer; Exception FSNotFnd(name: Path id - a one-word FileID. Returns: A two-word SegID. Procedure FSInit; Abstract: Name); Abstract: Raised if file looked up is not found. If this exception is not handled by t Initializes the FileSystem; called BEFORE FSSetUpSystem; also initializes SegSystem and DirSystem. he caller of the routine that raises it, the lookup or search will return zero. Parameters:  Side Effects: Initializes; sets global Initialized to true; sets Prefix and Search list to null name - the name not found Exception FSBadName(name: PathName); Abstract: Raised if file entered is . Procedure FixFilename(var filename : PathName; nulliserror : boolean); Abstract: Makes fileName aillegal because: 1)the device or partition specified is not valid; 2)a directory name specified d full path name by adding as many defaults as necessary. Parameters: filename - name toes not exist; 3)the length of the simpleName is > 25 characters. If this exception is not handled by o fix; it is modified to have the full path name as follows: (dev):(rest) no change  the the caller of the routine that raises it, the Enter will return zero. Parameters:  :(rest) adds DefaultDevice from AllocDisk to front name - the name that is illegal Function FSInternalLookUp(FileName:PathName; Var BlkInFile,  >(rest) adds DefaultPartition from AllocDisk to front (rtion FSEnter(FileName:PathName): FileID; Procedure FSClose(UserFile:FileID; Blks,Bits:Integer); Procedure FSBlkRead(UserFile: BitsInLBlk:Integer): FileID; const FSDebug = false; FileID; Block:BlkNumbers; Buff:PDirBlk); Procedure FSBlkWrite(UserFile:FileID; Block:BlkNumbers; Buff:PDirBlk); Procedure FSIn- 46 - PERQ Operating System Interface - FileSystem 19 Jul 81 Function SegIDtoFileID(id : SegID) : Fi# labels on Perq.Files floppies. >TEST.SOURCE - TEST PROGRAM SOURCES file name version file name on flopp0 JUMP.MIC Test microcode jumps. RAT.MICRO 1.2 RAT.MIC Source y --------- short description. ---------------------------- DTST.MICRO 1.1 Ddata suspicious raster-op test. CROSSHATCH.PAS 0.2 CROSSH.PAS Put crosshatch or checkerboard oTST.MIC Disk test microcode. PDM.PAS 0.4 PDM.PAS Perq diagnostic n display screen. LOOP.MICRO 0.0 LOOP.MIC Simple tests that repeat--monitor. PDM2.PAS - PDM2.PAS PDM 2nd module. PDCOMMON.PAS - PDCOMM.PASallowing probing of boards. KEYTEST.PAS 1.4 KEYTST.PAS Keyboard test  PDM/PDS common definitions. PDMUTILS.PAS - PDMUTI.PAS PDM utility rprogram. >TEST.BINARY - TEST PROGRAM SEG, RUN, AND BIN FILES file name version file name on floppy ---outines. PDMLOAD.PAS - PDMLOD.PAS PDM Pascal program loader. PDM.MAS - ------ short description. ---------------------------- DTST.BIN 1.1 DTST.BI PDM.MAS PDM master file for current diagnostics. PDS.PAS - PDS.PAS N STACK.BIN 1.0 STACK.BIN DUAL.BIN 1.0 DUAL.BIN LOW.BIN 1.0 LOW.BIN HIGH. Perq diagnostic slave. PDM.HELP - PDM.HELP PDM help file. PDM.MICRO BIN 1.0 HIGH.BIN JUMP.BIN 1.0 JUMP.BIN RAT.BIN 1.2 RAT.BIN :LINK  PERQ_Z80.DOC - PERQZ8.DOC Description of PERQ/Z80 protocol. >DOCUMENTATION.MORE - MOR - PDM.MIC Pseudo PDS microcode example. PDMVFY.MICRO 1.1 PDMVFY.MIC E DOCUMENTATION file name version file name on floppy --------- short description.  PDM version of VFY. STACK.MICRO 1.0 STACK.MIC 20-bit, 16-level stack test. DUAL.MICR ---------------------------- INTRO.DOC - INTRO.DOC Operating system user's sO 1.0 DUAL.MIC Microstore dual address test. LOW.MICRO 1.0 LOW.MIC hort guide. POS.DOC - POS.DOC Operating system interface guide. PERQ.FILES  Test for stuck bits in the low bank of the microstore. HIGH.MICRO 1.0 HIGH. - PERQ.FIL This list. PERQ.FILES.LABELS - PERQFI.LAB Masters for MIC Test for stuck bits in the high bank of the microstore. JUMP.MICRO 1.$ : prefixname - current name. It is set with current value.  Errors: Raises FSNotFnd if file not there (if not caught, then lookup returns 0). est) adds FSDirPrefix to front; If nulliserror and fileName is the string, then fileName  - 48 - PERQ Operating System Interface - FileSystem 19 Jul 81 Function FSInternalLookUp(FileName:P is unchanged; otherwise, name is set to FSDirPrefix. Errors: allows STRLong to pass through from PEathName; Var BlkInFile, BitsInLBlk:Integer): FileID; Abstract:RQ String; This means that fileName is invalid - 47 - PERQ Opera Does a lookup of FileName in the current path only. Doesn't use any search lists. Parting System Interface - FileSystem 19 Jul 81 Procedure FSMount(disk: integer); Abstract: ameters: FileName - a filename. BlkInFile and BitsInLBlk are set with the number of blocks in Mounts the disk specified and prints all partitions. Parameters: Disk - device to mount (0=HardDisk, 1 the file and the number of bits in the last block respectively. Returns: 0 if file =Floppy) Calls: DeviceMount and DisplayPartitions Procedure FSDismount(disk: integer); Abstradoesn't exist; otherwise, the FileID of the file. Errors: This procedure does not raise anyct: Dismounts the disk specified and prints all partitions. Parameters: Disk - device to dis errors. Side Effects: Sets the FileAccessDate of the file. Calls: FixFileName, GetFmount (0=HardDisk, 1=Floppy) Calls: DeviceDismount and DisplayPartitions Procedure FSSetPrefix(prefixileID, GetTStamp, SegIDToFileID Function FSLocalLookUp(FileName:PathName; Var BlkInFile, name : PathName); Abstract: Sets the default pathName by assigning the variable. Proces BitsInLBlk:Integer): FileID; Abstract: Does a lookup of FileName in the current path onlsing on the new path is done by FSSetPath in FileUtils. Parameters: prefixname - the y. Parameters: FileName - a filename. BlkInFile - set to the number of blocks in the file. new default path name. No checking is done. Side Effects: Changes FSDirPrefix P BitsInLBlk - set to the number of bits in the last block. Returns: 0 if file doesn't exisrocedure FSGetPrefix(var prefixname : PathName); Abstract: Returns the default pathName Parameterst; otherwise, the FileID of the file. Side Effects: Sets the FileAccessDate of the file. $  version file name on floppy --------- short description. ---------------------------TA.PAS Program to generate PASCAL.SYNTAX from SYNTAX.DAT. SYNTAX.DAT - - PASCAL.PAS 4.13 PASCAL.PAS Pascal compiler global definitions. PAS0.PAS -  SYNTAX.DAT Error message data file. QDIS.PAS 1.5 QDIS.PAS Q-C PAS0.PAS PAS1.PAS - PAS1.PAS PAS2.PAS - PAS2.PAS QCODES.DFS - Qode disassembler. Also needs QCODES.PAS. FQCODES.PAS 1.0 FQCODE.PAS Program to generate QCCODES.DFS Q-Code const definitions. COMPINIT.PAS - COMPIN.PAS InitiaODES from QCODES.DAT. QCODES.DAT - QCODES.DAT Q-Code name data file. FRESWORDS.PAS lization. CODEGEN.PAS - CODEGE.PAS Code generator. DECPART.PAS - DECPAR. 1.0 FRESWO.PAS Program to generate QCODES from QCODES.DAT. RESWORDS.DAT - RESWOR.DPAS Declaration processor. DEC0.PAS - DEC0.PAS DEC1.PAS - DEC1.PASAT Q-Code name data file. >PASCAL.BINARY - PASCAL COMPILER SEG FILES file name ver DEC2.PAS - DEC2.PAS BODYPART.PAS - BODYPA.PAS Procedure/function/progsion file name on floppy --------- short description. ---------------------------- :LINK ram body processor. BODY0.PAS - BODY0.PAS BODY1.PAS - BODY1.PAS BODY2.PAS -  4.13 PASCAL PASCAL.SEG - PASCAL.SEG COMPINIT.SEG - COMPIN.SEG CODEGEN.SEG  BODY2.PAS BODY3.PAS - BODY3.PAS >PASCAL.MORE.SOURCE - MORE PASCAL COMPILER SOURCES file nam - CODEGE.SEG DECPART.SEG - DECPAR.SEG BODYPART.SEG - BODYPA.SEG EXPEXPR.SEG e version file name on floppy --------- short description. ----------------------- - EXPEXP.SEG PROGRESS.SEG - PROGRE.SEG PASCAL.SYNTAX - PASCAL.SYN PASCAL.RESWORDS ----- EXPEXPR.PAS - EXPEXP.PAS Expression expansion. EXPR0.PAS - EXP - PASCAL.RES :LINK 1.5 QDIS QDIS.SEG - QDIS.SEG QCODES -  0.2 CROSSHATCH CROSSHATCH.SEG - CROSSH.SEG LOOP.BIN 0.0 LOOP.BIN :LINK R0.PAS EXPR1.PAS - EXPR1.PAS EXPR2.PAS - EXPR2.PAS EXPR3.PAS - EXPR3.PA 1.4 KEYTEST KEYTEST.SEG - KEYTST.SEG >PASCAL.SOURCE - PASCAL COMPILER SOURCES file name S PROGRESS.PAS - PROGRE.PAS Display compiler progress. FSYNTAX.PAS 1.0 FSYN% y path; otherwise, the FileID of the file. Side Effects: Sets the FileAccessDate of the f is created. Returns: 0 if file can't be created because part of its name is ile Errors: Raises FSNotFnd if file not there (if not caught, then lookup returns 0) invalid (e.g., the device, partition or directory specified doesn't exist); otherwise, the File Calls: FSLocalLookUp, Concat Function FSLookUp(FileName: PathName; Var BlkInFile,ID of the file. Side Effects: Creates a file if necessary and enters it into the  BitsInLBlk: Integer) : FileID; Abstract: Does a lookup of fileName first in the c directory. If creating, it sets size to zero and sets the CreateDate. Sets type to 0 (UnknownFile)  Calls: InternalLookUp - 49 - PERQ Operating System Interfaceurrent path and then in each of the entries of the system search list. Uses the current system  - FileSystem 19 Jul 81 Function FSSearch(var slist : SearchList; var filename : PathName; search list. Parameters: filename - the file to be looked up. BlkInFile - are set to the num var blkinfile,bitsinlblk: integer) : FileID; Abstract: Does a lookup of FileName, straight first andber of blocks in the file. BitsInLBlk - set to the number of bits in the last block. Returns:  then with each of the names in the search list on the front. Parameters: slist - a searchLi 0 if file doesn't exist in any path; otherwise, the FileID of the file. Side Effects: st; any non-null entries are assumed to be paths and are put on the front of the filename.  Sets the FileAccessDate of the file. Errors: Raises FSNotFnd if file not there (if not caught, then  The first one to be tried is slist[1]. The first match is the one used; no checking is done on the  - 50 - PERQ Operating System Interface - FileSystem 19 Jul 81  validity of the entries in slist. filename - the file to be looked up; it is changed to be  lookup returns 0). Calls: FSSearch with FSSysSearchList as the sList Function FSEnter( the full name of the file if found. BlkInFile - set with the number of blocks in the file. FileName:PathName): FileID; Abstract: Enters the file in the current path. Parameters:  BitsInLBlk - set to the number of bits in the last block. Returns: 0 if file doesn't exist in an filename - is the file to be entered. It may or may not exist. If filename does not exist, then it%  PETAL.SEG MULDIV.SEG - MULDIV.SEG SLEEP.SEG - SLEEP.SEG :LINK -  - JUST.PAS Justify text with various fonts in a window. WIPEWIN.PAS - WIPW QCODES >DEMO.SOURCE - DEMONSTRATION PROGRAM SOURCES file name version file name on floppy --------- LINE LINE.SEG - LINE.SEG :LINK - LIFE LIFE.SEG - LIFE.SEG :LINK short description. ---------------------------- KAL.PAS - KAL.PAS  - SKETCH SKETCH.SEG - SKETCH.SEG :LINK - SEISMO SEISMO.SEG  Kaleidoscope display. PETAL.PAS - PETAL.PAS Cycloid drawing display.  - SEISMO.SEG :LINK 0.0 SCREENDUMP SCREENDUMP.SEG - SCRDMP.SEG :LINK  MULDIV.PAS - MULDIV.PAS Double precision multiply and divide for Petal. SLEEP.PAS  - KINETIC KINETIC.SEG - KINETI.SEG >DEMO.SIGGRAPH.SOURCE - SIGGRAPH 80 DEMONSTRATION SOURCES  - SLEEP.PAS Sleep for a specified period of time. LINE.PAS - LINE.PAS  file name version file name on floppy --------- short description. --------- Line drawing display. LIFE.PAS - LIFE.PAS The game of life. SKETCH.------------------- INITDEMO.PAS - INITD.PAS Initialize the demo. PAS - SKETCH.PAS Sketch on the screen using the tablet. SEISMO.PAS - SEPETALDEMO.PAS - PETALD.PAS Cycloid drawing display. LINEDEMO.PAS - LINED.PASISMO.PAS Multi-pen chart recorder display. SCREENDUMP.PAS 0.0 SCRDMP.PAS  Line drawing display. LIFEDEMO.PAS - LIFED.PAS The game of life. S Print an image of the screen to an HP 7310A printer. KINETIC.PAS - KINETI.PAS EISDEMO.PAS - SEISD.PAS Multi-pen chart recorder display. GETSAVE.PAS - GE Demonstrate random raster-ops. >DEMO.BINARY - DEMONSTRATION PROGRAM SEG FILES file name versTSAV.PAS Get display from file to screen or save from screen to file. CREATEWIN.PASion file name on floppy --------- short description. ---------------------------- :LINK  - CREWIN.PAS Create entry in Screen package's window table. SLIDER.PAS -  - KAL KAL.SEG - KAL.SEG :LINK - PETAL PETAL.SEG - SLIDER.PAS Slide a window from one position to another on the screen. JUST.PAS &  Effects: Truncates file to size specified. Does a FlushAll.  to be root of current Partition and adds that path to the bottom of the search list.  - 51 - PERQ Operating System Interface - FileSystem 19 Jul 81 Procedure FSBlkWrite(UserFile:FileID;  - 52 - PERQ Operating System Interface - FileSystem 19 Jul 81 Function FSIsFSDevBlock:BlkNumbers; Buff:PDirBlk); Abstract: Writes one block onto a file. Parameters: (name: PathName; var devName: String): integer; Abstract: Determine whether or not a path name is a file UserFile - ID of file to write in. Block - number of block to write (starting at zero). Buff - buff that the filesystem knows how to handle. Parameters: name - the name of the file. er holding data to write onto the file at Block. Side Effects: Changes the data of devName - will be assigned the device name if not FSDevice. DevName will be in upper case and  Block. Calls: WriteSpiceSegment Procedure FSBlkRead(UserFile:FileID; Block:BlkNumbers; Buff:PDirBlk)without the colon. Returns: 0 if name doesn't contain a colon or if the device is one ; Abstract: Reads one block of a file. If block specified is not part of the file, then the filesystem knows about; otherwise, the index of the colon. whether or not creating. Sets WriteDate and AccessDate. Errors: Raises FSBadName if nam it simply zeroes the buffer. Parameters: UserFile - ID of file to read from. Block - numbere passed is illegal due to a device, partition, or directory name in path not exist of block to read (starting at zero). Undent 5 Buff - buffer to copy data into. Calls: ing or target name is longer than 25 characters or illegal in some other way. If this exception is  ReadSpiceSegment Procedure FSSetupSystem(bootchar: integer); Abstract: Call this after FSInit not caught, Enter returns zero. Procedure FSClose(UserFile:FileID; Blks,Bits:Integer); Abstract:  to set up the system and print a lot of messages. Parameters: boot char - ordinal value of  Closes a file (thereby setting its size). Parameters: UserFile - ID of file to close; Blks is thekey held down to boot. Side Effects: Mounts device from which booted. Mounts all of the de size of the file in blks and bits is the number of bits in the last block; Sidevice's partitions. Sets AllocDisk's DefaultDeviceName and DefaultPartitionName. Sets FSDirPrefix& EMO.SEG - SEISD.SEG :LINK - GETSAVE GETSAVE.SEG - GETSAV.SEG :LINK  FONT2E.PAS Part of Fonted. FONTED.CURSOR - FONTED.CUR File of  - CREATEWIN CREATEWIN.SEG - CREWIN.SEG :LINK - SLIDER SLIDER.SEG pictures needed by the font editor. DR.MEMORY.PAS - DRMEMO.PAS Peek and poke into the memor - SLIDER.SEG :LINK - JUST JUST.SEG - JUST.SEG :LINK - y manager tables. TD.PAS - TD.PAS Demo of Grapics TD1.PAS  WIPEWIN WIPEWIN.SEG - WIPWIN.SEG :LINK - SNOOZE SNOOZE.SEG - SNOOZE.S - TD1.PAS Part of TD TD2.PAS - TD2.PAS AnotherIN.PAS Wipe a picture into a window. SNOOZE.PAS - SNOOZE.PAS PauseEG WINDOWLIB.SEG - WINLIB.SEG SIGUTILS.SEG - SIGUTI.SEG FONTSTUFF.SEG - FONTST.SEG for a specified period of time. Modules for SigGraph demo: MulDiv, Sleep, WindowL FEATURES.SLIDE - FEATUR.SLI SOFTWARE.SLIDE - SOFTWA.SLI NETWORK.SLIDE - NETWOR.SLI ib, SigUtils, FontStuff. WINDOWLIB.PAS - WINLIB.PAS Window routine library. SIGUTILS.PASUCODE.SLIDE - UCODE.SLI IO.SLIDE - IO.SLI 3RCC.SLIDE - 3RCC.SLI JUST.DEMO - SIGUTI.PAS SigGraph 80 demo utilities. FONTSTUFF.PAS - FONTST.PAS  - JUST.DEM GRAPH.PIC - GRAPH.PIC 3RCC.PIC - 3RCC.PIC BLANK.PIC  Load and unload fonts for Just. >DEMO.SIGGRAPH.BINARY - SIGGRAPH 80 DEMONSTRATION BINARY FILES file  - BLANK.PIC WASHDC.PIC - WASHDC.PIC NGR13.KST - NGR13.KST MET22.KST name version file name on floppy --------- short description. -------------------- - MET22.KST DEMO - DEMO DEMO1.CMD - DEMO1.CMD >USERLIBRARY - USER LIBRAR-------- :LINK - INITDEMO INITDEMO.SEG - INITD.SEG :LINK - PETALY SOURCES file name version file name on floppy --------- short description. DEMO PETALDEMO.SEG - PETALD.SEG :LINK - LINEDEMO LINEDEMO.SEG - LINED.SEG  ---------------------------- CURSDESIGN.PAS 1.0 CURSDE.PAS Program used to design new cur :LINK - LIFEDEMO LIFEDEMO.SEG - LIFED.SEG :LINK - SEISDEMO SEISDsors. FONTED.PAS - FONTED.PAS Program used to create new fonts. FONT2ED.PAS - ' Customers are encouraged to choose numbers > 512 if they invent new file types. Exports Const UnknownFile = 0Procedure FSPopSearchItem(var sList: SearchList); Procedure FSPushSearchItem(name: PathName; var sList: SearchList); Procedure; SegFile = 1; PasFile = 2; DirFile = 3; ExDirFile = 4; FontFile = 5; RunFile = 6;  FSAddToTitleLine(msg: String); Exception DelError(FileName: PathName); Abstract: Raised when can't d TextFile = 7; {for non-Pas text files} CursorFile = 8; {cursor bin files} BinaryFile = 9; BinFileelete file (because not there) Parameters: FileName - file that can't delete Exception RenError(m = 10; {microcode output} MicroFile = 11; ComFile = 12; RelFile = 13; IncludeFile = 14; {includesg: String; FileName: PathName); Abstract: Raised when can't rename file Parameters: d in a pas file} SBootFile = 15; {system part of boot file} MBootFile = 16; {microcode part} SwapFile = 17; msg - reason can't rename and fileName is file with the problem. To print message, use "WriteLn(' {a file used for swapping by compiler or editor; length not set} BadFile = 18; {created by the s** ',msg,filename);" - 55 - PERQ Operating System Interfcavenger} - 54 - PERQ Operating System ace - FileUtils 19 Jul 81 Exception MkDirErr(msg: String; dirName: PathName); Abstract: Interface - FileUtils 19 Jul 81 Module FileUtils; Abstract: Filesystem utilities not needed by th Raised when can't make a directory because: 1) a file named dirName already exists; 2) dirName cannoe system Exports Imports FileSystem from FileSystem; type ptrScanRecord = ^ScanRecord; ScanRecord = record t be entered (bad subdir part); 3) dirName is empty; 4) dirName is ROOT.DR (reserved directo InitialCall : boolean; Blk : DiskAddr; Entry : Integry name). Parameters: msg - explains problem with makedir attempt; dirName - name attempted  - 53 - PERQ Operating System Interface - er; DirName : PathName; end; Procedure FSDelete(filename: PathName); Function FFileTypes 19 Jul 81 Module FileTypes; Abstract: This module exports the Types put in the FileSScan(scanptr : ptrScanRecord; var name : SimpleName; var id : FileID) : boolean; Procedure FSRename(SrcName,Type field of File FIBs. The types are stored as integers. Three Rivers reserves the first 512 types for their use.  DestName: PathName); Function FSMakeDirectory(var DirName: PathName): FileID; Procedure FSSetSearchList(sList: SearchList); '  Wipe a picture into a window. SNOOZE.PAS - SNOOZE.PAS Pause for a specifieEG - WINLIB.SEG SIGUTILS.SEG - SIGUTI.SEG FONTSTUFF.SEG - FONTST.SEG FEATURES.SLIDd period of time. Modules for SigGraph demo: MulDiv, Sleep, WindowLib, SigUtils, FE - FEATUR.SLI SOFTWARE.SLIDE - SOFTWA.SLI NETWORK.SLIDE - NETWOR.SLI UCODE.SLIDE ontStuff. WINDOWLIB.PAS - WINLIB.PAS Window routine library. SIGUTILS.PAS -  - UCODE.SLI IO.SLIDE - IO.SLI 3RCC.SLIDE - 3RCC.SLI JUST.DEMO -  SIGUTI.PAS SigGraph 80 demo utilities. FONTSTUFF.PAS - FONTST.PAS  JUST.DEM GRAPH.PIC - GRAPH.PIC 3RCC.PIC - 3RCC.PIC BLANK.PIC - BLoad and unload fonts for Just. >DEMO.SIGGRAPH.BINARY - SIGGRAPH 80 DEMONSTRATION BINARY FILES file name LANK.PIC WASHDC.PIC - WASHDC.PIC NGR13.KST - NGR13.KST MET22.KST - MET22 version file name on floppy --------- short description. ---------------------------- :LI.KST DEMO - DEMO DEMO1.CMD - DEMO1.CMD >USERLIBRARY - USER LIBRARY SOURCES NK - INITDEMO INITDEMO.SEG - INITD.SEG :LINK - PETALDEMO PETALDEM file name version file name on floppy --------- short description. ------------ part of TD MAZE.PAS - MAZE.PAS Draws a maze and runs a mouse through it GENMAZE.PASO.SEG - PETALD.SEG :LINK - LINEDEMO LINEDEMO.SEG - LINED.SEG :LINK  - GENMAZ.PAS Creates a well-formed random maze. MAZEPLAYER.PAS - MAZEPL.PAS  - LIFEDEMO LIFEDEMO.SEG - LIFED.SEG :LINK - SEISDEMO SEISDEMO.SEG  Used by Maze to allow user to try to get through the maze - SEISD.SEG :LINK - GETSAVE GETSAVE.SEG - GETSAV.SEG :LINK -  CREATEWIN CREATEWIN.SEG - CREWIN.SEG :LINK - SLIDER SLIDER.SEG - SLIDER.SEG :LINK - JUST JUST.SEG - JUST.SEG :LINK - WIPEWIN WIPEWIN.SEG - WIPWIN.SEG :LINK - SNOOZE SNOOZE.SEG - SNOOZE.SEG WINDOWLIB.S( to use. Use "WriteLn('** ',msg,dirName);" Exception SrchWarn(fileName: PathName); Abstract: filename from directory and from filesystem; fileName is deleted from the current path only (not  Raised if try to Pop last item or push into last hole of the Search List. Parameters:  search lists) if it doesn't contain device or partition info. Parameters: filename  Null if Pop; name of item trying to push if Push Resume: Allowed; if resume then does the operation an- the name of the file to be deleted. Side Effects: filename is deleted from the current directory if yway. Exception SrchErr(fileName: PathName); Abstract: Raised if try to Pop empty list or push o it exists; if it does not exist then nothing is done (and the user is not notified). Calnto full list for the Search List. Parameters: Null if Pop; name of item trying to push ifls: DeleteFileID; DestroySpiceSegment Errors: Raises DelError(fileName) if can't delete file Push Resume: Not allowed Function FSExtSearch(var SList : SearchList; Extensions: String;  Procedure FSRename(SrcName, DestName: PathName); Abstract: Changes the name of SrcName to DestName;  var FileName : PathName; var BlksInFile, BitsInLBlkInLBlk: Integer)  both are in the current path (not search lists) if not fully specified. Parameters: SrcName: FileID; - 56 - PERQ Operating System Interface - FileUtils  - the name of the file to change and DestName is the name it should be given. Returns:  19 Jul 81 Exception RenToExist(fileName: PathName); Abstract: Raised if filename renaming to True, if rename is successful; false, if can't be done because: 1) destName already exists; 2) SrcName  already exists Parameters: fileName - new name that already exists Resume: Allowed;and destName are in different partitions; 3) SrcName doesn't exist; 4) SrcName or DestName is malfo If you wish to rename anyway, just continue and FSRename will delete the DestName. In this case, you rmed. - 57 - PERQ Operating System Interface - FileUtils 19 Jul 81  should be prepared to accept DelError. Procedure FSGetFSData(id: FileID; pData: ptrFSDataEntry); Procedure FSSetFS Side Effects: The name of the file corresponding to SrcName is changed. Calls: DeData(id: FileID; pData: ptrFSDataEntry); Procedure FSDelete(filename : PathName); Abstract: Deletes leteFileID; DestroySpiceSegment Errors: Raises RenError(msg, fileName) if can't rename file where (  by the font editor. DR.MEMORY.PAS - DRMEMO.PAS Peek and poke into the memory manager  tables. TD.PAS - TD.PAS Demo of Grapics TD1.PAS -  TD1.PAS Part of TD TD2.PAS - TD2.PAS Another part of TD MAZE.PAS - MAZE.PAS Draws a maze and runs a mouse through it GENMAZE.PAS -  GENMAZ.PAS Creates a well-formed random maze. MAZEPLAYER.PAS - MAZEPL.PAS  Used by Maze to allow user to try to get through the maze Sides 2 Density SINGLE Fast ! DOCUMENTATION.MORE - MORE DOCUMENTATION ! Created 19 Jul 81 15:13:36 Get INTRO.DOC ---------------- CURSDESIGN.PAS 1.0 CURSDE.PAS Program used to design new cursors. FONTED.P INTRO.DOC Get POS.DOC POS.DOC Get PERQ.FIL PERQ.FILES Get PERQFI.LAB PERQ.FILES.LABAS - FONTED.PAS Program used to create new fonts. FONT2ED.PAS - FONT2E.PELS AS Part of Fonted. FONTED.CURSOR - FONTED.CUR File of pictures needed) s its fileID; scanPtr is modified after each call so the next call will return the tion which contains a full set of system files. Side Effects: Changes system searchnext name in the directory. Returns: True if a valid name and id returned; false if the  list Procedure FSPopSearchItem(var sList: SearchList); Abstract: Removes the most recent item from t directory has been exhausted in which case name and id are NOT valid. Function FSMakeDirectory(var dirNhe search list. Parameters: sList - search list to pop from (it is modified). Errors:  message explains why (do "Write(' ** ',msg,fileName)" in handler) Raame: PathName): FileID; Abstract: Create a new directory named dirName. Parameters: ises RenToExist(DestName) if filename already exists. If you wish to rename anyway, just continue and DirName - the name of the directory to create; the name is changed to be the full path name of the director FSRename will delete the DestName. In this case you should be prepared to accept DelErrory created. Returns: The fileID of the directory . Function FSScan(scanptr : ptrScanRecord; var name: SimpleName; var id : FileID): boolean; Abstra- 58 - PERQ Operating System Interface - FileUtils 19 Jul 81 Side Effects: Createct: At each call, returns the next entry in a directory. The names returned are in random order. s a file named dirName (appending a ".DR" to end if not there. Sets the FileType field to DirFile; and sets  Parameters: scanPtr - a pointer to a ScanRecord which controls the scan. At the f the FileBits to 4096. Errors: Raises MkDirErr(msg, dirName) if 1) a file named dirName irst call, scanPtr^.InitialCall should be set to true and scanPtr^.dirName should be set already exists; 2) dirName cannot be entered (bad subdir part); 3) dirName is empty; 4) dirN to the directory to scan through. No fields should be modified by the caller after the initial ame is ROOT.DR (reserved directory name); where msg describes error. Do not cont setting. The dirName field of the scanPtr record is modified to contain the Full path nameinue from this signal. Procedure FSSetSearchList(sList: SearchList); Abstract: Assign the system sear of the directory. name is set to the name of the file found on this call and id ich list. Parameters: sList - new search list. It is a bad idea not to include a parti) * ul 81 Environment: Assumes oldest item in list is at high position (e.g. 5). Prer) : FileID; Abstract: FSExtSearch performs a breadth-first lookup of a file using a ocedure FSAddToTitleLine(msg: String); Abstract: Adds as much of msg as possible to title line after thespecified searchlist and a list of extensions. The search order is as follows: 1) Try the name with each  current path which is truncated to 35 characters. Parameters: msg - string to be displayed. extension in the current directory; 2) Repeat step 1 in - 60 - PERQ Operating The first 43 characters of it are displayed. Side Effects: Changes current window's title line.  System Interface - FileUtils 19 Jul 81 each path specified in the searchlist. If the file Procedure FSGetFSData(id: FileID; pData: ptrFSDataEntry); Abstract: Returns the FSDataEntry description  is found, the FileName is changed to be the full file name actually found. Parameters: of a file. Parameters: id - the FileID for the file for which data is wanted. pData - a poi SList - Searchlist to use. Extensions - List of extensions to try with a single  Raises SrchWarn('') if try to pop last item; if continue from it then pops it anyway. Raisesnter to a data block to which the FSData is copied. Memory for this pointer must be allocated  SrchErr('') if list empty and try to pop; don't continue from this one. Procedure FSPushSearchItem(n before the call. Procedure FSSetFSData(id: FileID; pData: ptrFSDataEntry); Abstract: Changes tame: PathName; var sList: SearchList); Abstract: Adds name to the front of the search list. Paramehe FSDataEntry of a file Parameters: id - the fileID of the file to be modified. pData - tters: name - new name to add to the front of the search list. searchList - modified to have name at he FSDataEntry to set id to. The entire FSDataEntry description of id is changed, so the front. Errors: Raises SrchWarn(name) if try to push into last item; if continue from  user should use FSGetFSData to read the FSDataEntry and then change the desired fields only. it then pushes it anyway. Raises SrchErr(name) if list full and try to push; don't continue fr Side Effects: Changes the FSDataEntry for id Procedure FSExtSearch(var SList : SearchList; Extensions: String; om this one. - 59 - PERQ Operating System Interface - FileUtils 19 J var FileName : PathName; var BlksInFile, BitsInLBlkInLBlk: Integ* + FileName - Name of file to find, set to be the full name of the file that was actually found. tamp for the current time. Parameters: Stamp - set to be the stamp for the current time. BlksInFile - Length of file in blocks. BitsInLBlk - Bits in last block of file. Returns: 0 i - 62 - PERQ Operating System Interface - GPIB 19 Jul 81 Mf file not found or id of file Errors: Raises FSNotFnd if file not found odule GPIB; Abstract: Support routines for PERQ GPIB devices. The package maintains a buffer (gpCommandBuffer) - 61 - PERQ Operating System Interface - GetTimeStamp  which holds either Data bytes (sent with procedure gpPutByte) or Auxiliary Commands (sent with gpAuxCommand) The buff 19 Jul 81 Module GetTimeStamp; Abstract: GetTimeStamp implements the read-time-as-TimeStamp function for ter is sent to the 9914 when full, or when gpFlushBuffer is called. If the buffer has data bytes when gpAuxCommand is callehe Clock module. See the Clock module (in this manual) for more details. Design: GetTimeStamp is a separd, it will do a gpFlushBuffer. Similarly, when gpPutByte is called, it will flush the buffer, if auxiliary cate module so that it may be imported into the resident system without importing all the other Clock routines. Once virommands are in gpCommandBuffer. Exports const GpibVersion = '1.2'; gpBufSize = 32; gptual memory is implemented, GetTimeStamp and Clock should be merged into a single module. Exports const GetTSVersioBufMax = 31; {gpBufSize - 1} {NOTE: The following codes are the IEE488-1975 Controller Command Codes; they arn = '1.4'; type TimeStamp = packed record { the fields in this record are ordered this way to optimize bitse issued by the Controller-In-Charge while asserting ATN. } gpacg = #000; {addressed group command}  space after each extension, e.g., '.Pas .Micro .Cmd .Dfs '. The string must  } Hour: 0..23; Day: 1..31; Second: 0..59; Minute: 0..59; Month: 1..12; Ye have a single trailing space. A single leading space or a pair of adjacent spaces caar: 0..63; { year since 1980 } end; TimeReference = record Lower: Integer; uses FSExtSearch to look for the file exactly as typed (with no extension appended). Other extra  Upper: Integer end; Procedure GetTStamp( var Stamp: TimeStamp ); var PastStamp: Time spaces are not allowed. If Extensions does not end in a space, then one added. Stamp; Past: TimeReference; Procedure GetTStamp( var Stamp: TimeStamp ); Abstract: Returns a timeS+ ,  gplag = #040; {listen address group} gpllo = #021; {local lockout} gpmla = #040; {my listen addreeturn to Local} gpfeoi, {force End or Identify} gplon, {Listen Only} gss} gpmta = #100; {my talk address} gpmsa = #140; {my secondary address} gpppc = #005; {parallepton, {Talk Only} gpgts, {GoTo Standby} gptca, {Take Control Asynchronously} l poll configure} gpppe = #140; {parallel poll enable} gpppd = #160; {parallel poll disable} gp gptcs, {Take Control Synchronously} gprpp, {Request Parallel Poll} gpsic, ppu = #025; {parallel poll unconfigure} gpscg = #140; {secondary copmmand group} gpsdc = #004; {selected d {Set Interface Clear} gpsre, {Set Remote Enable} gprqc, {Request Control} evice clear} gpspd = #061; {serial poll disable} gpspe = #060; {serial poll enable} gptct = #01 gprlc, {Release Control} gpdai, {Disable All Interrupts} gppts, {Pass Thr1; {take control} gptag = #100; {talk address group} gpuag = #020; {universal address group} gpough next Secondary} gpstdl, {Set T1 Delay} gpshdw); {Shadow Handshake} gpParmunl = #077; {unlisten} gpunt = #137; {untalk} type {these commands are the major state change conType = (gpOff, gpOn, gpDontCare); {parameters for Aux Commands} gpByte = 0..255; {Dtrol commands of the TMS9914 chip which forms the interface to the GPIB. Consult the TI documentation ata byte for gpib transactions} gpRange = 0..gpBufSize; gpDeviceAddress = 0..31; {legal aon the TMS9914 for more information.} { These definitions are order dependent} gpAuxiliaryCoddresses for devices on GPIB} gpBuffer = packed array [gpRange] of gpByte; gppBuffer = ^gpBuffer; varmmands = (gpswrst, {Chip Reset} gpdacr, {Release DAC holdoff} gprhdf,  gpCommandBuffer: gppBuffer; {place to put commands} gpBufPtr: 0..gpBufSize; {poi{Release RFD holdoff} - 63 - PERQ Operating System Interface - GPIB nter to gpCommandBuffer} gpHaveDataBytes, gpHaveAuxiliaryCommands: boolean; {true if buffer in use}  19 Jul 81 gphdfa, {Holdoff all data} gphdfe, {Holdoff on End}  Procedure gpInit; Abstract: Initialize GPIB package, called once only, turns off  gpdcl = #024; {device clear} gpget = #010; {group execute trigger} gpgtl = #001; {go to local} gpnbaf, {Set NewByteAVailable false} gpfget, {Force Group Execute Trigger} gprtl, {R, -  talker. This procedure takes control of the bus, unlistens and untalks all devices (including is. Exports Const IOVersion = '4.8'; Imports IO_Init from IO_Init; Imports IO_Unit from IO_Unit; Imports IO_Others frotself), and sets a talker with MyTalkAddress then sets TMS9914 to be the listener with ListenOm IO_Others; -  tablet. Procedure gpAuxCommand(gpCmd: gpAuxiliaryCommands; gpParm:gpParmType); nly. Procedure gpTbltOn; Abstract: Turn the BitPad (device address #10) off. Proce Abstract: Send an auxiliary command to TMS9914. Some commands require a parameter (gpOdure gpTbltOff; Abstract: Turn the BitPad back on again. ff/gpOn). - 64 - PERQ Operating System Interface - GPIB  - 65 - PERQ Operating System Interface - GPIB 19 Jul 81 Procedure gpSend(var gpB 19 Jul 81 Procedure gpPutByte(gpData: integer); Abstract: Put a data byte or a Control uf: gppBuffer; gpCount: gpRange); Abstract: Send a buffer of user data to the 9914. Procedurbyte out on the data bus. TMS9914 must be in Controller Actives State if the byte is a e gpReceive(var gpBuf: gppBuffer; gpCount: gpRange); Abstract: Get a buffer of data from the 9914 controller command byte. Must be in Talk Only if a data byte. Procedure gpFlushBuffer; Abst(Not implemented yet) Function gpGetByte: gpByte; Abstract: Get a byte ofract: Sends all bytes in buffer Procedure gpITalkHeListens(gpAddr: gpDeviceAddress); Abstr data from the GPIB. act: Set TMS9914 to be a Talker, set a device to be a listener. This procedure takes - 66 - PERQ Operating System Interface - IO 19 Jul 81 Module IO; Abstract: T control of the bus, unlistens and untalks all devices (including itself), and sets a listhe IO module has been split into four modules: IO_Init, IO_Unit, IO_Others, and IO_Private. This module (IO) is proener with MyListenAddress then sets TMS9914 to be the talker with TalkOnly. Procedure gpHeTalksIListenvided for compatibility. It imports IO_Init, IO_Unit, and IO_Others in its exports section. IO_Private is not expor(gpAddr: gpDeviceAddress); Abstract: Set TMS9914 to be a Listener, set a device to be a ted because it provides definitions which were private in the old IO module and is used only by the new IO module- . his device is not implemented } IOEWRF = -3; { Write Failure } IOEBSE = -4; { BlockSize Error } IOEILC = -5; { Interrupt Vector Table, the Device Table and associated buffers, the Screen Package, the tablet and cursor, and the Z Illegal Command for this device } IOENHP = -6; { Nil Header Pointer } IOEADR = -7; { Address Error } IOEPHC = -80. Exports Procedure InitIO; Procedure InitIO; Abstract: InitIO initializes the Interrup8; { Physical Header CRC Error } IOELHC = -9; { Logical Header CRC Error } IOEDAC = -10; { Data CRC Error } IOEt Vector Table, the Device Table and associated buffers, the Screen Package, the tablet and cursDNI = -11; { Device Not Idle } IOEUDE = -12; { Undefined Error! } IOENCD = -13; { Device is not a character device } or, and the Z80. - 70 - IOECBF = -14; { Circular Buffer Full } IOELHS = -15; { Logical Header SerialNum Mismatch } IOELHB = -16; { Logica PERQ Operating System Interface - IO_Others 19 Jul 81 Module IO_Others; Abstract: IO_Other67 - PERQ Operating System Interface - IOErrMessages 19 Jul 81 Module IOErrMessages; Abstract: l Header Logical Block Number Mismatch } IOECOR = -17; { Cylinder Out of Range } IOEDNR = -18; { Device not ready } This module exports a procedure to return an error string for a disk error. Exports Function IOErrString(err: in IOEMDA = -19; { Missing data address mark } IOEMHA = -20; { Missing header address mark } IOEDNW = -21; { Device noteger): String; Function IOErrString(err: integer): String; Abstract: Returns a string describing thet writable } IOECMM = -22; { Cylinder mis-match } IOESNF = -23; { Sector not found } IOEOVR = -24; { Overrun }  error number. Parameters: err - the error number returned by UnitIO. Returns: A str IOEUEF = -25; { Undetermined equipment fault } IOESOR = -26; { Sector out of range } IOETIM = -27; { Time out erroring describing the error.  } IOEFRS = -28; { Floppy recalibrate done } IOEDRS = -29; { Disk recalibrate done } IOET0 = -30; { Can't find t - 68 - PERQ Operating System Interface - IOErrors 19 Jul 81 Module IOErrors; Abstract: I/rack zero } {$ifc Ether3MBaud then} IOEPTL = -31; { Ether3 - received packet too large } IOEFirstError = -31; {$elsO System Error Code Definitions. Exports Imports SystemDefs from SystemDefs; {using Ether3MBaud} Const IOEIOC = 1;ec} IOEFirstError = -30; {$endc} IOELastError = 0; - 69 - PERQ Ope { IO Complete } IOEIOB = 0; { IO Busy } IOEBUN = -1; { Bad Unit Number } IOENBD = -2; { Raw Block IO to trating System Interface - IO_Init 19 Jul 81 Module IO_Init; Abstract: IO_Init initializes the. / ative coordinates } TabAbsX, TabAbsY: integer; { tablet absolute coordinates } TabFinger: boolean; { es are changed only by the user. If it is set to OffCursor, no cursor is displayed. Parameters: finger on tablet } TabSwitch: boolean; { switch pushed down } TabWhite : boolean; { True if wh m - the new mode for the cursor. Procedure IOSetModeTablet( M: TabletMode ); Abstract: Setsite button down } TabGreen : boolean; { True if green button down } TabBlue : boolean; { True the mode to tell what kind of tablet is currently in use. Parameters: m - the mode for the if blue button down } TabYellow : boolean; { True if yellow button down } TabMouse : integer;  tablet. Procedure IOLoadCursor( Pat: CurPatPtr; pX, pY: integer ); Abstract: Loads a user cursor pat{ Actual output from mouse } DefaultCursor: CurPatPtr; { default cursor pattern } Procedure IOLoadCursor(Pat: CurPtern into the screen cursor. Parameters: Pat - a pointer to a cursor. It should be quad-word atPtr; pX, pY: integer); Procedure IOReadTablet(var tabX, tabY: integer); Procedure IOSetFunction(f: CursFunction); Procedure aligned. pX and pY - offsets in the cursor where the origin is thought to be. IOSetModeTablet(m: TabletMode); Procedure IOCursorMode (m: CursMode); Procedure IOSetCursorPos(x,y: Integer); Procedure IOSe For example, if the cursor is a bull's eye, 31 bits diameter flushed to the upper tTabPos (x,y: Integer); Procedure IOReadCursPicture(pat: CurPatPtr; var px, py: integer); Procedure IOGetTime(var t: double)left corner of the cursor box, using (pX, pY) = (15, 15) will have the cursor surround the things pointed s exports routines for the Cursor, Table, Screen, Time, and Keyboard. Exports Imports SystemDefs from SystemDefs; ; Procedure IOScreenSize(newSize: integer; complement: Boolean); Procedure IOKeyDisable( var OldKeyEnable: Boolean ); Pro { tablet/cursor procedures } type CursFunction = (CTWhite, CTCursorOnly, CTBlackHole, CTInvBlacedure IOKeyEnable( OldKeyEnable: Boolean ); Procedure IOKeyClear; - 71 - PEckHole, CTNormal, CTInvert, CTCursCompl, CTInvCursCompl); TabletMode = (relTablet, scrAbsTableRQ Operating System Interface - IO_Others 19 Jul 81 procedure IOCursorMode( M: CursMode ); Abstract, tabAbsTablet, offTablet); CursMode = (OffCursor, TrackCursor, IndepCursor); CursorPat: Sets the mode for the cursor. If the mode m is set to TrackCursor, Tablet coordinates are cttern = array[0..63,0..3] of integer; CurPatPtr = ^CursorPattern; var TabRelX, TabRelY: integer; { tablet relopied every 1/60th second into the cursor position. If the mode is set to IndepCursor, coordinat/ 0 cursor picture into Pat and sets pX and pY with the offsets for the current cursor. Parameters: splayed). The cursor is prevented from going into the undisplayed part of the screen.  Pat, pX, and pY are filled with data on the current cursor. Parameters: newSize - number of scan lines in new screen; it must be a multiple of 128.  - 72 - PERQ Operating System Interface - IO_Others 19 Jul 81 NOTE: Pat must be Complement - tells whether the rest of the screen should be the opposite color of the display quad-word aligned. Procedure IOSetFunction( f: CursFunction ); Abstract: Sets the cursor function. ed part. - 73 - PERQ Operating System Interface - IO_Others 19 Jul 8 Parameters: f - the function to set the cursor to. Procedure IOSetCursorPos( x, y: integer ); 1 Procedure IOGetTime( var t : double ); Abstract: Reads the 60 Hertz clock. Parameters: Abstract: If the cursor's mode is not TrackCursor, this procedure sets the cursor's x and y po t - set to the new time. Procedure IOKeyDisable( var OldKeyEnable: Boolean ); Abstract: IOKsitions. If tracking, it sets both tablet and cursor. Parameters: x and y - the new cursor eyDisable is used to disable keyboard interrupts. This is used to delay processing of control-c, coordinates. Procedure IOSetTabPos( x, y: integer ); Abstract: If the cursor's mode is not set  control-shift-c and control-shift-d at critical times. The old value of the keyboard interru to TrackCursor, IOSetTabPos sets the tablet's x and y positions. If the mode is TrackCursor, bpt enable is returned and must be passed back to IOKeyEnable when re-enabling keyboard interroth tablet and cursor are set. Parameters: x and y - the new tablet coordinates. Procedure IOReadTablupts. Characters typed while keyboard interrupts are disabled are remembered. When keyboard inet( var tabX, tabY: integer ); Abstract: Reads tablet coordinates. Parameters: tabX terrupts are re-enabled, the characters are processed. Parameters: OldKeyEnable - set to  at. NOTE: This procedure supports a cursor which is 56 x 64; with a scan line length oand tabY - set to x and y values of the tablet. Procedure IOScreenSize( newSize: Integer; complemented: Boolean ); f 4 Procedure IOReadCursPicture( Pat: CurPatPtr; var pX, pY: integer ); Abstract: Copies the current Abstract: Changes the amount of screen visible to the user (the rest is turned off, hence not di0 1 ck size devices: } { Size is in BYTES } DskBlockSize = 512; FlpBlockSize = 128; SpkBlockS CrsHeight = 64; { Height of the cursor } CrsConst0 = #370; { constants to compute funny X position } Vithe old value of the enable. Procedure IOKeyEnable( OldKeyEnable: Boolean ); Abstract: IOKeyEnable iize = 128; TabBlockSize = 8; Z80BlockSize = 20; GPIBBlockSize = 1; Last12Sector = 202 * 4 * s used to enable keyboard interrupts. The old value of the keyboard interrupt enable (as returned 30 -1; {Tracks * Heads * Sectors. 0 start } DskPriority = 0; { interrupt priorities } Flp from IOKeyDisable) must be passed to IOKeyEnable when re-enabling keyboard interrupts. If characters wPriority = 3; SpkPriority = 2; {$ifc Ether3MBaud then} Ether3Priority = 12; {$elsec} {$ifc Ether10MBaud theere typed while keyboard interrupts were enabled, IOKeyEnable calls KeyIntr to process those characn} Ether10Priority = UnImplemented; {$endc} {$endc} GPIBInPriority = 11; GPIBOutPriority = 1; ters. The master interrupt control (INTON and INTOFF QCodes) must be on when this procedure is TabPriority = 10; KeyPriority = 5; RSIPriority = 6; RSOPriority = 7; Z80Priority = 8;  called. Parameters: OldKeyEnable - the old value of the enable. Procedure IOKeyClear; Abstra PutPriority = 9; GetPriority = 4; PSFloppy = #14; { Put Status Special Codes } ct: IOKeyClear clears the keyboard type-ahead buffer. - 7 - 75 - PERQ Operating System Interface - IO_Private 19 Jul 81 PSGPIB4 - PERQ Operating System Interface - IO_Private 19 Jul 81 Module IO_Private; Abstract: IO_P = 0; PSZ80Monitor = #11; PSTablet = 6; PSKeyBoard = 7; PSRS232 = 5; PSClock = #12;rivate exports interrupt routines and definitions which are to the modules which make up the IO system. Design: Inte GSFloppy = #40; { Get Status Special Codes } GSGPIB = #100; GSZ80Monitor = #10; rrupt routines must never cause segment faults. Exports Imports SystemDefs from SystemDefs; Imports IO_Unit from IO_Uni GSTablet = #2; GSKeyBoard = #4; GSRS232 = #1; GSClock = #20; { consts to terminate Dist; Imports IO_Others from IO_Others; Imports Raster from Raster; Const CirBufSize = #100-3; { size oplay List; add in funct: } DisCst0 = #1154; DisCst1 = #1351; MinCurY = 0; { Minimum Y value for f circular buffers - made so that } { total size of CirularBuffer = #100 } { block sizes for fixed blocursor } MaxCurY = 1023; { Maximum Y value for cursor } SegSize = 128; { # lines / display segment } 1 2 dge = record case integer of 1: (Buffer: IOBufPtr); 2: (Offset: Integer; SOUnused: 0..255); StdType: (StdHiByte: 0..255) end; CircularBuffer = packed  Segment: Integer) end; {$ifc Ether3MBaud then} EtherBuff = array [0record { circular buffer used for character } { devices, SpGetCir and ..PackBuffLen] of integer; pEtherBuff = ^EtherBuff; {$elsec} {$ifc Ether10MBaud then} UnImplemented; {$endcSpPutCir } Length: integer; { # chars in the buffer } RdPtr: integer; { where t} {$endc} CirBufPtr = ^ CircularBuffer; CBType = (KDBType, RSIType, RSOType, StdType); { types o get chrs out } WrPtr: integer; { where to put them in } Buffer: packed array[0..CirBsOnly = #2000; { mode bits - Visual screen only } VisAndCur = #2400;{ visual screen and cursor } Map = #10000of circular bufs } CirBufItem = packed record { what we put in circular buffers } 0; { cursor map function } CtrlC = chr(#3); CtrlS = chr(#23); CtrlQ = chr(#21); BlamC ch: char; { the character } case CBType of { device specific condih = Chr(#303); { untranslated shift-control-C } DumpCh = Chr(#304); { untranslated shift-control-D } {$ifc Ether3MBation bits } KDBType: (KDBUnused: 0..63; KDBOverrun: boolean; ud then} E3TIntEnable = #4; { Ether3 constants } E3TDone = #2000; E3TError = #4000; E3TG { true = overrun } KDBError: boolean); { OR o = #10; E3RIntEnable = #1; E3RDone = #400; E3RPromiscuous = #20; E3RError = #1000; of all error bits } RSIType: (RSIUnused: 0..7; RSIBreak: boolean;  E3RGo = #2; E3XmtMask = E3TDone + E3TError + E3TGo; E3XmtSucc = E3TDone + E3TGo; E3RecMask = E3RDone { true=break received } RSIModem: boolean;  + E3RError + E3RGo; E3RecSucc = E3RDone + E3RGo; PackBuffLen = 511; E3RecCount = PackBuffLen - 4;  { true=modem change } RSIParErr: boolean; { true=parity err MAXE3RECERRS = 20; {$elsec} {$ifc Ether10MBaud then} UnImplemented; {$endc} or } RSIOverrun: boolean; { true=overrun error }  - 76 - PERQ Operating System Interface - IO_Private 19 Jul 81 {$endc} type IOPtrKlu RSIError: boolean); { OR of all error bits } RSOType: (R2 3  true: (int: integer); false:(LineCount: 0..127; StartOver: booles picked up or put down } - 78 - PERQ Operating San; ShowCursor: boolean; VerticalRetrace: boolean; ystem Interface - IO_Private 19 Jul 81 TabFifoLen = TabAverage + TabIgnore; TabFifoMax = T ShowScreen: boolean; DisableMicroInterrupt: boolean; WriteBadPariabFifoLen - 1; GPIBxFudge = 38; { actual range in X and Y for BitPad: 0..2ty: boolean; Map: (CursOnly, CCursOnly, Compl, ComplInv, Normal, I200 } GPIByFudge = 1061; { of TX and TY: 0..1100 } { of TabAbsX: 0..1100 } nvert, CursComp, InvCursCompl)) end; ScrCtlPtr = ^ ScrCtlBlock;  { of TabAbsY: 0..1100 } { of TabRelX: -38..1062  ScrCtlBlock = packed record Cmd: DispPtr; ScreenBase: RasterPtr; CursB limited to 0..767 } { of TabRelY: 1061..-39 ase: RasterPtr; CursX: integer; filler: integer end; const DskSPC = 3 limited to 1023..0 } STopY = 0; SLeftX = 0; SRightX = 767; type DskCmds = (DskIdleufSize-1] of CirBufItem { last, the buffer } - 77 0; { Sectors Per Cylinder } DskHds = 8; { Max number of dsk heads } DskExHds = 0; - PERQ Operating System Interface - IO_Private 19 Jul 81 end; TabBufPtr = ^Tab { Extra heads not in use } DskCyls = 202; { Number of cylinders } FlpUnits = 4; { 0 isletBuffer; TabletBuffer = packed record { buffer used for tablet, clock and }  the only valid unit } FlpSPC = 26; { numbered 1 to 26 } FlpHds = 2; { numbered 0 to 1  { Z80 Monitor Info } TabX: 0..#77777; TabSwitch: boolean; TabY: } FlpCyls = 77; { numbered 0 to 77, 0 should not be used } TabA0..#77777; Fill: 0..1; ClkTime: double; Z80Mon: Z80Readings end;verage = 4; { number of tablet points to average } { DispPtr = ^DisplayFile; DisplayFile = array[0..11] of packed record case boolean of  this MUST be 4 } TabIgnore = 2; { number of points to ignore when finger i3 4  FlpSeek, FlpReset); GPIBCmds = (GPIBNop, GPIBWrite, GPIBWrEOI, GPIBCntl); { Types oCRC, { Physical Header CRC } LHSer, f block devices } IOCBType = (DskType, FlpType, SpkType, GPIBType, {$ifc Ether3MBaud then}  { Logical Serial Wrong } LHLB,  Ether3Type, {$elsec} {$ifc Ether10MBaud then}  { Logical Block Wrong } LHCRC,  UnImplemented, {$endc} {$endc} GenType); IOCBPtr = ^IOCB; IOCB = packed record { I { Logical Header CRC } DaCRC, OCBs must be 8 word aligned } Buffer: IOBufPtr; { data buffer for transaction } case IOCBType { Data CRC } Busy); DskFill2: boolean; of DskType: ( DskCommand: 0..255; DskNumSect: 0..255;  DskTrackZero: boolean; DskWriteFault: boolean; DskSeekComplete: boolean;  (* NEW FS [*) DskAddr: Integer; (* NEW FS *)  DskDriveRead: boolean; DskNextIOCB: IOCBPtr); FlpType:  - 79 - PERQ Operating System Interface - IO_Private 19 Jul 81  ( FlpUnit: 0..FlpUnits-1; FlpHead: 0..FlpHds-1; FlpFill1: 0. (* OLD FS [) DskSector: 0..DskSPC-1; DskHead: 0..DskHds+DskExHds-1; .31; FlpCylinder: 0..255 { 0..FlpCyls-1 }; FlpSector: 0..255 { 1..FlpSPC };  DskCylinder: 0..DskCyls-1; (* OLD FS *) DskSerialNum: doub FlpCommand: 0..255 { FlpCmds }; FlpByteCnt: integer { 0..256 }; , DskRdCheck, DskDiagRead, DskWrCheck, DskWrFirst, DskFormat, DskSeek, DskClear); {$ifc Ether3MBaud then}le; DskLogBlk: integer; DskFill1: integer; DskNextAdr Ether3Cmds = (E3Rset, E3Status, E3Receive, E3PromiscReceive, E3Transmit); {$elsec} {$ifc Ethe: double; DskPrevAdr: double; DskCntlError: ( OK, r10MBaud then} UnImplemented; {$endc} {$endc} FlpCmds = (FlpUnUsed, FlpRead, FlpWrite, FlpFormat,  AddrsErr, { address error } PH4 5  FlpFill2: array [4..11] of integer; FlpResult: integer; { Not yet defined }  NextIOCB: IOCBPtr) end { IOCB }; var KRBuf, { Keyboard Raw Buffer  FlpNextIOCB: IOCBPtr); SpkType: ( SpkFill0: 0..255; } KTBuf, { Keyboard translated buffer } RSIBuf, { RS-232 In Buffer } RSOBuf:  SpkNumBufs: 0..255; SpkFill1: array[3..11] of integer; SpkFill2: 0..16383;CirBufPtr; { RS-232 Out Buffer } TabBuf: TabBufPtr; { Tablet/Clock Buffer } ScrBuf: Sc SpkAddrErr: boolean; SpkError: boolean; SpkNextIOCB:rCtlPtr; { Screen control blocks } DisFile0,DisFile1: DispPtr; { Screen Display lists - double  IOCBPtr); GPIBType: (GPIBCommand: GPIBCmds; GPIBF0: 0..63bufrs } OldCurY, { previous Cursor Y position } OldCurX: integer; { previous Cursor X ; GPIBNumBufs: 0..255; GPIBByteCount: 0..255; GPIBF1:position MOD 8 } Cursor: CurPatPtr; { Cursor Pattern } CursorX, CursorY: integer; { ne array [4..11] of integer; GPIBResult: integer; {Not Implemented} w cursor coordinates } PointX, PointY: integer; { the point of the cursor } TabFifo: array[0..TabF- 80 - PERQ Operating System Interface - IO_Private 19 Jul 81 GPIBNextIOCB: IifoMax] of record X,Y: integer end; { fifo of tablet points } TabFifoInx: integer; OCBPtr); {$ifc Ether3MBaud then} Ether3Type: ( Ether3Cmd: integer;  { index into tablet fifo } TabCount: integer; { counter for ignoring tablet points } SumX,  Ether3Delay: integer; Ether3WdCnt: integer; Ether3Status: integer; SumY: integer; { sum of 4 points for averaging } FlpLastCylinder: integer;  Ether3NextIOCB: IOCBPtr ); {$elsec} {$ifc Ether10MBaud then} UnImplemented; {$end - 81 - PERQ Operating System Interface - IO_Private 19 Jul 81 { last cylinder referenc} {$endc} GenType: { General Purpose entry } ( GenCmd: 0..255; ced } FlpLastHead: integer; { last head referenced } GPIBTabletState: integer; { GPIB  NumBlks: 0..255; GenFill0: array[3..11] of integer; Result: integer; tablet current state } GPIBxTablet, GPIByTablet: integer; { GPIB tablet coordinates } GPIBInBuf: C5 6  { pointer to interrupt vector table } IOPriv1Unused: boolean; IOPriv2Unused: boolean; { unused } Kure DiskIntr; Abstract: DiskIntr handles a hard disk interrupt by clearing IOInProgreeyEnable: boolean; { if keyboard interrupts are enabled } {$ifc Ether3MBaud then} var etherCB: IOCBPtr; { ss. Procedure FloppyIntr; Abstract: FloppyIntr handles a floppy interrupt by clearing Pointer to IOCB used by Ethernet } pEBuff: IOBufPtr; { Pointer to Ethernet IO buffer }  IOInProgress. Procedure SpeechIntr; Abstract: SpeechIntr handles a speech interrupt by irBufPtr; { GPIB input buffer } StanleyTablet: boolean; { if Stanley tablet is enabled }  - 82 - PERQ Operating System Interface - IO_Private 19 Jul 81 E3Restart, { Ethe CurDskHds: integer; { number of heads on this disk. 4 or 8} CursF: integer; { function currr3 state } E3IsPromiscuous, E3InProgress, E3IsReceiving: boolean; E3RecErrs: integer; {$elsently in use} BotCursF: integer; { function for area below used area} BotComplemented: boolean; ec} {$ifc Ether10MBaud then} UnImplemented; {$endc} {$endc} { interrupt routines: } Procedure DiskIntr { whether bot is complemented or not} SBottomY: integer; { bottom of displayed area } Ta; { hard disk } Procedure FloppyIntr; { floppy disk } Procedure SpeechIntr; { speech out } Procedure GPIBbMode: TabletMode; { Current mode of the tablet } CCursMode: CursMode; { Current mode of cursorOutIntr; { GPIB out } Procedure GPIBInIntr; { GPIB in } Procedure TabIntr; { tablet (actually video retrace) } } newFunct: Boolean; { Tells when have a new function to insure that cursor redisplayed }  Procedure Z80Intr; { Z80 monitor } Procedure KeyIntr; { keyboard } Procedure RSIIntr; { RS232 in  CB : IOCBPtr; { Pointer to IOCB used by UnitIO } type IntTabPtr = ^IntVecTable; IntV} Procedure RSOIntr; { RS232 out } Procedure PutIntr; { PutStatus completion } Procedure GetIntr; ecTable = array [0..MaxUnit-FakeUnits] of record { NO Fake Units Included { GetStatus completion } {$ifc Ether3MBaud then} Procedure Ether3Intr; { 3 MBaud EtherNet completion } Function E3ResHere! } SSN: integer; GPtr: integer; Rtn:et: integer; Procedure E3RecStart; {$elsec} {$ifc Ether10MBaud then} UnImplemented; {$endc} {$endc}  0..255; SLink: integer end; var IntTab: IntTabPtr;  - 83 - PERQ Operating System Interface - IO_Private 19 Jul 81 Proced6 7  - 84 - PERQ Operating System Interface - IO_Private 19 Jul 81 Prochest legal device code } FakeUnits = 2; { Number of units which don't have StartIO's } IOStart = 0; { Masteredure Z80Intr; Abstract: Z80Intr ignores Z80 temperature/voltage monitoring. Procedure KeyIntr;  Z-80 control } HardDisk = 1; {$ifc Ether3MBaud then} Ether3 = 2; {$elsec} {$ifc Ether10MBaud then}  Abstract: KeyIntr processes KeyBoard interrupts by copying characters from the KeyBoar Ether10 = UnImplemented; {$endc} {$endc} Floppy = 3; Speech = 4; GPIBIn = 11; GPIBOut = d buffer into the (misnamed) translated keyboard buffer (KTBuf). Control-C, Control-Shift5; Z80Monitor = 6; Tablet = 7; KeyBoard = 8; RS232In = 9; RS232Out = 10; S-C, Control-Shift-D, Control-S, and Control-Q are processed also. Procedure RSIIntr; AbstracpPutSts = 12; { Put/Get Status } SpGetSts = 13; SpPutCir = 14; { Put/Get from Circular Buffet: RSIIntr ignores an RS232 input interrupt. Procedure RSOIntr; Abstract: RSIIntr ignorr } SpGetCir = 15; { Fake Units Begin Here } TransKey = 16; { Translated Keyboard }  clearing IOInProgress. Procedure GPIBOutIntr; Abstract: GPIBOutIntr handles a GPIB outes an RS232 output interrupt. Procedure PutIntr; Abstract: PutIntr handles a PutStatus interrupt put interrupt by clearing IOInProgress. Procedure GPIBInIntr; Abstract: GPIBInIntr  by clearing IOInProgress. Procedure GetIntr; Abstract: GetIntr handles a GetSthandles a GPIB input interrupt. The assumption is that the only GPIB input device is a atus interrupt by clearing IOInProgress. - BitPad. When a GPIB input interrupt is recognized for the first time, the Stanley tablet is turned  85 - PERQ Operating System Interface - IO_Unit 19 Jul 81 Module IO_Unit; Abstract: IO_Unoff. GPIBInIntr gathers characters from the BitPad and updates the tablet buffer. Procedure Tabit exports procedures to perform IO on the various IO Units (devices). Design: 1) UnitIO must increment and decreIntr; Abstract: TabIntr (misnamed) handles the video retrace interrupt. It smoothes the ment the IOCount of the segments which are involved in IO. 2) Segment faults must never happen while interrupts are off. tablet data and updates the displayed cursor position (if it is visible and has moved).  Exports Imports SystemDefs from SystemDefs; Const { Device Code Assignments } MaxUnit = 18; { hig7 8  BigStr = String[255]; { A big String } UnitRng = 0..MaxUnit; IOStatPtr = ^IOStatus { Special code for GetStatus } Name: packed array[0..3] of char end; Const { RS-232; IOStatus = record HardStatus: integer; { hardware status return } SoftStatus: inte Speeds } RS9600 = 1; RS4800 = 2; RS2400 = 4; RS1200 = 8; RS600 = 16; RS30ger; { device independent status } BytesTransfered: integer end; IOHeadPtr = ^IOHeader0 = 32; RS150 = 64; RS110 = 87; Type - 87 - PERQ Operating Syste; IOHeader = record { Hard disk header record } SerialNum: Double; m Interface - IO_Unit 19 Jul 81 Z80Readings = packed record { Z80 Voltage/Temp Monit { Serial number of the file } LogBlock: integer; { The logical block number or Readings } Ground: integer; Volts5: integer; Volts12: integer; } Filler: integer; NextAdr: Double; { Address of next Minus12: integer; VRef: integer; Net: integer; CRTemp: integer;  block in the file} PrevAdr: Double { Address of previous block }  BaseTemp: integer; Volts55: integer; Volts24: integer end; Z end; DevTabPtr = ^DeviceTable; DeviceTable = array [UnitRng] of packed record Ct80Settings = packed record { Z80 Voltage/Temp Monitor Settings } MinGround: integer; lPtr: IOBufPtr; { actually pointer to ChrCntlBlk or IOCB, } { but we'll coerce later }  MaxGround: integer; Min5: integer; Max5: integer; Min12: integer;  ScreenOut = 17; { Screen Display } Clock = 18; { Used only for Put/Get Status } LastUnit  BlockSize: integer; { 0 = variable size } { 1 = character device (uses c= Clock; { for unit validity checking } Type IOBufPtr = ^IOBuffer; IOBuffer = array[0..0] of integer;irc buf) } { >1 = fixed blocksize (= blocksize ) } IntrMask: integer; { CBufPtr = ^CBufr; CBufr = packed array[0..0] of char; { same as Memory, except character buffe interrupt mask bits } IntrPriority: integer; { decoded iterrupt priority (0..14) } rs } - 86 - PERQ Operating System Interface - IO_Unit 19 Jul 81  PSCode: 0..255; { Special code for PutStatus } GSCode: 0..255; 8 9 nteger; MaxVRef: integer; MinNet: integer; MaxNet: integer;  Z80Fill: 0..32767; case boolean of { Get oMinCRTemp: integer; MaxCRTemp: integer; MinBaseTemp: integer; MaxBaseTemp: inr Put; true = Get } true: ( { Get Status } teger; Min55: integer; Max55: integer; Min24: integer; Max24GetRead: Z80Readings; GetLimits: Z80Settings : integer end; DevStatusBlock = packed record ByteCnt: integer; { # of status ); false:( { Put Status } PutLimits: Z80Se bytes } case UnitRng of KeyBoard, Tablet, {$ifc Ether3MBaud then} ttings )); Floppy: (case integer of { Get or Put }  Ether3, {$elsec} {$ifc Ether10MBaud then} Ether10, {$endc} {$endc}  1: ( { Get Status } FlpUnit: 0..3;  Clock: (DevEnable: boolean); RS232In, RS232Out: (RSRcvEnable: boolean;  FlpHead: 0..1; FlpNotReady: boolean; FlpEquipChk: bool - 88 - PERQ Operating System Interface - IO_Unit 19 Jul 81 ean; FlpSeekEnd: boolean; FlpIntrCode: 0..3;  RSFill: 0..127; RSSpeed: 0..255; RSParity:  case integer of 1 {IORead, IOWrite, IOFormat}: (NoParity, OddParity, IllegParity, EvenParity); RSSto (FlpMissAddr: boolean; { in data or header } pBits: (Syncr,Stop1, Stop1x5,Stop2); RSXmitBits: (S FlpNotWritable: boolean; FlpNoData: boolean; FlpFiend5,Send7, Send6,Send8); RSRcvBits: (Rcv5,Rcv7, ll1: 0..1; FlpOverrun: boolean; FlpDataError: boolean; Max12: integer; MinMinus12: integer; MaxMinus12: integer; MinVRef: i Rcv6,Rcv8)); Z80Monitor: (Z80Enable: boolean; 9 :  0, double = #100 } FlpHeads: 0..255; { 1 or 2 heads } ure IOPutStatus(Unit: UnitRng; var StatBlk: DevStatusBlock); Procedure IOGetStatus(Unit: UnitRng; var StatBlk: DevStatusBlock); FlpEnable: boolean ); 3: (  Procedure IOBeep; {$ifc Ether3MBaud then} Function Ether3Transmit(Buff: IOBufPtr; WdCnt: integer) : integer;  { in data or header } FlpFill2: 0..1;  { Byte access } FlpByte1: 0..255; FlpByte2: 0..25 FlpEndCylinder: boolean; FlpDataMissAddr: boolean; 5; FlpByte3: 0..255; FlpByte4: 0..255;  { in data } FlpBadCylinder: boolean;  FlpByte5: 0..255; FlpByte6: 0..255; FlpByt FlpFill3: 0..3; FlpWrongCylinder: boolean; FlpDae7: 0..255 ) ) end; Type IOCommands = taDataError: boolean; { in data } FlpFill4: 0..3; (IOReset, IORead, IOWrite, IOSeek, IOFormat, IODiagRead, IOWriteFirst, IOIdle, IOWriteEOI,  FlpCylinderByte: 0..255; FlpHeadByte: 0..255;  IOConfigure); Var DevTab: DevTabPtr; { pointer to system device table } CtrlSPending: boolean;  FlpSectorByte: 0..255; FlpSizeSectorByte: 0..255  { if ^S has halted screen output } IOInProgress: boolean; { false when speech is active } IO24MByte: boole ); 2 {IOSeek}: (FlpPresean; { true if the disk is 24 MBytes } Function IOCRead(Unit: UnitRng; var Ch: char): integer; Function IOCWrite(UnntCylinder: 0..255 - 89 - PERQ Operating System Interface - IO_Unit it: UnitRng; Ch: char): integer; Procedure UnitIO(Unit: UnitRng; Bufr: IOBufPtr; Comman 19 Jul 81 ) ); 2: ( d: IOCommands; ByteCnt: integer; LogAdr: double; HdPtr: IOHeadPtr;  { Put Status } FlpDensity: 0..255; { single = StsPtr: IOStatPtr); Procedure IOWait(var Stats: IOStatus); Function IOBusy(var Stats: IOStatus): boolean; Proced: ; ion doesn't clear up. Parameters: Unit - device onto which the character will be written. ChBlk - block to which device status is to be returned. Procedure UnitIO( Unit: UnitRng;  - character to write. Returns: Condition code as defined by the module IOErrors. Procedure IOWait( v Bufr: IOBufPtr; Command: IOCommands; ByteCnt: integer; LogAar Stats: IOStatus ); Abstract: Hangs until an IO operation inititated by UnitIO is codr: double; HdPtr: IOHeadPtr; StsPtr: IOStatPtr ); Abstract: IO to nmplete. Parameters: Stats - Status block that was given to UnitIO when the operationon-character devices. Parameters: Unit - the device. Bufr - buffer for data transfers, if re was initiated. - 91 - PERQ Operating System Interface - IO_Unit quested. Command - operation to be performed on the device. ByteCnt - number of bytes to be transfer - 90 - PERQ Operating System Interface - IO_Unit 19 Jul 81 Function Ethe 19 Jul 81 Function IOBusy( var Stats: IOStatus): boolean; Abstract: Determines whether or r3Receive(Buff: IOBufPtr; var WdCnt: integer; timeout: integer): integer; Function Ether3Start(Promisnot I/O is complete. Parameters: Stats - Status block that was given to UnitIO when the cuous, Restart: boolean) : integer; {$elsec} {$ifc Ether10MBaud then} UnImplemented; {$endc} {$endc} Function IOCR operation was initiated. Returns: True if IO is not complete, false if it is. Procedure IOPutStatead(Unit: UnitRng; var Ch: char): integer; Abstract: Reads a character from a character device and returnus( Unit: UnitRng; var StatBlk:DevStatusBlock ); Abstract: Sets device's characteristics. Has no effecs a completion or error code. Parameters: Unit - device from which to read the character. t if the device has no settable status. Parameters: Unit - device whose characteristics a Ch - character to read. Returns: A condition code as defined in the module IOErrors. Funre to be set. StatBlk - block containing characteristics to be set. Procedure IOGetStatus( Unit: UnitRng; vction IOCWrite( Unit: UnitRng; Ch: char):integer; Abstract: Writes a character to a character device anar StatBlk:DevStatusBlock ); Abstract: Reads device status. Has no effect if the device has no d returns a completion or error code. Delays if the buffer is full. Returns an error if the condit readable status. Parameters: Unit - device whose characteristics are to be read. Stat; <  19 Jul 81 Module Lights; Abstract: This module defines the screen coordinates and size of theame: String ); Abstract: Given a run-file name as input, this procedure loads and executes  PERQ "lights". These are portions of the screen that are inverted during tedious operations such as recalib that program. When the program terminates (normally or abnormally) it returns to the loader which rating the disk and scavenging files (in FileAccess). Design: The lights must not extend below the 128th line of t returns to its caller. Parameters: RunFileName - Name of the .RUN file to load. ".RUN" is he screen. The Y + Size must be less than or equal to 256. It is a good idea for the lights to be totally inside  appended if it is not already present. of the title line. The current lights start at the left and leave ample room for new lights to the right of the current - 95 - PERQ Operating System Interface - Memory 19 Jul 81 Module Memory; Ab one. There is room for a total of 10 lights. Exports const LightUsed = TRUE; {whether should use the lightstract: Memory is the PERQ memory manager. It supervises the segment tables and exports procedures for manipus at all} LightY = 3; LightHeight = 14; LightWidth = 18; LightSpacing = 3*LightWilating memory segments. PERQ physical memory is segmented into separately addressable items (called segments) which may dth; LightRecalibrate = LightSpacing; LightScavenge = LightRecalibrate + LightWidth + LightSpacing; LightSwacontain either code or data. Design: See the Q-Code reference manual. Exports const MemoryVersion = '2.5'; Impred. LogAdr - logical address for block structured devices. HdPtr - pointer to the logical header fop = LightScavenge + LightWidth + LightSpacing; r operations with the hard disk. StsPtr - resultant status from the operation.  - 94 - PERQ Operating System Interface - Loader 19 Jul 81 Module Loader; Abst - 92 - PERQ Operating System Interface - IO_Unit 19 Jul 81 Procedure IOBeep; ract: This module implements the PERQ POS system loader. Given a run-file name as input, it loads and executes  Abstract: Causes the PERQ to "beep". that program. When the program terminates (normally or abnormally) it returns to the loader which returns to its ca - 93 - PERQ Operating System Interface - Lights ller. Exports const LoaderVersion = '2.3'; Procedure Load( RunFileName: String ); Procedure Load( RunFileN< =  { cursor segment } IOSeg = 6; { IO segment } SysNameSeg = 7; { system segment names (w: array[0..0] of Integer) end; pMMArray = ^MMArray; MMPointer = record case integer of } MemoryInBlocks = #1000; { amount of memory on this machine } MaxSegment = #137; { should be 2*16 - 1 }  1: (P: ^integer); 2: (B: pMMBlockArray); 3: (M: pMMArray); 4: (Offset: MMAddress; Segmen: Segme SetStkBase = #60; SetStkLimit = #120; {$ifc Ether3MBaud then} IOSegSize = 6; { number of blontNumber) end; SATentry = packed record { Segment Address Table } NotResident : boolean; { 001 cks in the IOSeg } {$elsec} {$ifc Ether10MBaud then} IOSegSize = UnImplemented; { number of blocks in the IOSeg } {$e} Moving : boolean; { 002 } RecentlyUsed: boolean; { 004 } Sharable : booleanlsec} IOSegSize = 3; { number of blocks in the IOSeg } {$endc} {$endc} SysSegLength = 8; { length o; { 010 } Kind : SegmentKind; { 020 } Full : boolean; { 040 } Inf name of a boot-loaded segment } MMMaxBlocks = #400; { maximum number of blocks in a segment } MMMaxCount = #3Use : boolean; { 100 } Lost : boolean; { *** } { 200 } BaseLower : MMBit8; Bas77; MMMaxIntSize = MMMaxBlocks-1; MMMaxExtSize = MMMaxBlocks; type MMBit4 = 0..#17; MMBit8 = 0..#377; eUpper : MMBit4; Size : MMBit12 end; SITentry = packed record case integer of { Segment In MMBit12 = 0..#7777; MMIntSize = 0..MMMaxIntSize; MMExtSize = 1..MMMaxExtSize; MMAddress = integer; formation Table } { real SIT entry } 1: (NextSeg : SegmentNumber; Increment : MMIntSize;  - 96 - PERQ Operating System Interface - Memory 19 Jul 81 MMPos Maximum : MMIntSize; Freelist : MMAddress; RefCount : 0..MMMaxCount; IOCount : 0..MMition = (MMLowPos, MMHighPos); SegmentNumber = integer; SegmentKind = (CodeSegment, DataSegment); SegmenMaxCount; - 97 - PERQ Operating System Interface - Memory 19 Jul tMobility = (UnMovable, UnSwappable, LessSwappable, Swappable); MMFreeNode = record N: M81 Mobility : SegmentMobility; BootLoaded : Boolean; case Integer of 1: (BootortsSystemDefs from SystemDefs; const SATSeg = 1; { SAT segment } SITSeg = 2; { SIT segementMAddress; L: integer end; MMBlockArray = array[0..0] of array[0..127] of integer; pMMBlockArray =  } FontSeg = 3; { font segment } ScreenSeg = 4; { screen segment } CursorSeg = 5; ^MMBlockArray; MMArray = record case Integer of 1: (m: array[0..0] of MMFreeNode); 2: = > ure IncRefCount( S: SegmentNumber ); Procedure SetMobility( S: SegmentNumber; M: SegmentMobility ); Procedure DecRefCount( S raised when a bad Size value is passed to some memory manager routine. This usually means that the size LowerAddress: Integer; BootUpperAddress: Integer; BootLogBlock: Integer); 2: (DiskLo: SegmentNumber ); Procedure SetIncrement( S: SegmentNumber; V: MMExtSize ); Procedure SetMaximum( S: SegmentNumber; V: MMExwerAddress: Integer; DiskUpperAddress: Integer; DiskId: Integer) ); { boot timetSize ); Procedure SetSharable( S: SegmentNumber; V: boolean ); Procedure SetKind( S: SegmentNumber; V: SegmentKind ); Pro information } 2: (BootBlock: record CS: SegmentNumber; { initial code segment } SS: SegmentNcedure MarkMemory; - 98 - PERQ Operating System Interface - Memory umber; { initial stack segment } XX: Integer; { unused } VN: Integer; { system v 19 Jul 81 Procedure CleanUpMemory; Procedure FindCodeSegment( var S: SegmentNumber; FId: Integer ); Procedure Enableersion number } FF: SegmentNumber; { first free segment number } FC: SegmentNumber; { first systSwapping( Where: Integer ); Procedure DisableSwapping; Function CurrentSegment: SegmentNumber; Exception UnusedSegmenem code segment } DK: integer; { disk system was booted from } CH: integer { char ut( S: SegmentNumber ); Abstract: UnusedSegment is raised when the memory manager esed in booting } end) end; SATarray = array[0..0] of SATentry; SITarray = array[0..0] of SITencounters a segment number which references a segment which is not in use. This may mean that a bad segmentntry; pSAT = ^SATarray; pSIT = ^SITarray; MMEdge = record H: SegmentNumber; { Head }  number was passed to some memory manager routine or that a bad address was de-referenced.  T: SegmentNumber { Tail } end; SysSegName = packed array[1..SysSegLength] of Char; pSyParameters: S - Segment number of the unused segment. Exception NotDataSegment( S: SegmentNumber ); sNames = ^SysNameArray; SysNameArray = array[0..0] of SysSegName; Procedure InitMemory; Procedure DataSeg( var S: Abstract: NotDataSegment is raised when the number of a code segment is passed to some memorSegmentNumber ); Procedure CodeOrDataSeg( var S: SegmentNumber ); Procedure ChangeSize( S: SegmentNumber; Fsize: MMExtSize )y manager routine that requires the number of a data segment. Parameters: S - Segment num; Procedure CreateSegment( var S: SegmentNumber; Fsize, Fincrement, Fmaximum: MMExtSize ); Procedber of the code segment. Exception BadSize( S: SegmentNumber; Fsize: Integer ); Abstract: BadSize is> ?  Abstract: FullMemory is raised when there is not enough physical memory to satisfy somkeEdge when it discovers the SIT entries are not linked together into a circular list. This is an e memory manager request. This is raised only after swapping segments out and compacting memory.error which should never happen in a debugged system. It usually means that there is a bug in the  Exception CantMoveSegment( S: SegmentNumber ); Abstract: CantMoveSegment is raised when the  memory manager or that the segment tables have been clobbered. Exception NilPointer; Abstmemory manager attempts to move a segment which is UnMovable or has a non-zero IO count. ract: NilPointer is raised when a Nil pointer is used or passed to Dispose. Exception BadPoint passed to CreateSegment or ChangeSize is greater than the maximum size or less than one. Parameters: Parameters: S - The number of the segment which cannot be moved. Exception PartNotMounted; Abstract Fsize - The bad Size value. Exception BadIncrement( S: SegmentNumber; Fincrement: Integer ); Abstra: PartNotMounted is raised when: 1) The memory manager attempts to swap a data segment out for ct: BadIncrement is raised when a bad Increment value is passed to some memory manager routhe first time; 2) The partition which is used for swapping is no longer mounted. Exceptiontine. This usually means that the increment passed to CreateSegment is greater than 256 or le SwapInFailure( S: SegmentNumber ); Abstract: SwapInFailure is raised when the swap file cannot be ss than one. Parameters: Fincrement - The bad Increment value.  found for a segment which is marked as swapped out. This is an error which should never happen in- 99 - PERQ Operating System Interface - Memory 19 Jul 81 Exception BadMaximum( S: SegmentNumber a debugged system. It usually means that there is a bug in the memory manager or that the; Fmaximum: Integer ); Abstract: BadMaximum is raised when a bad Maximum value is passed t segment tables have been clobbered. Parameters: S - The number of the segment which coo some memory manager routine. This usually means that the maximum passed to CreateSegment is greater than 256uld not be swapped in. - 100 - PERQ Operating System Interface or less than one. Parameters: Fmaximum - The bad Maximum value. Exception FullMemory; - Memory 19 Jul 81 Exception EdgeFailure; Abstract: EdgeFailure is raised by Ma? @ managers swapping routines is called when swapping is disabled. This is an error which should nevment. Procedure CodeOrDataSeg( var S: SegmentNumber ); Abstract: CodeOrDataSeg is used to 1) Determier happen in a debugged system. It usually means that there is a bug in the memory manager. ne if a given segment number represents a defined segment. 2) Find the default heap segment (in the var SAT: pSAT; SIT: pSIT; MMFirst, MMFree, MMLast, MMHeap: SegmentNumber; MMHole: MMEdge; MMState: (MMScan case of an input parameter of zero). Parameters: S - Data segment number--zero means the default hea1, MMScan2, MMScan3, MMScan4, MMScan5, - 101 - PERQ Operating System Interface - Memop segment. Errors: UnusedSegment if S is not in use. ry 19 Jul 81 MMScan6, MMScan7, MMScan8, MMScan9, MMScan10, MMScan11,  - 102 - PERQ Operating System Interface - Memory 19 Jul 81 Procedure ChangeSize MMNotFound, MMFound); StackSegment: SegmentNumber; FirstSystemSeg: SegmentNumber; BootFileId: Integer; ( S: SegmentNumber; Fsize: MMExtSize ); Abstract: ChangeSize is used to change the size of an existing dat SwappingAllowed: Boolean; SwapId: Integer; Procedure InitMemory; Abstract: InitMemory inia segment. Parameters: S - Number of the segment whose size is to be changed. er; Abstract: BadPointer is raised when a bad pointer is passed to Dispose. Exceptializes the memory manager. It is called once at system initialization and may not be called tion FullSegment; Abstract: FullSegment is raised by New when it discovers there is not en again. If the system was booted from a floppy, the system segments are all marked as UnSwappable. Prough room to allocate and the segment cannot be enlarged (its size has reached its maximum). Exception Nocedure DataSeg( var S: SegmentNumber ); Abstract: DataSeg is used to: 1) Determine if a given segmeoFreeSegments; Abstract: NoFreeSegments is raised when the memory manager discoversnt number represents a data segment; 2) Find the default heap segment (in the case of an input p that all of the segment numbers are in use and it needs another one. This is equivalent to "Segment arameter of zero). Parameters: S - Data segment number--zero means the default heap  table full". Exception SwapError; Abstract: SwapError is raised if one of the memory  segment. Errors: UnusedSegment if S is not in use. NotDataSegment if S is not a data seg@ A ut it is not movable or its IOCount is not zero. Procedure CreateSegment( var S: SegmentNumber; y sets the Mobility of a segment. The mobility may be set to one of the following values: Swappable  Fsize, Fincrement, Fmaximum: MMExtSize ); Abstract: CreateSegment is used to create a n - segment is a candidate for swapping or moving. LessSwappable - segment is a candidate for swappew data segment. Parameters: S - Set to the number of the new segment. Fsize - Desired size ing or moving, but the memory manager will be more reluctant to swap. UnSwappable - segment maof the new segment in blocks. Fincrement - Increment size of the new segment in blocks. Fmaximum - My not be swapped, but may be moved. UnMovable - segment may not be swapped or moved. aximum size of the new segment. Errors: BadSize if Fsize is greater than Fmaximum or less than  The RecentlyUsed bit of the segment is cleared also. Thus to make a segment a candidate for sw one. BadIncrement if Fincrement is greater than MMMaxExtSize or less than one. apping, set its mobility to Swappable (even if it already swappable). Parameters: S -  BadMaximum if Fmaximum is greater than MMMaxExtSize or less than one. FullMemory Segment number. M - Mobility. Errors: UnusedSegment if S is not in use. CantM if there is not enough physical memory to create the segment. Procedure IncRefCount( S: SegmentNumboveSegment if the segment is changing from Swappable to UnMovable an attempt is made to move er ); Abstract: IncRefCount increments the number of references to a segment. A non- the segment to the high end of memory. If it has a non-zero IO count, or swapping is diszero reference count prevents a segment from being destroyed. A reference count greater than one inabled, this error is issued. FullMemory if the segment is changing from Swappable to Fsize - New size of the segment. Errors: UnusedSegment if S is not in use. BadSize if Fsizdicates a system segment. Parameters: S - Number of the segment. Errors: UnusedSegmee is greater than the maximum size of S or less than one. FullMemory if there is not enont if S is not in use. - 103 - PERQ Operating System Interface - Memory ugh physical memory to increase the size of S. CantMoveSegment if the segment must be moved, b 19 Jul 81 Procedure SetMobility( S: SegmentNumber; M: SegmentMobility ); Abstract: SetMobilitA B  UnSwappable, it is swapped out, and there isn't enough memory to swap it in. Procedure  BadMaximum if V is greater than MMMaxExtSize or less than one. Procedure SetSharable( S: SeDecRefCount( S: SegmentNumber ); Abstract: DecRefCount decrements the reference count of a segment gmentNumber; V: boolean ); Abstract: SetSharable changes the "sharable" attribute of a segment  by one. If reference and IO counts both become zero: 1) if the segment is a data segment, it is destro (this attribute is not currently used). Parameters: S - Number of the segment. V - New vayed; or 2) if the segment is a code segment, it is destroyed only if it is in the screen or is non-rlue of the "sharable" attribute. Errors: UnusedSegment if S is not in use. esident. Parameters: S - Number of the segment. Errors: UnusedSegment if S is not i - 105 - PERQ Operating System Interface - Memory 19 Jul 81 Proceduren use. - 104 - PERQ Operating System Interface - Memory  SetKind( S: SegmentNumber; V: SegmentKind ); Abstract: SetKind changes the kind (code or data) of a segme 19 Jul 81 Procedure SetIncrement( S: SegmentNumber; V: MMExtSize ); Abstract: SetIncrement. Parameters: S - Number of the segment. V - New kind of the segment. Errors: nt changes the increment size of a data segment. Parameters: S - Number of the segme UnusedSegment if S is not in use. Procedure MarkMemory; Abstract: MarkMemory marks all cunt. V - New increment size. Errors: UnusedSegment if S is not in use. NotDatarrently in use segments as system segments usually before loading a user program) by incremenSegment if S is not a data segment. BadIncrement if V is greater than MMMaxExtSize or less ting their reference counts. Procedure CleanUpMemory; Abstract: CleanUpMemory destroys all user segmthan one. Procedure SetMaximum( S: SegmentNumber; V: MMExtSize ); Abstract: SetMaximum changes the maents (usually at the end of a program execution) by decrementing the reference count of all segmentsximum size of a data segment. Parameters: S - Number of the segment. V - New maximum size. . Procedure EnableSwapping( Where: Integer ); Abstract: EnableSwapping turns the swapping system on Errors: UnusedSegment if S is not in use. NotDataSegment if S is not a data segment. , determines where swap files should be created, and locates the boot file. Parameters: B C tNumber; Abstract: CurrentSegment finds the segment number of its caller. Result: Cu itself so that any call is guaranteed to be a cross-segment call. Thus, when the mrrentSegment = Segment number of the caller of CurrentSegment. ove operation is complete, a cross segment return is done, and the CodeBase micro-code r - 107 - PERQ Operating System Interface - MoveMem egister is reloaded. Movemem executes a special StartIO instruction to cause the micro-cod Where - FileId of some file in the partition to be used for swap files. Procedure DisableSw 19 Jul 81 Module MoveMem; Abstract: MoveMem is used to move a segment from one location to another in apping; Abstract: DisableSwapping attempts to swap in all segments which are swapped ou physical memory. The two locations may overlap. Exports Imports Memory from Memory; Procedure CopySegment( SrcSeg,t and then turns the swapping system off. If there is not enough physical memory to swap all  DstSeg: SegmentNumber; NewDstBase: Integer ); Procedure CopySegment( SrcSeg, DstSeg: SegmentNumbersegments in, swapping is not disabled. Errors: FullMemory if there isn't enough memory to swap all ; NewDstBase: Integer ); Abstract: CopySegment is used to move a segment from on segments in. - 106 - PERQ Operating System Interface - Memoe location to another in physical memory. Parameters: SrcSeg - Number of the segment whiry 19 Jul 81 Procedure FindCodeSegment( var S: SegmentNumber; FId: Integer ); Abstract: ch represents the source address and source size. DstSeg - Number of the segment which  FindCodeSegment searches for a code segment in the segment table which has a certain FileId. Irepresents the destination address. NewDstBase - New value of the base address for DstSeg. f such a segment is found, its RefCount is incremented and the segment number is returned. O Result: Base address of SrcSeg is set to the old base address of DstSeg. Base address of DstSetherwise, a zero segment number is returned. Parameters: S - Return parameter set to zero org is set the NewDstBase. Design: CopySegment moves segments without swapping them, and is d the number of the code segment. FId - Desired FileId. Function CurrentSegment: Segmenesigned in such a way that it may move itself or its own stack. To do this, CopySegment is in a code segment byC D this module must access the length byte they must turn off range checking. Exports Const MaxPStringSize=255;  not return a value. Side Effects: This procedure changes the dynamic length of Str. Errors: { Length of strings} Type PString = String[MaxPStringSize]; Procedure Adjust(Var STR:PString; LEN:Integer); Function Conca If Len > MaxPStringSize then raise StrLong exception. Function Concat(Str1,Str2:PString):PString; Abstractt(Str1,Str2:PString):PString; Function Substr(Source:PString; Index,Size: Integer):PString; Procedure Delete(Var Str:PString;: This procedure is used to concatenate two string together. Parameters:  Index,Size:Integer); Procedure Insert(Var Source,Dest:PString; Index:Integer); Function Pos(Source,Mask:PString): Integer;  Str1 and Str2 - the two strings that are to be concatenated. Environment:  Function PosC(s: PString; c: Char): Integer; Procedure AppendString(var s1: PString; s2: PString); Procedure AppendChar(var  None Results: This function returns a single string as described by the parameters. s: PString; c: Char); Function UpperCase(c: Char): Char; Procedure ConvUpper(Var s: PString); Exception StrBadParm;  Errors: If Length(Str1) + Length(Str2) is greater then MaxPStringSize then raise Se to reload its StackBase register. NOTE: This code segment must never exceed 256 words in length Abstract: Raised when bad index or length parameters passed to procedures or sometimes wh so that when CopySegment moves itself, the new copy cannot overlap the old one. CopySegment uses en string will be too long (other times, StrLong is raised in this case). Function RevPosC(s: PString; c: cha RasterOp to copy the memory so that the copy is done as an indivisible operation. NOTE: r): integer; Procedure Adjust(var Str:PString; Len:Integer); Abstract: This procedure is used to chan Don't use or change this routine unless you fully understand it. ge the dynamic length of a string. Parameters: Str - the string that is to have the length - 108 - PERQ Operating System Interface - PERQ_String 19 Jul 81 Module PERQ_String; Abstract: changed. Len - the new length of the string. This parameter must be This value  This module implements the string hacking routines for the Three Rivers PERQ Pascal. Strings in PERQ Pascal are smust be no greater than MaxPStringSize. Environment: None - 109 - tored a single character per byte with the byte indexed by 0 being the length of the string. When the routines in  PERQ Operating System Interface - PERQ_String 19 Jul 81 Results: This procedure doesD E  None Results: This function returns a substring as described by the parameter list. ffects: This procedure inserts Source in Dest starting at location Index. Errors:  Errors: If Index or Size is greater than MaxPStringSize, then raise StrBadParm exce A runtime error is generated if the resulting string is too long. ption. - 110 - PERQ Operating System Interface - PERQ_String 19 Ju - 111 - PERQ Operating System Interface - PERQ_String 19 Jul 81 Procedure AppendStril 81 Procedure Delete(var Str:PString; Index, Size:Integer); Abstract: This procedure is used to ng(var s1: PString; s2: PString); Abstract: puts s2 on the end of s1 Parameters: s1 - the left Str remove characters from a string. Parameters: Str - the string that is to be changed. Ching and s2 goes on the end. Calls: PERQString.Concat. SideEffects : modifies s1. Procedure AppendChar(var saracters are removed from this string. Index - the starting position for the delete. : PString; c: Char); Abstract: puts a character at the end of a string. Parameters:  Size - the number of character that are to be removed. Size characters are removed from Str startis - the string to be modified. c - the character that goes on the end of s. SideEffects: modng at Index. Environment: None Results: This procedure does not ifies s. Function UpperCase(c: Char): Char; Abstract: If c is a letter it is made uppercase. return a value. Side Effects: This procedure changes Str. Errors: None ProcedurParameters: c - any character Returns: The uppercase of c if c is a letter; otherwise, trLong exception. Function SubStr(Source:PString; Index, Size:Integer):PString; Abstract: This procede Insert(var Source, Dest:PString; Index:Integer); Abstract: Inserts a string into the middle of another sure is used to return a sub portion of the string passed as a parameter. Parameters: Soutring. Parameters: Source - the string that is to be inserted. Dest - the string into which rce - the string from which a portion is to be taken. Index - the starting position in Source of the the insertion is to be made. Index - the starting position, in Dest, for the insertio substring. Size - the size of the substring that is to be taken. Environment: n. Environment: None Results: This procedure does not return a value. Side EE F case Parameters: s - the string to be converted. Passed by reference. Function PosC(s: PString; c: char): integer; - 113 - PERQ Operating System Interface - PMatch  Abstract: Tests if c is a member of s. Parameters: c - any char; s - string to test19 Jul 81 module PMatch; Abstract: Does pattern matching on strings. Patterns accepted are as follows for c's membership in. Returns: index of first c in s (from beginning of string), or zero : "*" matches 0 or more characters "&" matches 1 or more characters "#" matches exactly 1 character  - 112 - PERQ Operating System Interface - PERQ_String 19 Jul 81 if  "'0" matches any digit "'A" matches any alphabetic (capitals only unless casefold) "'a" matches any alphnot there. Function RevPosC(s: PString; c: char): integer; Abstract: Reverse of PosC; reads string s abetic (lower case only unless 'casefold') "'@" matches any non-alphanumeric "'*" matches '*', other pattfrom right to left and returns the first occurrence from the right (i.e., the last occurrence erns chars can be quoted also Exports Function PattMatch(var str,pattern: string; fold: boolean): boolean; Fin the string) of character c. Parameters: c - any char s - string to test for c's membershiunction PattMap(var str,inpatt,outpatt,outstr:string; fold:boolean): boolean; Procedure PattDebug(v: boolean)p in. Returns: If c is found, index of the last occurrence of charcter c in string s, otherw; Function IsPattern(var str: string): boolean; Exception BadPatterns; Abstract: Raised if outPattise 0. Function Pos(Source, Mask:PString):Integer; Abstract: This procedure is used to find the posi and inPatt do not have the same patterns in the same order for PattMap. Procedure PattDebug(v: boolean);tion of a pattern in a given string. Parameters: Source - the string that is to be searched. Abstract: Sets the Global Debug flag Parameters: v - value to set debug to  Mask - the pattern that we are looking for. Environment: None Results: SideEffects: Changes debug value - 114 - PERQ Ope If Mask occurred in Source then the index into Source of the first character of Mask is returned. If Mask was rating System Interface - PMatch 19 Jul 81 Function IsPattern(var str: string): boolean; Abstrac is unchanged. Procedure ConvUpper(Var s: PString); Abstract: Converts s to all upper not found, then return 0. Side Effects: None Errors: None F G e against pattern. Undent 5 inpatt - pattern to compare against. It can have specia Lewis and W. H. Payne JACM Vol. 20, No. 3, July 1973, pp. 456-468. Random produces multi-dimensional psel characters in it. outpatt - pattern to put the parts of str into; it must have the same sudo-random numbers equally distributed in the interval -32768..32767 and has a period of 2^98. Exports Procedure Ict: Tests to see whether str contains any pattern matching characters. Parameters: pecial characters in the same order as inpatt outStr - the resulting string if PattMap returns  str - string to test Returns: true if str contains any pattern matching characters; true; fold - determines whether upper and lower case are distinct. If true, then not.  otherwise, false. Function PattMatch(var str, pattern: string; fold: boolean): boolean; Abstract:  - 115 - PERQ Operating System Interface - PMatch 19 Jul 81  Compares str against pattern. Parameters: str - full string to compare against pattern. pat Returns: True string matches pattern; false, otherwise. Errors: Raises BadPatterns if tern - pattern to compare against. It can have special characters in it. fold - determoutPatt and inPatt do not have the same patterns in the same order ines whether upper and lower case are distinct. If true, then not. Returns: true - 116 - PERQ Operating Syst if string matches pattern; false otherwise. Function PattMap(var str,inpatt,outpatt,outstr:string; fold:em Interface - RandomNumbers 19 Jul 81 module RandomNumbers; Abstract: Module RandomNumbers contains boolean):boolean; Abstract: Compares str against inPatt, putting the parts of str that two routines: InitRandom - initializes the random number generator. Random - a functiomatch inpatt into the corresponding places in outpatt and returning the result. EXAMPLES: n which returns a new random number each time it is referenced. There is currently no way to seed the  PattMap('test9.pas', 'test'0.pas', 'xtest'0.pas') => TRUE, 'xtest9.pas' PattMap('test9. generator. Random is a feedback shift-register pseudo-random number generator. The algorithm used is one depas', '*.pas', '*.ada') => TRUE, 'test9.ada' Parameters: str - full string to comparscribed in the article: 'Generalized Feedback Shift Register Pseudorandom Number Generator' T. G.G H The function that provides values from the profile file will return a line of text each time that it is called. Alnd PFile. Errors: PNotInited is raised if PFileName cannot be found. function PFileEntry: string; l text line between the # and the next # are assumed to be assoicated with the first s Abstract: This procedure is used to get the next profile entry for a subsystem. Resultubsystem. Successive calles to PFileEntry will return the next line of text for the current subsystem. Exports s: This procedure will return the next line from the profile file for the current subsystem. If Exception PNotFound(FileName: String); Abstract: Raised when profile file cannot be found. Param there are no more lines for the current subsystem return null. Environment: PFileInit must eters: FileName is the name of the profile that could not be found. Exception PNotInited; have been called before this procedure is used. Errors: PNotInited is raised if PFileInit hnitRandom; Function Random: integer; Procedure InitRandom; Abstract: Initialize the random n Abstract: Raised when a profile procedure is used but PFileInit has not been called. proumber generator. Every time this is called, the random numbers start over at the same place. cedure PFileInit(PFileName, SubSystem: String); function PFileEntry: string;  Function Random; Abstract: Returns a random number. Returns: A random 16-bit nu - 118 - PERQ Operating System Interface - Profile 19 Jul 81 procedure PFileInit(PFileName, Sumber. - 117 - PERQ Operating System Interface - Profile bSystem: String); Abstract: This procedure is called each time a subsystem wishes to start  19 Jul 81 module Profile; Abstract: This module is used to get information from the user profile file. Itto read information from the profile file. It is only called once per subsystem invocation. It will  provides facilities that will allow a program to get information from the user profile. The profile file is a text fi lookup the profile file and search for the required subsystem. Parameters: Ple that has the form: # . . . # ... The base unit of the file is a text line. em that is to be searched for. Side Effects: This procedure will change Inited, InLine aH I rArray = Array[0..0] of integer; shed. Resume: Allowed, but has no effect (procedure returns normally as if flush had been su - 120 - PERQ Operating System Interface - ReadDisk 19 Jul 81 Module ReadDisk; Abstccessful). - 121 - PERQ Operating System Interface - ReadDisk ract: Module to Read and write to the disk using a buffer system. Exports Imports DiskIO from DiskIO; Function R 19 Jul 81 Function ReadDisk(addr : DiskAddr) : ptrDiskBuffer; Abstract: Read the block eadDisk(addr : DiskAddr) : ptrDiskBuffer; Function ChangeDisk(addr : DiskAddr) : ptrDiskBuffer; Function ReadHeader(adspecified and return the ptr of the buffer read into. Parameters: addr - the address of the dr : DiskAddr) : ptrHeader; Function ChangeHeader(addr : DiskAddr) : ptrHeader; Procedure FlushDisk(addr : DiskAddr); Procblock to read. Returns: ptr to buffer read into. Function ReadAhead(addr : DiskAddr) : ptrDiskBuffer;edure WriteDisk(addr : DiskAddr; ptr : ptrDiskBuffer; hdptr : ptrHeader); Procedure WriteHeader(addr : Dis Abstract: Identical to ReadDisk. Parameters: addr - the address of the block to reakAddr; ptr : ptrDiskBuffer; hdptr : ptrHeader); Procedure InitBuffers; Function FindDiskBuffer(dskaddrd. Returns: ptr to buffer read into. Function ReadHeader(addr : DiskAddr) : ptrHeader; Abstra : DiskAddr; alwaysfind : boolean) : integer; Procedure ReleaseBuffer(indx : integer); Procedure Fluct: Reads block specified and returns a ptr to a buffer describing its header. Parametas not been called. - 119 - PERQ Operating System IshBuffer(indx : integer); Procedure FlushAll; Procedure ChangeBuffer(indx : integer); Procedure ChgHdr(indx : integer); Procnterface - Raster 19 Jul 81 Module Raster; Abstract: Support definitions for RasterOp. Exedure UseBuffer(indx,numtimes : integer); Function BufferPointer(indx : integer) : ptrDiskBuffer; Function HeaderPointer(indports Const RRpl = 0; { Raster Op function codes } RNot = 1; RAnd = 2; RAndNot = x : integer) : ptrHeader; Function ReadAhead(addr : DiskAddr) : ptrDiskBuffer; Procedure ForgetAll; Exception FlushF3; ROr = 4; ROrNot = 5; RXor = 6; RXNor = 7; Type RasterPtr = ^RasterArray; ail; Abstract: Raised when the system is unable to flush out a buffer. The buffer is marke {a pointer that can be used as RasterOp or Line source and destination } Rasted as flushed out; however, so the error does not repeat the next time a buffer needs to be fluI J  data; in addition, mark file as changed so a flush operation will write it back to the disk. or addr is in a buffer then Release it first. Parameters: addr - the address of the block to Parameters: addr - the address of the block to read. Returns: ptr to buffer holding the b write. ptr - points to a buffer of data. hdptr - points to a buffer of header. lock read into. - 122 - PERQ Operating System Interface - ReadDisk  - 123 - PERQ Operating System Interface - ReadDisk 19 Jul 81 Proce 19 Jul 81 Function ChangeHeader(addr : DiskAddr) : ptrHeader; Abstract: Reads block spdure InitBuffers; Abstract: Initializes the buffer system. Function FindDiskBuffer(dskaddr : DiskAddrecified and returns a ptr to its data; in addition, mark file as header changed so flush writes it ; alwaysfind : boolean) : integer; Abstract: Finds the buffer that contains out using IOWriteFirst. Parameters: addr - the address of the block to read. Returns: the data for block dskAddr. Parameters: dskAddr - address to find buffer for.  ptr to header read into. Procedure FlushDisk(addr : DiskAddr); Abstract: Removes block specified f alwaysFind - tells whether to read in if not found. Returns: Index of buffer found or zero if not thererom buffer system and writes it out if changed. If addr not in buffer then NO-OP. Parameters: . Procedure ReleaseBuffer(indx : integer); Abstract: Mark the table entry as unused. Paramete addr - block to flush. Procedure WriteDisk(addr : DiskAddr; ptr : ptrDiskBuffer; hdptr : ptrHeader)rs: indx - entry to mark. Procedure FlushBuffer(indx : integer ); Abstract: Write out ; Abstract: Writes out a block using DskWrite. If block for addr is in a buffer then Relea the data for the buffer indx if changed and then mark the buffer as not changed. Parameters: se it first. Parameters: addr - the address of the block to write. ptr - points to a buffer  indx - buffer to flush. Errors: FlushFail is raised if cannot Flush a buffer due to a ers: addr - the address of the block to read. Returns: ptr to header read into. Functioof data. hdptr - points to a buffer of header. Procedure WriteHeader(addr : DiskAddr; ptr : ptrDiskBuffer; n ChangeDisk(addr : DiskAddr) : ptrDiskBuffer; Abstract: Reads block specified and returns a ptr to its hdptr : ptrHeader); Abstract: Writes out a block using DskFirstWrite. If block fJ K  Abstract: return the bufferPtr for a buffer. Parameters: indx - buffer. Returns: ( var F: FileType; var X: boolean ); Abstract: Reads a boolean in free format. Parameters:  write error. Procedure FlushAll; Abstract: Writes out the data for all the buffers and the Ptr to buffer. - 125 - PERQ Operating System Interface - Rean mark them all as unchanged. Errors: FlushFail is raised if cannot Flush a buffer due todDisk 19 Jul 81 Function HeaderPointer(indx : integer) : ptrHeader; Abstract: retu a write error. Does not stop at first error, but goes and tries all buffers before raisrn the header Ptr for a buffer. Parameters: indx - buffer. Returns: ptr to header. ing the exception. - 124 - PERQ Operating System Interface - ReadDisk   19 Jul 81 Procedure ForgetAll; Abstract: Writes out the data for all the buffers and then - 126 - PERQ Operating System Interface - Reader 19 Jul 81 Module Reader; Abstract: Readmark them all as unused. Errors: FlushFail is raised if cannot Flush a buffer due to a er is the character input module of the Stream package. It is called by code generated by the Pascal compiler in response  write error. Does not stop at first error, but goes and tries all buffers before raising tto Read or Readln. It is one level above Module Stream and uses Stream's lower-level input routines. Exports he exception. Procedure ChangeBuffer(indx : integer); Abstract: Mark a buffer as changed. Par Imports Stream from Stream; Procedure ReadBoolean( var F: FileType; var X: boolean ); Procedure ReadCh( var F: FileType;ameters: indx - buffer to mark. Procedure ChgHdr(indx : integer); Abstract: Mark a buff var X: char; Field: integer ); Procedure ReadChArray( var F: FileType; var X: ChArray; Max, Len: inter as having its header changed. Parameters: indx - buffer to mark. Procedure UseBuffer(indx,numtimeseger ); Procedure ReadIdentifier( var F: FileType; var X: integer; var IT: IdentTable; L: integer  : integer); Abstract: Mark a buffer as used. Parameters: indx - buffer to mark. ); Procedure ReadInteger( var F: FileType; var X: integer ); Procedure ReadString( var F: FileType; var X: String;  numTimes - the number to increment use count by. Function BufferPointer(indx : integer) : ptrDiskBuffer;  Max, Len: integer ); Procedure ReadX( var F: FileType; var X: integer; B: integer ); Procedure ReadBooleanK L ters: X - the character array to be read. F - the file from which X is to be read. Maxad. Errors: PastEof if an attempt is made to read F past the Eof. -  - the declared length of X. Len - the size of the field. Len <= 0 selects free format r128 - PERQ Operating System Interface - Reader 19 Jul 81 NotNumber if non-numericeading. Errors: PastEof if an attempt is made to read F past the Eof. Procedure ReadIdentifier( var  input is encountered in the file. LargeNumber if the number is not in the range F: FileType; var X: integer; var IT: IdentTable; L: integer ); Abstract: Reads  -32768..32767. Procedure ReadString( var F: FileType; var X: String; Max, Len: in X - the boolean to be read. F - the file from which X is read. Errors: PastEof if anan identifier and returns its position in a table. A table lookup is performed requiring only that the  attempt is made to read F past the Eof. NotBoolean if a non-boolean is encountered in the file. Procedure R identifier typed uniquely matches the beginning of a single table entry. Parameters: eadCh( var F: FileType; var X: char; Field: integer ); Abstract: Reads a character in fixed or free format X - set to the ordinal of the identifier read. F - the file from which X is read. IT - the t. Parameters: X - the character to be read. F - the file from which X is to be read. able of identifiers indexed from 0 to L. L - the largest identifier ordinal defined by the table. Errors:  Field - the size of the field X is in. Errors: PastEof if an attempt is made to read F past the Eo BadIdTable if length of the identifier table is less than 1. PastEof if an f. - 127 - PERQ Operating System Interface - Reader 19 Jul attempt is made to read F past the Eof. NotIdentifier if a non-identifier is encountered in the 81 Procedure ReadChArray( var F: FileType; var X: ChArray; Max, Len: integer ); Abstract:  file. IdNotDefined if the identifier is not in the table. IdNotUnique if the identifier is not  Reads a packed character array in free or fixed format. If free format reading is selected, spacunique. Procedure ReadInteger( var F: FileType; var X: integer ); Abstract: Reads a decimal integer ies are skipped and characters are read until another space is encountered. Paramen free format. Parameters: X - the integer to be read. F - the file from which X is to be reL