;
; FILE SYSGEN.ASM 
;
; COPYRIGHT 1980, 1981, 1982, 1983, 1984 CONVERGENT TECHNOLOGIES, INC.
; ALL RIGHTS RESERVED
;
; THIS PROGRAM IS FURNISHED UNDER A LICENSE RESTRICTING ITS USE
; SOLELY FOR THE OPERATION OF A DESIGNATED COMPUTER FOR A
; PARTICULAR PURPOSE, AND MAY NOT BE COPIED OR OTHERWISE USED
; WITHOUT THE PRIOR WRITTEN CONSENT OF CONVERGENT TECHNOLOGIES,
; INC.  TITLE TO AND OWNERSHIP OF THE PROGRAM, INCLUDING ITS
; SOURCE CODE, SHALL AT ALL TIMES REMAIN IN CONVERGENT
; TECHNOLOGIES.
;
; The file sysgen.mdf contains all of the macro definitions for the macros 
; which are contained in this file, sysgen.asm. The intent is to make 
; changing the system build parameters as painless as possible, and so this 
; file has been created using macros which provide a high degree of 
; readability and allow the user to ignore the Assembly language constructs 
; which are actually generated. The prefix file and Sysgen.asm contain macros 
; which generate three sections of data:
;
;       1. resident tables and variables
;       2. OsTable from which CTOS will allocate
;          space for nonsysgen resident tables
;          and variables
;       3. initial tables and variables
;          which will be discarded after CTOS
;          initialization is completed.
;
; CLUSTER CONFIGURATION  
; This module uses several macro symbols to determine  the configuration of 
; the  CTOS being built.  The prefix files  iClstrLfsSp.asm, a210ClstrSp.asm, 
; iopMstrMp.asm, etc. set these symbols.   The prefix file includes both 
; Sysgen.asm and Sysgen.mdf. In the form  given  to the assembler, list only 
; the name of the prefix file.
;
; HARD DISK AND DEBUGGER OPTIONS        
; To simplify removal of optional debugger and hard disk, two flags are used, 
; fHDisks and fDebugger.  These are both set to TRUE (1) unless one of the  
; above prefix files files (iClstrLfsSp.asm, a210ClstrSp.asm, ...) sets them 
; explicitly.  To remove the  debugger or hard disk, set the appropriate flag 
; to FALSE (0) and assemble  this module.  NOTE that you must also change the 
; appropriate XXX.link file  as described in the Building a Customized CTOS 
; section of the System  Programmer's Guide.
;
; NOTES FOR CHANGING THIS FILE 
;
; Please be aware that in the Convergent Assembly language there are two types 
; of comments, normal comments, (any text on a line after a ; character,  
; and a macro comment (' text ').  It is not possible to comment out a 
; macro by inserting a ; in front of it.  You may comment out a macro by 
; replacing the percent sign in the call with a ;, or by precceding the call 
; with '.  This will cause the macro processor to ignore any text up to and 
; including the next ' or RETURN (0Ah) character, whichever comes first. 
; Macro calls must not be mixed.  In general, the invocation of a macro causes 
; an entry to be added to a table, and mixing macro calls would result in 
; scrambled tables.
;
; In most cases, you will not change this file at all, but rather will change 
; the SET macros contained in the prefix file (such as iClstrLfsMp.Asm or 
; t1MstrMp.Asm versions of CTOS). The meaning of these SET macros is explained 
; below.
;
; SET AND CONFIGURATION MACROS USED IN THIS FILE 
;
; The following macros are used to control the conditional
; statements in this module:
;
;  WsType ............. 0: IWS standalone workstation
;                       1: IWS cluster workstation
;                       2: IWS minicluster master
;                       3: IWS CommIOPcluster master
;                       4: AWS210
;                       5: AWS220, AWS230, or AWS240
;                       6: AWS240
;                       7: NGEN cluster
;                       8: NGEN
;                       9: Ngen Master
;                       10: FP
;                       11: TP
;                       12: CP
;                       13: SP
;                       14: DP
;                       15: RP
;
;  HardwareType ....... 0: IWS
;                       1: AWS210
;                       2: AWS220 or AWS230
;                       3: AWS240
;                       4: NGEN
;                       10: FP
;                       11: TP
;                       12: CP
;                       13: SP
;                       14: DP
;                       15: RP
;
;  ClusterConfig ...... 0: Standalone workstation
;                       1: Cluster workstation
;                       2: Cluster master
;
;  fNoFileSystem ...... 0: Any workstation with a filesystem
;                       1: Cluster stations without filesystems
;
;  fCommIOP ........... 0: Any workstation but CommIOP master
;                       1: CommIOPcluster master
;
;  fDebugger .......... 0: Exclude debugger
;                       1: Include debugger
;
;  fHDisks ............ 0: No hard disks
;                       1: Include hard disks
;
; Compilation flags and system build parameters.  The Set macros placed in 
; the prefix file (such as iClstrLfsSp.Asm, or t1ClstrSp.Asm), are defined 
; as follows:
;
;       lineHz ............. This is the AC line frequency,
;                            used by the real time clock (50Hz
;                            or 60Hz)
;
;       fVerifyFileStruct .. If this is non zero then CTOS will
;                            verify file structures after
;                            writing to disk.  Adds 512 bytes.
;                            Halves file system performance.
;
;       sContingencyLog .... Stray interrupt log (minimum value
;                            is 1 word)
;
;       sKbdBuffer ......... Keyboard type ahead buffer (must
;                            be a power of 2)
;
;       sOutBuffer ......... size in bytes of the output
;			     character buffer.  This size must
;			     be a power of 2.  The output buffer
;			     is used by Megaframes in administrator mode.
;
;       maxMedInterruptType  Maximum type number of all
;                            mediated interrupts set.
;
;       nFrames ............ Number of simultaneous video
;                            frames.  Each frame adds 20 bytes.
;
;       nSysExchange ....... Exchanges reserved for CTOS.
;                            Obsolete.
;
;       nUsrExchange ....... User Exchanges (maximum 64).  Each
;                            adds 4 bytes.
;
;       nPcb ............... Number of processes (CTOS and user
;                            combined).  The largest standard
;                            OS has 8, and the Executive has 2,
;                            making a minimum of  10.  Each adds
;                            40 bytes.
;
;       nMsgWait ........... Total number of message link
;                            blocks.  The minimum number needed
;                            by CTOS is the sum of
;                            nMsgWaitReserve (see below) plus
;                            20.  Each adds 4 bytes to CTOS.
;
;       nMsgWaitReserve .... Number of message link blocks
;                            reserved for CTOS pSend primative.
;                            Obsolete.
;
;       nPTiming ........... Total number of simultaneous real
;                            time clock service requests.  CTOS
;                            requires at least 16 to run all
;                            Convergent programs.  Each adds 4
;                            bytes.
;
;       nIob ............... Total number of simultaneous disk
;                            IO requests allowed.  CTOS
;                            requires at least 6 to run all
;                            Convergent programs.  Each iob
;                            structure adds 50 bytes to CTOS.
;
;       nFab ............... Total number of runs allowed for
;                            all open files combined.  The
;                            appropriate number is highly
;                            dependent on the frequency of file
;                            creation, deletion, and expansion;
;                            and on the frequency with which
;                            you reload your disk volumes.
;                            Each fab structure is 10 bytes.
;
;       nVhb ............... Total number of disk devices in
;                            the system.  Each adds 256 bytes.
;
;       nWinch ............. Number of Winchester disks (the
;                            SyQuest cartridge is counted as a
;                            Winchester disk).
;
;       nUcb ............... Number of user control blocks.
;                            Each is 95 bytes.  In clusters,
;                            changing this number causes
;                            various other numbers (see below)
;                            to also be changed.
;
;       nWsUserNum ......... Number of workstation user numbers.
;                            There is a user number required for
;                            partition in each workstation.  The
;                            default is the number of
;                            workstations plus 3.  Megaframe only.
;
;       nFcb ............... Total number of open files allowed
;                            in the system.  Each adds 11
;                            bytes.  This is a function of the
;                            number of workstations (see nUcb
;                            above).
;
;       nFub ............... Number of file user blocks (used
;                            to lookup a fcb from a file
;                            handle).  This should be the same
;                            as nFcb.  Each adds 5 bytes.  This
;                            is a function of the number of
;                            workstations (see nUcb above).
;
;       nXBlk .............. Number of transmission blocks (=
;                            number of request control blocks).
;                            Each is 512 bytes times the number
;                            nSectorPerXBlk (see below).  This
;                            is a function of the number of
;                            workstations (see nUcb above).
;
;       nSectorPerXBlk ..... Number of sectors in each
;                            transmission block (see nXBlk
;                            above).
;
;       nSectorPerXBlkFst .. For an NGen master, if a high speed line is
;                            specified in config.sys (:ClusterLineSpeed: 
;                            1.8mbps), the number of sectors in each 
;                            transmission block will be taken from 
;                            nSectorPerXBlkFst instead of nSectorPerXBlk.
;
;       nXBlkSmall ......... Number of small transmission blocks (= 
;                            sMaxSmallRq). Requests received from cluster
;                            workstations that will fit in a small XBlk will
;                            not take up a large XBlk. This is designed for
;                            applications that need to have a number of small
;                            requests that will be outstanding for long 
;                            periods of time.
;
;       sMaxSmallRq ........ The maximum size (in bytes) of a request that 
;                            will fit in a small XBlk.
;
;       wsTotal ............ Total number of workstations
;
;       sioClock ........... Sio Clock divisor.  It is the
;                            divisor of 1,228,800 baud. (4 for
;                            307200 baud)
;
;       fIopDump ........... Crashdump the IOP on load if non
;                            zero
;
;       nIops .............. Number of IOP's
;
;       nWsLine1 ........... Maximum number of workstations
;                            which may be attached to channel 1
;                            of IOP 1 or CP
;
;       nWsLine2 ........... Maximum number of workstations
;                            which may be attached to channel 2
;                            of IOP 1 or CP
;
;       nWsLine3 ........... Maximum number of workstations
;                            which may be attached to channel 1
;                            of IOP 2
;
;       nWsLine4 ........... Maximum number of workstations
;                            which may be attached to channel 2
;                            of IOP 2
;
;       nUserNum ........... The maximum number of users that can be 
;                            supported by this workstation. A master 
;                            needs to allocate one user number for each local
;                            user (nUcb) plus one for each possible cluster
;                            user.
;
;       nYblk .............. Number of large ICC request blocks
;                used to hold remote requests.
;
;       nSectorPerYblk ..... Size of a Yblk, measured in 512
;			     byte units.  This must be at least
;			     as large as as an Xblk (5 is the
;			     minimum size)
;
;       nZblk .............. Number of small ICC request blocks
;			     Each Zblk costs sZblk bytes
;			     The default Zblk size is 100 bytes
;
;       sZblk .............. Size of a Zblk
;
;       nReqEnts ........... Size of the ICC input request
;			     circular buffer.  Each entry costs
;			     five bytes.
;
;       nRespEnts .......... Size of the ICC input response
;			     circular buffer.  Each entry costs
;			     five bytes.
;
;       sStatArea .......... Size of the ICC statistics ares. A
;			     minimum of 10 bytes is recommended
;
;       sTermArea .......... Master FP only.  Size of the
;			     terminal routing area.  One entry
;			     per terminal (RS232 or PT) in the
;			     system is required.  Each entry
;			     costs two bytes.
;
;       sLineArea .......... Master FP only.  Size of the  line
;			     routing area.  One entry per RS422
;			     line is required.  Each entry is
;			     two bytes long.
;
;       sRouteArea ......... Master FP only. One entry per
;			     request code is required.  Each
;			     entry costs one byte.
;
;       nLine .............. Number of configured RS422 lines
;			     on a CP.  Values of 1 or 2 are OK.
;
;       fSrpClock1 ......... Line speed of RS422 line 1.  A
;			     value of 0FFh indicates the 1.8Mbs
;			     speed while 0 indicates the 307kbs
;
;       fSrpClock2 ......... As above, but for line 2.
;
;       nAdapters .......... Maximum number of multibus adapters
;			     in Megaframe system.  If omitted, a default
;			     value of 1 is assumed.
;
;       nNetUsers .......... The maximum number of CtNet users that can be 
;                            supported by this workstation.
;
;       FontRamBuf ......... 0FFh indicates that 8704 bytes
;                            buffer is reserved at low memory
;                            for LoadFontRam operations
;
;       sOsData ............ The OS requires data space for
;                            dynamically allocated
;                            data structures (such as stacks,
;                            etc.).  Failure to make this number
;                            large enough will result in a crash
;                            with an ERC 101 at boot.
;
;  TO BUILD FULL CLUSTER (IOP) CTOS 
;       Each IOP card has two channels or lines.  There may be
; 2 IOP cards on a workstation.  The number of IOP cards must
; be specified, and the number of workstations on each line
; must be specified, where lines 1 and 2 are on the first IOP
; card and lines 3 and 4 are on the second.  If there is only
; one IOP card the number of workstations on lines 3 and 4
; should be set to 0.
;
EVEN
;
;  The ICC Server Agent massages certain requests to allow the  
;  File Processor (s) to perform DMA directly to the target.    
;  These requests are declared using the RemoteDmaRequest macro 
;  The RemoteDmaRequest macro is documented in Sysgen.mdf       
;

if ((fFP) OR (fDP)) Then (
RemoteDmaRequest(35,3025h,18,1)
RemoteDmaRequest(36,3026h,18,1)
RemoteDmaRequest(3004h,3004h,28,1)
RemoteDmaRequest(3005h,3005h,28,1)
RemoteDmaRequest(301Dh,301Dh,28,1)
RemoteDmaRequest(3020h,3020h,28,1)
) Fi

RemoteDmaRequest(191,191,18,1)
RemoteDmaRequest(192,192,18,1)

EVEN
; STARTIO 
;
; The SysGen description of StartIO routines for the different
; mass storage devices are put in an array,  called rgMassioDisp,
; in the order of device class defined in their DCB's.  MassIO
; Process uses this array to dispatch IO requests.
;
; To declare a StartIO routine use the macro MassioDisp with
; one argument, the name of the public        procedure which will
; initiate IO for the device.  THE MACRO HAS TO BE INVOKED
; ACCORDING TO THE ORDER OF THE DEVICE CLASS.  IF THERE IS
; DISCONTINUITY IN THE SEQUENCE OF DEVICE CLASSES, A DUMMY
; ENTRY HAS TO BE PROVIDED.
;
;       MassioDisp(pStartIO)
;

If (fMFHardware) THEN (
	IF (fFP OR fDP) Then (
    MassioDisp(StartHardDisk)	; Fp  SP+SC each have 1 type StartIO routine
	)FI

) ELSE (' Workstation

IF (((wsType NE iwsCluster) AND
      (wsType NE aws210) AND
      (wsType NE ngenCluster)) OR
     (localFs NE 0)) THEN (

MassioDisp(StartHardDisk)		; Device class 0  Winchester StartIO routine
MassioDisp(StartFloppy)		; Device class 1  Floppy StartIO routine
MassioDisp(StartHardDisk)		; Device class 2  Winchester (SMD Cntllr)
MassioDisp(StartHardDisk)		; Device class 3  Floppy (SMD Cntllr) StartIO
MassioDisp(StartHardDisk)		; Device class 4  SMD StartIO routine

)FI)FI
;
; Exit Run File 
;	This macro defines the name of a file which CTOS loads
; when the application program calls Exit or ErrorExit, or
; <ACTION><FINISH> are entered.
;

IF(*isdef(ExitFile)) THEN (
    ExitRunFile(ExitFile,,128)
    )
ELSE (
IF(fMFHardware) THEN (
    ExitRunFile([Sys]<Sys>CLI.Run,,128)
) ELSE (
    ExitRunFile([Sys]<Sys>Signon.Run,,128)
)FI)FI

;
;  Specify the name of a volume which is designated as the
; volume [SCR].  This is the volume where the spooler is
; going to create temporary files.
;

IF(*isdef(ScratchVolume)) THEN (
    ScratchVolumeSpec(ScratchVolume)
    )
ELSE (
    ScratchVolumeSpec(Sys)
    )FI
IF(fVarPar) THEN (
;
;
; SwapFileTryFirst(File name,pswd)
; SwapFileTryEach (File name,pswd,ibToNumber,ckCreateDefault)
;
;	These macros define the name of a file which CTOS uses
; when it becomes necessary to write a running program onto disk.
;
; The file mentioned in SwapFileTryFirst is tried first. The file
; must be at least as large as the default create size (last argument).
; If it cannot be opened or is too small, then SwapFileTryEach is tried.
; Each time a decimal number is inserted into the name at the position
; indicated by the third parameter (char position, 1st char=0).
; If the file is in use, the next is tried.
; If the file couldn't be opened a Create is tried. If the create
; fails, the OS crashes with ercNoSwapFile.
;
; The file is created with size as indicated by the forth macro arg.
; Size is measured in kilobytes(1024 byte blocks). A size of 512 would
; create a swap file of 12 megabyte.
; 
;

IF(*isdef(SwapFile)) THEN (
    SwapFileTryFirst(SwapFile,)
    )
ELSE (
    SwapFileTryFirst([sys]<sys>CrashDump.sys,)
    )FI

IF(*isdef(SwapFileLoop)) THEN (
    SwapFileTryEach(SwapFileLoop(00),,LEN(SwapFileLoop),1500)
    )
ELSE (
    SwapFileTryEach([sys]<sys>SwapArea00.sys,,18,1500)
    )FI
)FI

;
;  SysGen Description of Interrupt handlers. There are two
; types of interrupt handlers, raw and mediated.
;
;
; RAW INTERRUPTS   A raw interrupt handler is a routine to
; which control is passed by the 8086 CPU when the interrupt
; occurs.  It is the resposability of the handler to save the
; current register context, and to restore context before
; executing an interrupt return.  A raw interrupt may be
; generated by hardware (through the 8259A interrupt chip) or
; by software (with an int or an int nn instruction).
;
;
; MEDIATED INTERRUPTS  A mediated interrupt is one which
; CTOS mediates for the user, by saving the current register
; context, and then calling the interrupt handler as a
; subroutine.  This is especially usefull because it allows
; FORTRAN and Pascal procedures to be written as interrupt
; handlers.  A mediated interrupt may be generated by
; hardware or software, just as with the raw interrupts.
;
;
; INTERRUPT TYPE  The 8086 interrupt type is a code which the
; 8086 CPU uses to distinguish different hardware interrupts.
; A hardware interrupt may be generated in one of three ways.
; First, the 8086 may generate the interrupt itself (division
; error, overflow [with OF enabled], or after every instruction
; if TF is enabled.  Second, a nonmaskable interrupt may occur,
; signalling some catastrophic error such as power failure, bus
; timout, or parity error.  Third, a maskable interrupt
; generated by the 8259A interrupt chip may occur.  A software
; interrupt may be of any type (0 to 119).  The type is used to
; map the interrupt to a pointer in low memory which contains
; the CS:IP of the appropriate interrupt handler.  Each
; pointer is 4 bytes, starting with type 0 at 0000:0000h, type
; 1 at 0000:0004h, etc.  The fixed interrupt types are as
; follows:
;
;	type 0 ... divide error
;	type 1 ... single step (TF enabled)
;	type 2 ... nonmaskable interrupts
;	type 3 ... special one byte interrupt instruction
;		   (used by Convergent Debugger)
;	type 4 ... arithmetic overflow (OF enabled)
;		5	Array Bounds
;		6 	Undefined Opcode trap
;		7	ESC Opcode trap
;		8	Timer 0
;       18	Timer 1
;       19	Timer 2
;       9	Reserved
;       10	DMA 0 Interrupt
;       11	DMA 1 Interrupt
;       12	Int 0 Interrupt
;       13	Int 1 Interrupt  Doorbell
;       14	Int 2 Interrupt
;       15	Int 3 Interrupt
;
;  Other entries less than or equal to 31 are reserved
;
; Note that it is not possible to have more than one routine to
; handle any interrupt type.
;
; There are 8 interrupt levels corresponding to interrupts
; generated by the 8259A, which are mapped onto 8 types (8 
; 15).  Four of these typeslevels are reserved for Convergent
; devices and four are conected to the Multibus interface:
;
;     level:  type:   assignment:
;	0	8	Multibus
;	1	9	communications controller
;	2	10	Multibus
;	3	11	programmable interval timer
;	4	12	printer, keyboard, realtime clock,
;			8087 math chip
;	5	13	Multibus
;	6	14	Multibus
;	7	15	disk storage subsystem (floppy and
;			hard disk)
;
;
; RAW INTERRUPT DECLARATION  To declare a raw interrupt
; handler use the macro RawInterrupt with two arguments, the
; 8086 interrupt type, and the name of the public procedure
; which will handle the interrupt.  Note that a raw interrupt
; handler must save the user context (registers), and should
; return with the iret Assembly Language instruction.  The
; effect of executing this macro is to have the CS:IP of the
; handler put into the pointer associated with the interrupt
; type:
;
;	RawInterrupt(type,pHandler)
;
;
; MEDIATED INTERUPT DECLARATION  To declare a mediated
; interrupt handler, use the macro MediatedInterrupt with
; three arguments, the interrupt type, a flag (0 or 0FFh)
; saying whether or not the interrupts are generated by the
; 8259A interrupt chip, and the name of the interrupt handler.
; CTOS will use the macro declarations to build a table which
; it will use to service interrupts:
;
;'	MediatedInterrupt(type,f8259,pHandler)
;
;
; ADDING HANDLERS  In addition to adding the macro
; declaration of an interrupt handler, you must link CTOS with
; the object module containing the handler.  The handler should
; be written following the conventions outlined in the Assembly
; Language Manual (appendix) relating to register BP usage,
; segment names, etc.
;
; CASCADED 8259A's  If you cascade 8259A interrupt chips on
; custom multibus cards, you must declare the interrupt level
; which is cascaded.  The only legal levels are of course 0, 2,
; 5, and 6.  To declare a cascaded 8259A use the macro
; InterruptCascadeLevel with one argument, the level.  For
; example, if you are cascading level 6 (8086 type 14), you
; would declare:
;
;'	InterruptCascadeLevel(6)
;
;
; NON DECLARED INTERRUPTS  Any interrupt which occurs of a
; type for which an interrupt handler is not supplied will
; cause CTOS to generate a crash, which is described in the
; CTOS manual.  In particular, no handler is supplied for
; division errors.
;
;
; REFERENCES  Furthur information on interrupt handlers may
; be found in the following Convergent documents:
;
;	CTOS manual, section on Interrupt Handlers
;	The Assembly Language Manual, appendix on programming
;	conventions
;
;
; Interrupt handlers:
;
IF (wsType LT aws210) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(5, CEntry)		; CTOS kernal primatives
RawInterrupt(6, RqInterface)		; system service requests
RawInterrupt(7, OsSubEntry)		; system common routines
RawInterrupt(9, RawCommNub)		; comm interrupts
RawInterrupt(12, L4IntDisp)		; level four interrupts
RawInterrupt(15, MassIntDisp)		; mass storage device
EVEN
MediatedInterrupt(2,0,NMaskInterrupt)	; non maskable interrupts
MediatedInterrupt(11,0FFh,TimerInterrupt)
)FI
					; programmable timer
IF (wsType EQ iwsIopMaster) THEN (
MediatedInterrupt(iopIntLevel+8,0FFh,IopIsr)	; IOP communication
)FI

IF (wsType EQ aws210) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(2, NMaskInterrupt)	; Nonmaskable interrupt(parity)
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(5, CEntry)		; CTOS kernal primatives
RawInterrupt(6, RqInterface)		; system service requests
RawInterrupt(7, OsSubEntry)		; system common routines
RawInterrupt(12,IsrNull) 		; Transmit ready (channel A)interrupt
RawInterrupt(13,IsrExStat)   		; External status change (Channel A)
RawInterrupt(14,IsrNull) 		; First character received (Channel A)ignore
RawInterrupt(15,IsrRxspec)		; End of frame(Channel A)
RawInterrupt(23, pIret)		; Funny interrupt for Comm Dma(when 8259 exists)
MediatedInterrupt(8,0FFh,KbdTxInt) 	; Transmit ready interrupt(channel B)
IF(fAwsPIT)THEN(
MediatedInterrupt(9,0FFh,TimerInterrupt) ; Timer interrupt(channel B)
)ELSE(
MediatedInterrupt(9,0FFh,RTCInterrupt) ; Timer interrupt(channel B)
)FI
MediatedInterrupt(10,0FFh,KbdRxInt) 	; Receive ready interrupt(channel B)
MediatedInterrupt(11,0FFh,KbdErrInt) 	; Special receive condition interrupt(channel B)
)FI

IF (wsType EQ aws220_240) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(2, NMaskInterrupt)	; Nonmaskable interrupt(parity)
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(5, CEntry)		; CTOS kernal primatives
RawInterrupt(6, RqInterface)		; system service requests
RawInterrupt(7, OsSubEntry)		; system common routines
IF (localFS EQ 1) THEN (
RawInterrupt(12,IsrNull) 		; Transmit ready (channel A)interrupt
RawInterrupt(13,IsrExStat)   		; External status change (Channel A)
RawInterrupt(14,IsrNull) 		; First character received (Channel A)ignore
RawInterrupt(15,IsrRxspec)		; End of frame(Channel A)
)FI
RawInterrupt(19,RawCommNub)  		; comm interrupts
RawInterrupt(23, pIret)		; Funny interrupt for Comm Dma
MediatedInterrupt(8,0FFh,KbdTxInt) 	; Transmit ready interrupt(channel B)
IF(fAwsPIT)THEN(
MediatedInterrupt(9,0FFh,TimerInterrupt) ; Timer interrupt(channel B)
)ELSE(
MediatedInterrupt(9,0FFh,RTCInterrupt) ; Timer interrupt(channel B)
)FI
MediatedInterrupt(10,0FFh,KbdRxInt) 	; Receive ready interrupt(channel B)
MediatedInterrupt(11,0FFh,KbdErrInt) 	; Special receive condition interrupt(channel B)
MediatedInterrupt(20,0FFh,L4IntDisp)	; Line printer interrupt
IF (fHDisks EQ 0) THEN (
MediatedInterrupt(22,0FFh,FloppyInterrupt)	; Floppy interrupt handler
)FI
IF (fHDisks NE 0) THEN (
MediatedInterrupt(22,0FFh,HardDiskInterrupt)	; Hard disk interrupt handler
)FI
)FI
EVEN
IF (wsType EQ awsMaster) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(2, NMaskInterrupt)	; Nonmaskable interrupt(parity)
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(5, CEntry)		; CTOS kernal primatives
RawInterrupt(6, RqInterface)		; system service requests
RawInterrupt(7, OsSubEntry)		; system common routines
RawInterrupt(12,IsrNull) 		; Transmit ready (channel A)interrupt
RawInterrupt(13,IsrExStat)   		; External status change (Channel A)
RawInterrupt(14,IsrNull) 		; First character received (Channel A)ignore
RawInterrupt(15,IsrRxspec)		; End of frame(Channel A)
RawInterrupt(19,RawCommNub)  		; comm interrupts
RawInterrupt(23, pIret)		; Funny interrupt for Comm Dma
MediatedInterrupt(8,0FFh,KbdTxInt) 	; Transmit ready interrupt(channel B)
IF(fAwsPIT)THEN(
MediatedInterrupt(9,0FFh,TimerInterrupt) ; Timer interrupt(channel B)
)ELSE(
MediatedInterrupt(9,0FFh,RTCInterrupt) ; Timer interrupt(channel B)
)FI
MediatedInterrupt(10,0FFh,KbdRxInt) 	; Receive ready interrupt(channel B)
MediatedInterrupt(11,0FFh,KbdErrInt) 	; Special receive condition interrupt(channel B)
MediatedInterrupt(20,0FFh,L4IntDisp)	; Line printer interrupt
MediatedInterrupt(21,0FFh,HaltCommIO)	; Floppy board 8253 timer for master comm
MediatedInterrupt(22,0FFh,HardDiskInterrupt)	; Floppy interrupt handler
)FI

IF (wsType EQ ngenCluster) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(19, RTCInterrupt)

RawInterrupt(40, PmTraceRawInt)	;Protected mode trace (debugger)
RawInterrupt(41, PmBreakRawInt)	;Protected mode breakpoint (debugger)

RawInterrupt(65, RawCommNub)		; RS232 comm interrupts
RawInterrupt(68, SigIsr)		; Cluster comm interrupts
RawInterrupt(72, CEntry)		; CTOS kernal primatives
RawInterrupt(73, RqInterface)		; system service requests
RawInterrupt(74, OsSubEntry)		; system common routines
MediatedInterrupt(2,0,NMaskInterrupt)	; non maskable interrupts
MediatedInterrupt(10,0FFh,LpInterrupt)	; Line printer interrupt
MediatedInterrupt(69,0FFh,TimerInterrupt)	; programmable timer
MediatedInterrupt(70,0FFh,IntHKbd)	; keyboard
)FI

IF (wsType EQ ngen) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(19, RTCInterrupt)

RawInterrupt(40, PmTraceRawInt)	;Protected mode trace (debugger)
RawInterrupt(41, PmBreakRawInt)	;Protected mode breakpoint (debugger)

RawInterrupt(65, RawCommNub)		; RS232 comm interrupts
IF (localFS EQ 1) THEN (
RawInterrupt(68, SigIsr)			; Cluster comm interrupts
) FI
RawInterrupt(72, CEntry)			; CTOS kernal primatives
RawInterrupt(73, RqInterface)		; system service requests
RawInterrupt(74, OsSubEntry)		; system common routines
MediatedInterrupt(2,0,NMaskInterrupt)	; non maskable interrupts
MediatedInterrupt(10,0FFh,LpInterrupt)	; Line printer interrupt
MediatedInterrupt(15,0FFh,FloppyInterrupt)	; Floppy interrupt handler
IF(fHDisks NE 0) THEN (
MediatedInterrupt(67,0FFh,HardDiskInterrupt)	; hard disk
)FI
MediatedInterrupt(69,0FFh,TimerInterrupt)	; programmable timer
MediatedInterrupt(70,0FFh,IntHKbd)	; keyboard
)FI

IF (wsType EQ ngenMaster) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(3, BreakRawInt)		; Convergent debugger
RawInterrupt(19, RTCInterrupt)

RawInterrupt(40, PmTraceRawInt)	;Protected mode trace (debugger)
RawInterrupt(41, PmBreakRawInt)	;Protected mode breakpoint (debugger)

RawInterrupt(65, RawCommNub)		; RS232 comm interrupts
RawInterrupt(68, SigIsr)		; Cluster comm interrupts
RawInterrupt(72, CEntry)		; CTOS kernal primatives
RawInterrupt(73, RqInterface)		; system service requests
RawInterrupt(74, OsSubEntry)		; system common routines
MediatedInterrupt(2,0,NMaskInterrupt)	; non maskable interrupts
MediatedInterrupt(10,0FFh,LpInterrupt)	; Line printer interrupt
MediatedInterrupt(15,0FFh,FloppyInterrupt)	; Floppy interrupt handler
IF(fHDisks NE 0) THEN (
MediatedInterrupt(67,0FFh,HardDiskInterrupt)	; hard disk
) FI
MediatedInterrupt(69,0FFh,TimerInterrupt)	; programmable timer
MediatedInterrupt(70,0FFh,IntHKbd)	; keyboard
)FI

IF(fMFHardware) THEN (
RawInterrupt(1, TraceRawInt)		; Convergent debugger
RawInterrupt(3, BreakRawInt)		; Convergent debugger
If ((fTP) OR (fCP)) Then (
		RawInterrupt(10, LpIntDisp)	; Line printer interrupt
        RawInterrupt(18, TpPollerInt)	; CpTp's character polling clock
) ELSE (
        RawInterrupt(18, RTCtick)		; Real time clock
) FI

IF (fCP) THEN (
    RawInterrupt(12,CpSrpIsr)
    RawInterrupt(14,RawCommNub)
) FI
IF (fTP) THEN (
    RawInterrupt(14,RawCommNub)
    RawInterrupt(15,RawCommNub)
)FI

RawInterrupt(13,Chime)

RawInterrupt(32, CEntry)		; CTOS kernel primatives
RawInterrupt(33, RqInterface)		; system service requests
RawInterrupt(34, OsSubEntry)		; system common routines

EVEN

MediatedInterrupt(2,0,NMaskInterrupt)	; Nonmaskable interrupt
MediatedInterrupt(19,0ffh,TimerInterrupt)	; Pit

If ((fFP) OR (fDP)) Then (
     MediatedInterrupt(12, 0FFh, HardDiskInterrupt)	; mass storage device
) FI    
)FI' Megaframe
EVEN
;
;
;  Space occupied by the tables below this location will be
; recalimed by the CTOS after its initialization
;
;  ANY REORDERING OF THIS FILE MUST NOT CROSS THIS BOUNDRY 
;
; CTOS has been carefully constructed so that the various parts
; of CTOS reside either before this boundry (resident code and
; data) or after (initialization code and data).  There are
; five segments which are used in controlling this:
;
;	code ... anything in this segment will be resident
;	const .. anything in this segment will be resident
;	data ... anything in this segment will be resident if
;		   the module is linked before sysgen.obj, or
;		   non resident if linked after
;	stack .. anything in this segment will be nonresident
;	coed ... anything in this segment will be non
;		   resident (ie discarded after intialization)
;
; The CTOS processes are allocated stacks out of memory
; reserved by the following macro call, and the stack segment
; is used only for a stack during CTOS initialization.
;
; The following macro is invoked with one argument, the number
; of bytes to be reserved for CTOS to use to build its
; structures, tables, and to allocate the stacks for the
; different processes (declared later in this file).  The macro
; variable sOsData may be defined in the prefix file if
; desired.  The OS will crash with as error 101 if this value
; is too small.
;

IF (*IsDef(sOsData)) THEN (
ResidentDataBoundry(sOsData)
) ELSE (
IF (wsType EQ iwsStandAlone) THEN (ResidentDataBoundry(25600))FI
IF (wsType EQ iwsCluster) THEN (ResidentDataBoundry(25600))FI
IF (wsType EQ iwsMiniMaster) THEN (ResidentDataBoundry(25600))FI
IF (wsType EQ iwsIopMaster) THEN (ResidentDataBoundry(30720))FI
IF (wsType EQ aws210) THEN (ResidentDataBoundry(15240))FI
IF (wsType EQ aws220_240) THEN (ResidentDataBoundry(20480))FI
IF (wsType EQ awsMaster) THEN (ResidentDataBoundry(26600))FI
IF (wsType EQ ngenCluster) THEN (ResidentDataBoundry(15240))FI
IF (wsType EQ ngen) THEN (ResidentDataBoundry(20480))FI
IF (wsType EQ NGenMaster) THEN (ResidentDataBoundry(26600))FI
IF (fMFHardware) THEN (ResidentDataBoundry(25600))FI
)FI
EVEN
;
;
;   Table which describes reserved exchanges
; for CTOS resident processes. List each exchange only once.
;
;
AssignSysExch(10)	;lclFileSys
AssignSysExch(12)	;agent
AssignSysExch(5)	;termination
AssignSysExch(1)	;kbd
AssignSysExch(24)	;kbd internal
AssignSysExch(3)	;sysin or LogProc_MF
AssignSysExch(15)	;init process
IF (fNoFileSystem EQ 0) THEN ('
AssignSysExch(8)	;massIo
)FI
IF(clusterConfig EQ 1)THEN('
AssignSysExch(17)	;filter process
)FI
IF(clusterConfig EQ 2)THEN('
AssignSysExch(17)	;master agent receiver, also MF
AssignSysExch(13)	;master agent
)FI
IF (fMulPar) THEN ('
AssignSysExch(26)	;swapper internal
AssignSysExch(2)	;video semaphore internal and Kbd_MF
)FI
IF (fMFHardware) THEN ('
AssignSysExch(18)	;Icc
AssignSysExch(19)	;Icc
AllocSysExch(FilterProcessExch)	;File spec routing process
AllocSysExch(exchFilterPocket)		;File spec routing process pocket
)FI
IF (fCP OR fTp) THEN ('
AssignSysExch(16)	;ExchVidKbd
AssignSysExch(20)	;ExchTpReq
AssignSysExch(21)	;ExchTpResp
)FI
IF (fVarPar) THEN ('
'	The following must be done last, so it chooses an exch nobody else wants.
AllocSysExch(exchSchedPocket)	;any free exch
)FI
EVEN
;
;
; EXCHANGE MAPPING TABLE:
;
;	Virtual exchanges are negative numbers, 1,2..
;	At boot time, exchange tables are scanned,
;	all virtual exchanges replaced by:
;		rgExchReal(NOT vexch)
;
;	The macros SymExchange and MapExchange define the table:
;
;	 SymExchange(name, value)
;		defines a local symbolic name for an exchange,
;		for readability. Doesn't make a table entry.
;
;	 MapExchange(n, name, value)
;		defines a local name and makes a table entry.
;		The numbers n must be in order, 1 2 3 ...
;		with no duplicates and no omissions.
;
;
; This section uses the macro symbols clusterConfig and localFS
; to determine the Request configuration of the CTOS being built.
; Requests are directed to different exchanges depending on the
; cluster and file system configuration of the OS.  There are
; four different versions as follows:
;
;    cluster  localFS  Configuration
;    config
;
;		0		1      Standalone OS. (e.g., nStnd)
;
;		1		0      Cluster OS.  (e.g., nClstr)
;
;		1		1      Cluster OS with Local File System.  (e.g., nClstrLfs)
;
;		2		1      Master OS.  (e.g., nMstr)
;
;				   Stnd	ClsLfs	Master
;	exchAgent		0	12		12
;	exchNotInstalled 0	12		0
;	exchMassIO		8	128	8
;	exchFilSys1		10	1210	10
;	exchFilSys2		8	128	8
;	exchFilSys3		10	1217	10
;	exchFilSys4		10	12		10
;	exchChgUsrN		10	12		10
;	exchMstrAgent	0	0		12
;	exchLog			10	12		10 (or 3 if SRP)
;	exchFilterPros	0	017	0
;	exchMem			10	10		10 (or exchSched if fVarPar)
;	exchVp			0	0		0  (or exchSched if fVarPar)
;	exchKbd			0	0		0  (or exchKbdRes if fKbdRes)
;	exchTp			0	0		0  (or exchgTp if Tp or Cp)
;
;
;
; Exchange definitions 
;	Exchanges 0 to 27 are reserved for CTOS processes.
;
SymExchange(exchgKbdRes, 1)		; Resident Keyboard process
SymExchange(exchgLclFs, 10)		; File system manager Utility

IF (fMFHardware) THEN (

IF ((fFP) Or (fDP)) Then (
    MapExchange(1,exchgAgent, 0)
    MapExchange(2,exchgNotInstalled,  0)
    MapExchange(3,exchgMassIO,  8)	; Mass storage
    MapExchange(4,exchgFilSys1, exchgLclFs)	; File system managerUtility
    MapExchange(5,exchgFilSys2, exchgMassIO)
    MapExchange(6,exchgFilSys3, exchgLclFs)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgLclFs)	; File system manager Utility
    MapExchange(8,exchgChgUsrN, exchgLclFs)	; Mp Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 0)
    MapExchange(10,exchgLog,  3)
    MapExchange(11,exchgFilterPros, FilterProcessExch)
	SymExchange(exchgTpReq, 0)
) FI


IF (fTP)  Then (  
    MapExchange(1,exchgAgent, 0)
    MapExchange(2,exchgNotInstalled,  0)
    MapExchange(3,exchgMassIO,  0)	; Mass storage
    MapExchange(4,exchgFilSys1, 0)	; File system managerUtility
    MapExchange(5,exchgFilSys2,  exchgMassIo)
    MapExchange(6,exchgFilSys3, 0)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgLclFs)	; File system manager Utility
    MapExchange(8,exchgChgUsrN, 0)	; Mp Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 0)
    MapExchange(10,exchgLog,  3)
    MapExchange(11,exchgFilterPros, FilterProcessExch)
	SymExchange(exchgTpReq, 20)
) FI

IF (fSP) Then (
    MapExchange(1,exchgAgent, 0)
    MapExchange(2,exchgNotInstalled,  0)
    MapExchange(3,exchgMassIO,  0)	; Mass storage
    MapExchange(4,exchgFilSys1, 0)	; File system managerUtility
    MapExchange(5,exchgFilSys2, exchgMassIo)
    MapExchange(6,exchgFilSys3, 0)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgLclFs)	; File system manager Utility
    MapExchange(8,exchgChgUsrN, 0)	; Mp Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 0)
    MapExchange(10,exchgLog,  3)
    MapExchange(11,exchgFilterPros, FilterProcessExch)
	SymExchange(exchgTpReq, 0)
) FI


IF (fCP) Then (
    MapExchange(1,exchgAgent, 0)
    MapExchange(2,exchgNotInstalled,  0)
    MapExchange(3,exchgMassIO,  0)	; Mass storage
    MapExchange(4,exchgFilSys1, 0)	; File system managerUtility
    MapExchange(5,exchgFilSys2, exchgMassIo)
    MapExchange(6,exchgFilSys3, 0)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgLclFs)	; File system manager Utility
    MapExchange(8,exchgChgUsrN, 0)	; Mp Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 12)
    MapExchange(10,exchgLog,  3)
    MapExchange(11,exchgFilterPros, FilterProcessExch)
	SymExchange(exchgTpReq, 20)
) FI
    MapExchange(12,exchgMem, exchgLclFs)
    MapExchange(13,exchgVp, 0)
    MapExchange(14,exchgKbd, exchgKbdRes)
    MapExchange(15,exchgTp, exchgTpReq)

) ELSE (' Workstation
IF (fVarPar) THEN ('
AllocSysExch(exchSched)	; Variable Partition process
)FI
;
; Standalone workstation:
;
IF (clusterConfig EQ 0) THEN(
    MapExchange(1,exchgAgent, 0)	; no agent
    MapExchange(2,exchgNotInstalled, 0)
    MapExchange(3,exchgMassIO, 8)	; Mass storage IO manager
    MapExchange(4,exchgFilSys1, exchgLclFs)	; File system manager Utility
    MapExchange(5,exchgFilSys2, exchgMassIO)
    MapExchange(6,exchgFilSys3, exchgLclFs)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgLclFs)	; File system manager Utility
    MapExchange(8,exchgChgUsrN, exchgLclFs)	; MultiPart Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 0)
    MapExchange(10,exchgLog, exchgLclFs)
    MapExchange(11,exchgFilterPros, 0)
)FI
;
; cluster workstation:
;
IF (clusterConfig EQ 1) THEN(
    MapExchange(1,exchgAgent, 12)	; Cluster work station agent
    MapExchange(2,exchgNotInstalled, exchgAgent)
    IF (localFS EQ 0) THEN (
    MapExchange(3,exchgMassIO, exchgAgent)	; Mass storage IO manager
    MapExchange(4,exchgFilSys1, exchgAgent)	; Local File System File Spec Filter Process
    MapExchange(5,exchgFilSys2, exchgAgent)
    MapExchange(6,exchgFilSys3, exchgAgent)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgAgent)	; File system manager Utility
    ) FI
    IF (localFS NE 0) THEN (
    MapExchange(3,exchgMassIO,  8)	; Mass storage IO manager
    MapExchange(4,exchgFilSys1, exchgLclFs)
    MapExchange(5,exchgFilSys2, exchgMassIO)
    MapExchange(6,exchgFilSys3, 17)	; File system filter sends to agent and local fs
    MapExchange(7,exchgFilSys4, exchgAgent)	; File system manager Utility
    ) FI
    MapExchange(8,exchgChgUsrN, exchgAgent)	; MultiPart Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 0)
    MapExchange(10,exchgLog,  exchgAgent)
    IF (localFS EQ 0) THEN (
    MapExchange(11,exchgFilterPros, 0)
    ) ELSE (
    MapExchange(11,exchgFilterPros, 17)
    ) FI
)FI
;
; Master workstation: (mini and full clusters)
;
IF (clusterConfig EQ 2) THEN(
    MapExchange(1,exchgAgent, 12)	; Master work station agent
    MapExchange(2,exchgNotInstalled,  0)
    MapExchange(3,exchgMassIO,  8)	; Mass storage
    MapExchange(4,exchgFilSys1, exchgLclFs)	; File system managerUtility
    MapExchange(5,exchgFilSys2, exchgMassIO)
    MapExchange(6,exchgFilSys3, exchgLclFs)	; File system manager Utility
    MapExchange(7,exchgFilSys4, exchgLclFs)	; File system manager Utility
    MapExchange(8,exchgChgUsrN, exchgLclFs)	; MultiPart Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, exchgAgent)
    MapExchange(10,exchgLog,  exchgLclFs)
    MapExchange(11,exchgFilterPros, 0)
)FI

IF (fVarPar) THEN(
    MapExchange(12,exchgMem, exchSched)
    MapExchange(13,exchgVp, exchSched)
) ELSE (
    MapExchange(12,exchgMem, exchgLclFs)
    MapExchange(13,exchgVp, 0)
)FI
IF (fKbdRes) THEN(
    MapExchange(14,exchgKbd, exchgKbdRes)
) ELSE (
    MapExchange(14,exchgKbd, 0)
)FI
)FI' Workstation
EVEN
;
;
;	Define names of files containing loadable requests.
;	Files are loaded at boot after the file system is up.
;	Files with names of the form:
;		[sys]<sys>Request.?.sys
;	where ? is a character 09, AZ, are always tried first.
;
;
IF (fMFHardware) THEN (
IF (fTP)  Then (  
	RequestFileName([SYS]<SYS>REQUEST.TP.SYS);
)FI

IF (fCP)  Then (  
        RequestFileName([SYS]<SYS>REQUEST.CP.SYS);
)FI

IF ((fFP) OR (fDP)) Then (  
        RequestFileName([SYS]<SYS>REQUEST.FP.SYS);
)FI

IF (fSP)  Then (  
        RequestFileName([SYS]<SYS>REQUEST.SP.SYS);
)FI

) ELSE (' Workstation
	RequestFileName([sys]<sys>Request.ISAM.sys)
)FI
EVEN
;
;
;   Table which describes the CTOS resident process.  Each
; process is described by 4 attributes:     
;				
;      1. Process entry point                       
;      2. Size of its stack
;      3. priority (0 is highest, 254 lowest)
;      4. default exchange (0 if not required, <> 0 allocs next available)
;
;   Stack size 
;	The stack size for a CTOS process must be large enough
; for the largest local variable and procedure call sequence,
; plus enough space for all possible interrupts that can occur.
; CTOS requires 64 bytes of user stack to save the context of a
; process when an interrupt occurs.
;                                                   
;   Priorities                                    
;	In order for CTOS to function correctly, the following
; priority considerations must be obeyed:
;
; Megaframe:
;	IccResp ............... highest priority
;	IccSvr ................ second highest priority
;	KbdProcess ............ lower than Agents (must be process 0)
;	TpProcess ............. lower than KbdProcess
;	MassIo ................ higher than FileSystem
;	SrpAgent .............. lower than MassIo, higher than FileSystem
;	FilterPros ............ higher than FileSystem, lower than Icc
;	FileSystem ............ lower than MassIo
;	LogProcess............. lower than IO processes, (file system user)
;	TerminationProcess .... lowest of CTOS processes
;
; Workstations:
;	InitKbdProcess ............ lower than Agents (must be
;				process 0)
;	MassIo ................ higher than FileSystem
;	MstrAgent .............. lower than MassIo, higher than FileSystem
;	WsAgent ............... higher than FileSystem
;	FileSystem ............ lower than MassIo
;	SysInPro .............. lower than IO processes, (file system user)
;	TerminationProcess .... lowest of CTOS processes
;	Sched ................. higher than TerminationProcess, lower than
;				FileSystem
;
; All user (non CTOS) processes must be worse in priority than
; CTOS processes (The Convergent Executive starts all user
; programs with priority 128).
;
;
; Standalone:
;
IF (fMFHardware) THEN (
OsProcDesc(IccSvr,		    512, 2, 19)
; File Processor
If (fFP) Then (
    OsProcDesc(KbdProcess,	    256, 3,  TRUE)
    OsProcDesc(MassIo,		    512, 3,  FALSE)
    OsProcDesc(LclFsFilterProcess,	    128, 3, TRUE)
    OsProcDesc(FileSystem,	    512, 4, TRUE)
    OsProcDesc(LogProcess,	    256, 5, TRUE)
    OsProcDesc(TerminationProcess, 356, 6,  TRUE)
) FI

; Terminal Processor

If (fTP) Then (
    OsProcDesc(KbdProcess,     512, 3,  TRUE)
    OsProcDesc(LclFsFilterProcess,	    128, 3, TRUE)
    OsProcDesc(FileSystem,	    512, 4, TRUE)
    OsProcDesc(TpProcess,	    512, 5, TRUE)
    OsProcDesc(LogProcess,	    256, 6,  TRUE)
    OsProcDesc(TerminationProcess, 356, 7,  TRUE)
) FI

; Communications Processor

If (fCP) Then (
    OsProcDesc(KbdProcess,     512, 6, TRUE)
    OsProcDesc(LclFsFilterProcess,	    128, 6, TRUE)
    OsProcDesc(FileSystem,	    512, 7, TRUE)
    OsProcDesc(MstrAgentReceiver,  256, 3, TRUE)
    OsProcDesc(MstrAgent,	    256, 5, TRUE)
    OsProcDesc(TpProcess,	    512, 4, TRUE)
    OsProcDesc(LogProcess,	    256, 8, TRUE)
    OsProcDesc(TerminationProcess, 356, 9,  TRUE)
) FI

; Storage Processor (SMD  tape)

If (fDP) Then (
    OsProcDesc(KbdProcess,	    512, 3, TRUE)
    OsProcDesc(MassIo,		    256, 4, FALSE)
    OsProcDesc(LclFsFilterProcess,	    128, 4, TRUE)
    OsProcDesc(FileSystem,	    512, 5, TRUE)
    OsProcDesc(LogProcess,	    256, 6, TRUE)
    OsProcDesc(TerminationProcess, 356, 7,  TRUE)
) FI

; Storage Processor (tape only)

If (fSP) Then (
    OsProcDesc(KbdProcess,	    512, 3, TRUE)
    OsProcDesc(LclFsFilterProcess,	    128, 3, TRUE)
    OsProcDesc(FileSystem,	    512, 4, TRUE)
    OsProcDesc(LogProcess,	    256, 5, TRUE)
    OsProcDesc(TerminationProcess, 356, 6,  TRUE)
) FI

) ELSE (' Workstations

IF(wsType EQ iwsStandAlone) THEN (
IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 1,  1)
)ELSE(
    OsProcDesc(KbdProcess,         512, 1,  1)
)FI
    OsProcDesc(MassIo,             256, 2,  0)
    OsProcDesc(FileSystem,         500, 3,  1)
    OsProcDesc(SysInPro,           256, 4,  1)
    OsProcDesc(TerminationProcess, 256, 6,  1)
IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 5,  1)
)FI
)FI
;
; Cluster workstation:
;
IF(wsType EQ iwsCluster) THEN (
IF (localFS EQ 0) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,	    512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(WsAgent,            150, 1,  1)
    OsProcDesc(FileSystem,         500, 3,  1)
    OsProcDesc(SysInPro,           256, 4,  1)
    OsProcDesc(TerminationProcess, 256, 6,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 5,  1)
 )FI
)FI

IF (localFS NE 0) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(WsAgent,            150, 1,  1)
    OsProcDesc(MassIo,             256, 3,  0)
    OsProcDesc(LclFsFilterProcess, 256, 4,  1)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 8,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 7,  1)
 )FI
)FI
)FI
;
; Master workstation (minicluster):
;
IF(wsType EQ iwsMiniMaster) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 3,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 3,  1)
 )FI
    OsProcDesc(MstrAgent,          256, 1,  1)
    OsProcDesc(MstrAgentReceiver,  256, 2,  1)
    OsProcDesc(MassIo,             256, 4,  0)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 8,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 7,  1)
 )FI
)FI
;
; Master workstation (full cluster):
;
IF(wsType EQ iwsIopMaster) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(SrpAgent,           256, 1,  1)
    OsProcDesc(MassIo,             256, 3,  0)
    OsProcDesc(FileSystem,         500, 4,  1)
    OsProcDesc(SysInPro,           256, 5,  1)
    OsProcDesc(TerminationProcess, 256, 7,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 6,  1)
 )FI
)FI
;
; Application workstation
;
IF(wsType EQ aws210) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(WsAgent,            150, 1,  1)
    OsProcDesc(FileSystem,         500, 3,  1)
    OsProcDesc(SysInPro,           256, 4,  1)
    OsProcDesc(TerminationProcess, 256, 6,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 5,  1)
 )FI
)FI
;
; AWS 220230240
;
IF(wsType EQ aws220_240) THEN (
IF(localFS EQ 0) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 1,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 1,  1)
 )FI
    OsProcDesc(MassIo,             256, 2,  0)
    OsProcDesc(FileSystem,         500, 3,  1)
    OsProcDesc(SysInPro,           256, 4,  1)
    OsProcDesc(TerminationProcess, 256, 6,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 5,  1)
 )FI
)FI

IF(localFS NE 0) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(WsAgent,            150, 1,  1)
    OsProcDesc(MassIo,             256, 3,  0)
    OsProcDesc(LclfsFilterProcess, 256, 4,  1)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 8,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 7,  1)
 )FI
)FI
)FI
;
; Lowcost Master workstation (AWS4):
;
IF(wsType EQ awsMaster) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 3,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 3,  1)
 )FI
    OsProcDesc(MstrAgent,          256, 1,  1)
    OsProcDesc(MstrAgentReceiver,  256, 2,  1)
    OsProcDesc(MassIo,             256, 4,  0)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 8,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 7,  1)
 )FI
)FI
;
; nGen workstation
;
IF(wsType EQ ngenCluster) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(WsAgent,            150, 1,  1)
    OsProcDesc(FileSystem,         500, 3,  1)
    OsProcDesc(SysInPro,           256, 4,  1)
    OsProcDesc(TerminationProcess, 256, 6,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 5,  1)
 )FI
)FI
;
; NGEN standalone workstation
;
IF(wsType EQ ngen) THEN (
  IF(localFS EQ 0) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 1,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 1,  1)
 )FI
    OsProcDesc(MassIo,             256, 2,  0)
    OsProcDesc(FileSystem,         500, 3,  1)
    OsProcDesc(SysInPro,           256, 4,  1)
    OsProcDesc(TerminationProcess, 256, 6,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 5,  1)
 )FI
  )FI

  IF(localFS NE 0) THEN (
 IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 2,  1)
 )ELSE(
    OsProcDesc(KbdProcess,         512, 2,  1)
 )FI
    OsProcDesc(WsAgent,            150, 1,  1)
    OsProcDesc(MassIo,             256, 3,  0)
    OsProcDesc(LclfsFilterProcess, 256, 4,  1)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 8,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 7,  1)
 )FI
)FI
)FI
;
; NGen Master workstation :
;
IF(wsType EQ NGenMaster) THEN (
IF (fMulpar) THEN (
    OsProcDesc(InitKbdProcess,     512, 3,  1)
    OsProcDesc(MstrAgentReceiver,  500, 1,  1)
    OsProcDesc(MstrAgent,          500, 2,  1)
    OsProcDesc(MassIo,             256, 4,  0)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 8,  1)
 IF (fVarPar) THEN (
    OsProcDesc(Sched,				400, 7,  1)
 )FI
)ELSE(
    OsProcDesc(KbdProcess,         512, 3,  1)
    OsProcDesc(MstrAgent,          500, 1,  1)
    OsProcDesc(MstrAgentReceiver,  500, 2,  1)
    OsProcDesc(MassIo,             256, 4,  0)
    OsProcDesc(FileSystem,         500, 5,  1)
    OsProcDesc(SysInPro,           256, 6,  1)
    OsProcDesc(TerminationProcess, 256, 7,  1)
)FI
)FI
)FI' Workstation
EVEN
;
; The following macros are used to reserve communication
; channels for use by the resident communication interrupt
; handlers.  There are two communication channels in the
; system  Channel A and Channel B.  In cluster configuration
; Channel A is reserved by the CTOS.
;
; Macro definition:
;
;	SysCommInt(iLine, pTxIsr, pExtIsr, pRxIsr, pSpRxIsr)
;
;	where 	iLine  0 means Channel A, 1 means Channel B
;		pTxIsr, pExtIsr, pRxIsr, pSpRxIsr are the entry
;		points of the communication interrupt handlers.
;		(0 means default communication interrupt
;		handler)
;

IF(wsType EQ iwsCluster OR wsType EQ iwsMiniMaster) THEN (
    SysCommInt(0,0,0,0,0)	; Reserve Channel A for cluster
)FI
EVEN
;
; CTOS INITIALIZATION 
; The following macros generate three tables of pointers which
; are used by CTOS during its initializaion phase. All of the
; routines pointed to in these tables reside in modules which
; are linked near the end of CTOS, and the code for these
; modules is discarded after initialization is complete. These
; routines should have their code segments named coed, and
; should use data for the name of their data segments. This
; is to insure that the Linker will place the code and data at
; the end of the run file, after the ResidentDataBoundry
; mentioned earlier in this file. The routines should obey the
; Convergent programming conventions related to register usage
; (refer to The Assembly Language Manual). The routines are
; executed at one of three times during CTOS initialization:
;
;   InitProcHardware ..... After CTOS is booted, and after
;			memory and bus timeout tests are
;			completed. This is the place to put
;			hardware test and verification
;			routines.
;   InitProcIntDisable .... After CTOS structures hav been
;			initialized but before any processes
;			have been started. This is the place to
;			put hardware intitialization routines.
;   InitProcIntEnable .... After interrupts are enabled these
;			routines are executed as if they were a
;			user program. (CTOS processes are
;			running). This is the place to put user
;			process initialization routines. The
;			routines are called in the order given,
;			with no arguments, as subroutines using
;			the Assembly Language indirect far call
;			instruction.
;
; DESCRIPTION OF CONVERGENT ROUTINES 
; Workstation:
;	SysgenInit .... Set variables according to rgSysgen structure
;	InitVideo ..... make sure video hardware works
;	KbdTest ....... see if kbd hardware works
;	RqExInit ...... Map virtual exchanges
;	FsIn1 ......... File system initialization
;	Init8255 ...... LED port
;	InitRtc ....... RTC initialization
;	InitSysCom .... System common area initialization
;	Init8237 ...... DMA Initialization
;	Init8251 ...... 8251A Initialization
;	KbdInit ....... Keyboard initialization
;	InitCounter ... 8253 counter 0 initialization
;	Init8259 ...... 8259A Initialization
;	CheckDisks .... Look for hard disk
;	FsIn2 ......... File system initialization routine
;	DumpAndMTest .. Dump  memory test above 128K
;	InitDebugNub .. Debugger initialization routine
;	LoadFileInit .. Loads boottime configuration file(s)
;	WsInit ........ Cluster WS Agent Initialization
;	InitMstr ...... Master WS Cluster Initialization
;	IopInit ....... Master WS Cluster Initialization
;	IopStart ...... Master WS Cluster Initialization
;
; Megaframe:
;	CommIntInit ... Comm software initialization            
;	FsIn1 ......... File system initialization (*)          
;	FsIn2 ......... File system initialization routine      
;	Init51 ........ 8251A Initialization                    
;	Init59 ........ 8259A Initialization                    
;	InitDebugNub .. Debugger initialization routine         
;	InitRtc ....... RTC initialization                      
;	InitPIT ....... PIT initialization			
;	InitSysCom .... System common area initialization       
;	MemoryInit .... Had any amnesia in your family?		
;	XBufInit ...... CP Cluster XBuf Initialization          
;                                                               
; (*) FsIn1 must be included in all boards' initialization as   
;     it is responsible for Ucb initialization                  
;

IF (fMFHardware) THEN (
InitProcHardWare(MemoryInit)
InitProcHardWare(ClockTest)


InitProcIntDisable(RqExInit)
InitProcIntDisable(IccInit)
InitProcIntDisable(FsIn1)
InitProcIntDisable(InitSysCom)
InitProcIntDisable(InitRtc)
InitProcIntDisable(InitPIT)
InitProcIntDisable(StartRTC)
InitProcIntDisable(Init51)

If (fDebugger NE 0) Then (
    InitProcIntEnable(InitDebugNub)
) Fi
InitProcIntEnable(SysDeviceInit)
If ((fFP) OR (fDP)) Then (
	InitProcIntEnable(FsIn2)
)FI                       
InitProcIntEnable(LoadFileInit)
InitProcIntEnable(InitNlsTables)


) ELSE (' Workstation

' For all workstation types 
	InitProcHardWare(SysgenInit)

IF (wsType EQ iwsStandAlone) THEN(
	InitProcHardWare(MemoryInit)
	InitProcHardWare(FindGraphicsBoard)
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(Init8255)
	InitProcIntDisable(InitRtc)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(Init8237)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(InitCounter)
	InitProcIntDisable(Init8259)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI
IF (wsType EQ iwsCluster) THEN(
	IF (localFS EQ 0) THEN (
	InitProcHardWare(MemoryInit)
	InitProcHardWare(FindGraphicsBoard)
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(RqExInit)
	IF (fMulpar NE 0) THEN (InitProcIntDisable(FsIn1)) FI
	InitProcIntDisable(Init8255)
	InitProcIntDisable(InitRtc)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(Init8237)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(InitCounter)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(WsInit)

	InitProcIntEnable(WsInit1)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
	)FI
	IF (localFS NE 0) THEN (
	InitProcHardWare(MemoryInit)
	InitProcHardWare(FindGraphicsBoard)
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(Init8255)
	InitProcIntDisable(InitRtc)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(Init8237)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(InitCounter)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(CheckForCommBoot)
	InitProcIntDisable(WsInit)

	InitProcIntEnable(WsInit1)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
	)FI
)FI
IF (wsType EQ iwsMiniMaster) THEN(
	InitProcHardWare(MemoryInit)
	InitProcHardWare(FindGraphicsBoard)
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(Init8255)
	InitProcIntDisable(InitRtc)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(Init8237)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(InitCounter)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(CheckDisks)

	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitMstr)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI
IF (wsType EQ iwsIopMaster) THEN(
	InitProcHardWare(MemoryInit)
	InitProcHardWare(FindGraphicsBoard)
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(Init8255)
	InitProcIntDisable(InitRtc)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(Init8237)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(InitCounter)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(CheckDisks)

	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(IopStart)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI
IF (wsType EQ aws210) THEN (
	InitProcIntDisable(Init8259)
	InitProcIntDisable(KbdTest)
	InitProcIntDisable(TimerTest)
	InitProcIntDisable(Init8274)
	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(InitSyscom)
	InitProcIntDisable(InitRtc)
	InitProcIntDisable(WsInit)

	InitProcIntEnable(WsInit1)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI

IF (wsType EQ aws220_240) THEN (
	InitProcIntDisable(Init8259)
	InitProcIntDisable(KbdTest)
	InitProcIntDisable(TimerTest)
	InitProcIntDisable(Init8274)
	InitProcIntDisable(InitComm2)
	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(InitSyscom)
	InitProcIntDisable(InitRtc)
   IF (localFS NE 0) THEN (
	   InitProcIntDisable(WsInit)
		InitProcIntEnable(WsInit1)
   )FI
	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI

IF (wsType EQ awsMaster) THEN (
	InitProcIntDisable(Init8259)
	InitProcIntDisable(KbdTest)
	InitProcIntDisable(TimerTest)
	InitProcIntDisable(Init8274)
	InitProcIntDisable(InitComm2)
	InitProcIntDisable(RqExInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(InitSyscom)
	InitProcIntDisable(InitRtc)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
	InitProcIntEnable(InitVam)
    InitProcIntEnable(InitMstr)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI

IF (wsType EQ ngenCluster) THEN(
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(InitRtc)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(InitMode3DmaCount)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(InitComm2)
	InitProcIntDisable(RqExInit)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(WsInit)
	InitProcIntEnable(WsInit1)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(SysDeviceInit)
    InitProcIntEnable(InitConfig)

	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI
IF (wsType EQ ngen) THEN(
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(InitMode3DmaCount)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(InitComm2)
	InitProcIntDisable(RqExInit)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(InitRtc)
	IF (localFS NE 0) THEN (
		InitProcIntDisable(WsInit)
		InitProcIntEnable(WsInit1)
	)FI

	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
    InitProcIntEnable(InitConfig)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI

IF (wsType EQ NGenMaster) THEN (
	InitProcHardWare(InitVideo)
	InitProcHardWare(KbdTest)
	InitProcHardWare(ClockTest)

	InitProcIntDisable(InitMode3DmaCount)
	InitProcIntDisable(Init8251)
	InitProcIntDisable(Init8259)
	InitProcIntDisable(InitComm2)
	InitProcIntDisable(RqExInit)
	InitProcIntDisable(KbdInit)
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(InitSyscom)
	InitProcIntDisable(InitRtc)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(SysDeviceInit)
    InitProcIntEnable(InitConfig)
    InitProcIntEnable(InitMstr)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar NE 0) THEN ( InitProcIntEnable(InitVpSwapFile) )FI
)FI
'	Common to all workstation OSs
	InitProcIntEnable(InitLoadProc)
)FI' Workstation

' Common to all OSs
	InitProcIntEnable(InitStatus)


;
;
; InitFileSpec 
;	This macro defines the name of a file which CTOS Chains
; to after completion of the initialization routines.  If there
; is any error in this Chain operation, then WS CTOS Exits to
; ExitRunFileSpec.  The second argument  of the macro is the
; password that CTOS needs to Chain to the file.  This is
; normally null ().
;
;

IF(*isdef(InitFile)) THEN (
    InitFileSpec(InitFile,,128)
    )
ELSE (
	IF (fMFHardware) THEN (
    	InitFileSpec([Sys]<Sys>CLI.Run,,128)
	) ELSE (
    	InitFileSpec([Sys]<Sys>SysInit.Run,,128)
	)FI
)FI


;
;	Native Langauge Support Table File
;	This macro defines the name of the file to be loaded at
;	initialization which contains national tables and strings.
;

IF(*isdef(NlsFile)) THEN (
    NlsFileSpec(NlsFile,)
    )
ELSE (
    NlsFileSpec([Sys]<Sys>Nls.sys,)
    )FI

;
;  Configuration Initialization File                            
;      This macro defines the name of a file which CTOS uses    
;  to determine the initial hardware configuration.	          
;
                                                                 
IF(fMFHardware)THEN(
If (*Isdef(ConfigInitFile)) Then (
    CnfgInitFile(ConfigInitFile)
) Else (
    CnfgInitFile([Sys]<Sys>Master.CNF)
) Fi
)FI
;
; Configuration File 
;	This macro defines the name of the configuration file.
;	Currently, the configuration file is only used by NGen. Valid
;	entries are:
;	:XBufWindowSize:nnnKB (nnn = 0, 96, 224, or 480)
;	:ClusterLineSpeed:nnnbps (nnn = 1.8M or 307K)
;

IF(*isdef(ConfigFile)) THEN (
    ConfigurationFile(ConfigFile,,128)
    )
ELSE (
    ConfigurationFile([Sys]<Sys>Config.sys,,128)
    )FI

IF(*isdef(WsConfigFile)) THEN (
    WsConfigurationFile(WsConfigFile)
    )
ELSE (
    WsConfigurationFile([Sys]<Sys>Ws>Config.sys)
    )FI

;
; Software Bus File Specs
;

IF(*isdef(InstallVdmFile)) THEN (
    InstallVdmSpec(InstallVdmFile,)
    )
ELSE (
    InstallVdmSpec([Sys]<Sys>InstallVdm.run,)
    )FI

IF(*isdef(InstallKbdFile)) THEN (
    InstallKbdSpec(InstallKbdFile,)
    )
ELSE (
    InstallKbdSpec([Sys]<Sys>InstallKbd.run,)
    )FI

IF(*isdef(InstallMathFile)) THEN (
    InstallMathSpec(InstallMathFile,)
    )
ELSE (
    InstallMathSpec([Sys]<Sys>MathServer.run,)
    )FI


;
; DEVICE DECLARATIONS  A disk may be of two types, a floppy
; disk or a hard disk.  A MegaFrame disk may only be an SMD
; disk or a  hard disk.  Note that Convergent ByteStreams
; supports [nul], [kbd], and [vid], etc. as devices,
; but these are in reality access method constructs and not
; CTOS devices.
;
; DISKS  A disk device is declared for each disk which is
; configured with the hardware.  Each disk has a unit number
; (consecutive starting with 0 for each type of disk), a retry
; count (number of attempts to recover from IO errors), a flag
; which is non zero for hard disk devices, a device name and a
; device password:
;
;   dcbDisk(unitNumber,retryCount,fHardDisk,name, password)
;
; NOTE  names and passwords are contained in ''s
;	 names of devices must be unique
;	 maximum of 12 characters in names or passwords
;	 maximum of 5 (IWS) or 2 (AWS) devices are allowed.
;	 AWS240 floppy and winchester devices are both look
;	  like winchesters to CTOS, with floppy (f0) being unit
;	  0 and winchester (d0) being unit 1.
;

IF (fMFHardware) THEN (
If (fFP) then (
	IF (*isdef(nWinch)  EQ 0) THEN (
		Set(nWinch,0)
	) FI
	IF (nWinch GE 1) THEN (dcbDisk(0, 12, 1, d0, d0))FI
	IF (nWinch GE 2) THEN (dcbDisk(1, 12, 1, d1, d1))FI
	IF (nWinch GE 3) THEN (dcbDisk(2, 12, 1, d2, d2))FI
	If (nWinch GE 4) Then (dcbDisk(3, 12, 1, d3, d3))FI
) FI   

If (fDP) then (
	IF (*isdef(nWinch)  EQ 0) THEN (
		Set(nWinch,0)
	) FI
	IF (nWinch GE 1) THEN (dcbDisk(0, 12, 1, s0, s0))FI
	IF (nWinch GE 2) THEN (dcbDisk(1, 12, 1, s1, s1))FI
	IF (nWinch GE 3) THEN (dcbDisk(2, 12, 1, s2, s2))FI
	If (nWinch GE 4) Then (dcbDisk(3, 12, 1, s3, s3))FI
	If (nWinch GE 5) Then (dcbDisk(4, 12, 1, s4, s4))FI
	If (nWinch GE 6) Then (dcbDisk(5, 12, 1, s5, s5))FI
) FI   

) ELSE (' Workstation
IF (nFloppy GE 1) THEN (Floppy(f0,)) FI
IF (nFloppy GE 2) THEN (Floppy(f1,)) FI
IF (nFloppy GE 3) THEN (Floppy(f2,)) FI
IF (nFloppy GE 4) THEN (Floppy(f3,)) FI
IF (nWinch GE 1) THEN  (HDisk(d0,d0)) FI
IF (nWinch GE 2) THEN  (HDisk(d1,d1)) FI
IF (nWinch GE 3) THEN  (HDisk(d2,d2)) FI
IF (nWinch GE 4) THEN  (HDisk(d3,d3)) FI
IF (nWinch GE 5) THEN  (HDisk(d4,d4)) FI
IF (nWinch GE 6) THEN  (HDisk(d5,d5)) FI
IF (nWinch GE 7) THEN  (HDisk(d6,d6)) FI
IF (nWinch GE 8) THEN  (HDisk(d7,d7)) FI
)FI'

EVEN
;
; FINAL 
;    This macro does error checking, and fills in various
; counts in the tables generated by the above macros calls.
;
;
Final
END

;	Native Langauge Support Table File
;	This macro defines the name of the file to be loaded at
;	initialization which contains national tables and strings.
;

IF(*isdef(NlsFile)) THEN (
    NlsFileSpec(NlsFile,)
    )
ELSE (
    NlsFileSpec([Sys]<Sys>N