;
; FILE SYSGEN.ASM 
;
; COPYRIGHT (C) 1980, 1989 CONVERGENT INCORPORATED. ALL RIGHTS RESERVED.
; COPYRIGHT (C) 1980, 1989 UNISYS CORPORATION. ALL RIGHTS RESERVED.
;
; THIS SOFTWARE IS PROPRIETARY TO CONVERGENT INC. AND UNISYS CORP. AND IS NOT TO
; BE REPRODUCED, USED OR DISCLOSED EXCEPT IN ACCORDANCE WITH PROGRAM LICENSE OR
; UPON WRITTEN AUTHORIZATION OF THE PATENT DIVISION OF UNISYS CORPORATION.
;
; THIS PROGRAM IS FURNISHED UNDER A LICENSE RESTRICTING ITS USE SOLELY FOR THE
; OPERATION OF A DESIGNATED COMPUTER FOR A PARTICULAR PURPOSE.  TITLE TO AND
; OWNERSHIP OF THE PROGRAM, INCLUDING ITS SOURCE CODE, SHALL AT ALL TIMES REMAIN
; IN THE NAMES OF UNISYS CORPORATION AND CONVERGENT INCORPORATED.
;
;
; 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.
;
; CONFIGURATION 
; This module uses several macro symbols to determine the configuration of 
; the CTOS being built.  The prefix files pMstr.asm, pClstrLfs.asm,
; pStnd.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.
;
; DEBUGGER OPTIONS 
; To simplify removal of optional debugger, the flag fDebugger is used.
; This is set to TRUE (1) unless one of the above prefix files files 
; (pMstr.asm, pClstrLfs.asm, ...) sets it explicitly.  To remove the
; debugger, set the flag to FALSE (0) and assemble  that module.
;  NOTE that you must also change the appropriate XXX.fls or XXX.link file
; as described in the Building a Customized CTOS section of the System  
; Administrator's Guide or Release Notice.
;
; 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 preceeding 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 pClstrLfs.asm or 
; pMstr.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.  IWS only.
;
;  fDebugger .......... 0: Exclude debugger
;                       1: Include debugger
;
;  fHDisks ............ 0: No hard disks
;                       1: Include hard disks
;
;  ctosp .............. 0: real mode Vp (CTOS II)
;                       1: protected Vp (CTOS VM)
;
;  fMulpar ............ 0: Singlepartition OS. Obsolete.
;                       1: Multipartition OS.  Always set true.
;
;  fVarpar ............ 0: Multipartition OS. Obsolete.
;                       1: Variablepartition OS.  Always set true.
;
; Compilation flags and system build parameters.
;
; Many of these parameters control the allocation of structures when the OS is
; initialized.  The memory comes from a buffer in the data segment.  The OS is
; shipped with this dynamic area set to its maximum possible size.  If it were
; any larger then the data segment would exceed 64K and the OS wouldn't link. 
; If too many structures are allocated then the OS will crash with an ERC 101
; at boot.  The only recourse is to reduce the number of structures allocated.
; This is done by reducing the counts in SET macros listed below.
;
; The Set macros placed in the prefix file such as pClstrLfs.asm or
; pClstr.asm are defined as follows:
;
;       sOsData ............ Reserves an empty buffer in the OS data segment
;                            DGroup.  The OS uses this space for data
;                            structures such as exchanges which are allocated
;                            according to parameters set in the prefix file.
;                            Do not make this any larger.
;
;       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.
;                            Convergent software needs 8.
;
;       nUsrExchange ....... User Exchanges (maximum 200).  Each
;                            adds 10 bytes.
;
;       nPcb ............... Number of processes (CTOS and user
;                            combined).  The largest standard
;                            OS has 8, character mapped video has 1,
;                            and the Executive has 2, making a minimum of
;                            11.  Each adds 40 bytes.
;
;       fTimeSlice ......... 0: disable runqueue rotation.
;                            1: enable runqueue rotation.
;                            When enabled, pcbs in a certain
;                            priority range on the run queue
;                            are relinked behind other pcbs of
;                            the same priority ten times per
;                            second.
;
;       lbTimeSlicePriority  when fTimeSlice is 1, sets low bound
;                            priority of pcbs to rotate.
;
;       hbTimeSlicePriority  when fTimeSlice is 1, sets high bound
;                            priority of pcbs to rotate.
;
;       nMsgWait ........... Total number of message link
;                            blocks.  Each adds 6 bytes to CTOS.
;
;       nPTiming ........... Total number of simultaneous real
;                            time clock service requests.  CTOS
;                            requires at least 16 to run all
;                            Convergent programs.  Each adds 6
;                            bytes.
;
;       nPartitions ........ Number of user numbers max.  Changing
;                            this number causes some defaults to
;                            also be changed.  See the prefix file.
;
;       nUcb ............... Number of user control blocks.  Each
;                            is 95 bytes.  Set to nPartitions always.
;
;       sParExitRunFile .... The minimum size in paragraphs (16 bytes)
;                            that the primary partition will shrink
;                            to due to CreatePartition and ConvertToSys
;                            requests.
;
;       cParScHeap ......... The size in paragraphs of the installable
;                            system common subroutine heap.  Each
;                            installed routine requires at least 8 bytes.
;
;       nGDTSlots .......... Number of slots in the Global Descriptor Table.
;                            Each slot takes 14 bytes.  This table is
;                            allocated out of high memory, not OS DGroup.
;
;       nSwapFabs .......... Number of Swap File Area Blocks needed for
;                            swap file management.  These are not the same
;                            blocks as set by nFab.  Each takes 6 bytes.
;
;       SwapFile ........... Name of the default preferred swap file.
;                            This is normally [sys]<sys>Crashdump.sys.
;
;
; The Set macros for Cluster Agent configuration are defined as follows:
;
;       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.
;
;       nXBlock ............ Number of transmission blocks.
;                            Each is 512 bytes times the number
;                            nSectorPerXBlk (see below).
;                            On a master workstation this is a
;                            function of the number of cluster
;                            workstations (see nUcb above).
;
;       nSectorPerXBlk ..... Number of sectors in each
;                            transmission block (see nXBlk
;                            above).
;
;       maxXBlocksPerUser... The maximum number of Xblocks any single user
;                            can have outstanding at one time.
;
;       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.  IWS only.
;
;       nIops .............. Number of IOP's.  IWS only.
;
;       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.  IWS only.
;
;       nWsLine4 ........... Maximum number of workstations
;                            which may be attached to channel 2
;                            of IOP 2.  IWS only.
;
;       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 (nPartition) plus one for each possible 
;                            cluster user.
;
;       nRcb ............... The number of Request Control Blocks.
;                            Rcbs are used by cluster workstations to
;                            record the existence of outstanding requests
;                            to the master workstation.
;                            Each Rcb adds 24 bytes.
;
;
; The Set macros for SRP configuration are defined as follows:
;
;       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 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. Obsolete.
;
;       lineHz ............. This is the AC line frequency,
;                            used by the real time clock (50Hz
;                            or 60Hz).  Obsolete.
;
;       nSysExchange ....... Exchanges reserved for CTOS.
;                            Obsolete.
;
;       nMsgWaitReserve .... Number of message link blocks
;                            reserved for CTOS pSend primative.
;                            Obsolete.
;
;
;  File system build parameters.  These Set macros take effect only if
;  set in a file system prefix file:
;
;       fVerifyFileStruct .. If this is non zero then CTOS will
;                            verify file structures after
;                            writing to disk.  Adds 512 bytes.
;                            Halves file system performance.
;                        (ALSO MODIFIABLE IN [sys]<sys>Config.sys) 
;
;       cDiskLogThreshold .. Indicates how many disk retry operations
;                            are to be attempted before logging
;                            the disk error.  Only applies to errors
;                            that are subject to retries.  This value
;                            can be greater than the total number of
;                            retries done, thereby inhibiting log entries.
;                        (ALSO MODIFIABLE IN [sys]<sys>Config.sys) 
;
;       nIob ............... Total number of simultaneous disk
;                            IO requests allowed.  CTOS
;                            requires at least as many as disk
;                            devices in the system 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.
;
;       nFcb ............... Total number of open files allowed
;                            in the system.  Each adds 28
;                            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).
;
;       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).
;
;
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 (

; Note: odd classes are floppy types, even classes are hard disks.
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
MassioDisp(StartFloppy)    ; Device class 5  Dummy
MassioDisp(StartSCSIDisk)  ; Device class 6  SCSI StartIO routine

)FI)FI
;
; Encryption Key value
;  Used by the file system to encrypt all passwords on disk.
;  If changed, encryptionprotected disks will be incompatible with
;  disks created by previous file systems.
;
;  The encryption process is loosely based on the RSA publickey method.
;  This number cannot be replaced by an arbitrary byte string.  
;  The key is part of a function that takes an unencoded password
;  string as input and procuces an encrypted password as output.
;  Usergenerated keys should exceed 80 bytes (200 digits) and be, if not
;  prime, then have only a few factors.  The more factors, the more
;  plain text strings will encrypt into the same encoded string.
;
;  Password encryption is on a pervolume basis.  The user chooses the
;  option at ivolume time.  Care in remembering passwords must be exercised,
;  as it is impossible to determine the plain text string when only the
;  encrypted string and the key are known.

;

DefineEncryptionKey(( 7C8Dh, 1813h, 9F31h, 4BB9h,0E569h, 29F1h, 1B89h,0AD7Bh, 973Fh, 101Bh, 54FCh,0C922h, 5C63h, 9C97h, 840Ah, 06F0h, 612Dh,0DFCAh,0D3F7h, 335Bh,0D421h,0CD61h, 324Fh,0E40Eh, 0B0Bh, 6CE9h, 80D3h, 90BAh, 74A9h, 10E2h, 8C96h, 9CA6h,0C506h, 568Ah,0AD6Ah, 23BBh, 26A2h,0C0F9h,0A2CFh,0F383h, 0B05h, 1A7Eh,0C31Ah,0C9ACh, 8F67h, 4D69h, 083Dh, 44EEh ))

;
; 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.
;
; In real mode, sysgen defines interrupt handlers as either
; 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 responsibility 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.
;
; In protected mode, sysgen defines interrupt handlers as either
; software or hardware.
;
; SOFTWARE INTERRUPTS  A software interrupt occurs in response to
; a software generated event, such as an INT instruction or a
; program exeception, such as a general protection fault.  IDT entries
; for software interrupts contain task gates, hence, a software
; interrupt causes a task switch.  The interrupt handler need not save
; registers since a task switch occurred.  The interrupt handler may
; return to the interrupt task using IRET or may return to the
; kernel dispatcher using RET, behaving as a mediated interrupt.
;
; HARDWARE INTERRUPTS  A hardware interrupt occurs in response to
; a external hardware interrupt.   IDT entries for hardware interrupts
; contain interrupt gates.  The CS:IP in the interrupt gate passes control
; to code that immediately calls an interrupt task, hence, a task switch
; occurs.  This two level vector is required to force the processor to
; unlock the memory bus during the time period beginning at the start of
; the interrupt acknowledge cycle and ending with the task switch.  Freeing
; the memory bus is necessary for high performance RS422 cluster operation.
; The interrupt handler need not save registers since a task switch occurred.
; The interrupt handler may return to the interrupt task using IRET or may
; return to the kernel dispatcher using RE, behaving as a mediated interrupt.
; In this case, the kernel handles EOI programming.
;
;
; 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)
;
; REAL MODE INTERRUPT DECLARATIONS
;
; 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)
;
;
; PROTECTED MODE INTERRUPT DECLARATIONS
;
; SOFTWARE INTERRUPT DECLARATION  To declare a software interrupt
; handler use the macro SoftwareInterrupt with two arguments, the
; interrupt level, and the name of the public procedure
; which will handle the interrupt.
;
;	SoftwareInterrupt(level,pHandler,sStack,fMediated)
;
;
; HARDWARE INTERUPT DECLARATION  To declare a hardware
; interrupt handler, use the macro HardwareInterrupt with
; two arguments, the interrupt level and the name of the interrupt handler.
;
;	HardwareInterrupt(level,pHandler,sStack,fMediated)
;
;
; 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(ctosp)then(
; SKULL AND CROSSBONES
;
; EXTREME CAUTION IN CHANGING THE ORDER OF SOFTWARE INTERRUPTS
;
; All interrupt tasks that are entered with an error code must be
; defined BEFORE other interrupt tasks.  The last such task must be the
; GP fault handler.
;
; The kernel identifies interrupt tasks that are entered with an error
; code using the predicate sgTss <= sgTssGpFault.
; 
; ** NOTE **
; The parameter sStack (stack size in bytes) should be OR'd with 8000h to
; signal the operating system to place the stack for this interrupt 
; handler in low memory.  This is so real mode programs can use this interrupt
; level.

; Interrupt tasks entered WITH an error code.

SoftwareInterrupt(8, DoubleTaskFault, 160, 0)
SoftwareInterrupt(12, StackTaskFault, 160, 0)
SoftwareInterrupt(14, PageTaskFault, 160, 0)

; GP fault handler must be last
SoftwareInterrupt(13, GPTaskFault, 160, 0)

; Interrupt tasks entered WITHOUT an error code.

SoftwareInterrupt(1, TraceRawInt, 128, 0)		; Convergent debugger
SoftwareInterrupt(2, NmiTaskFault, 160, 0)	; Nonmaskable interrupt(parity)
SoftwareInterrupt(3, BreakRawInt, 128, 0)		; Convergent debugger
SoftwareInterrupt(9, CoprocessorOverrun, 128, 0)
SoftwareInterrupt(16, CoprocessorError, 128, 0)
SoftwareInterrupt(75, CoprocessorNotPresentInt, 128, 0FFh)

IF (wsType EQ ngenCluster) THEN (
HardwareInterrupt(68, SigIsr, 128, 0)		; Cluster comm interrupts
)FI

IF (wsType EQ ngen) THEN (
IF (localFS EQ 1) THEN (
HardwareInterrupt(68, SigIsr, 128, 0)		; Cluster comm interrupts
) FI
HardwareInterrupt(255,FloppyInterrupt, 320, 0FFh); Floppy interrupt 
IF(fHDisks NE 0) THEN (
HardwareInterrupt(67,HardDiskInterrupt, 320, 0FFh)	; hard disk
HardwareInterrupt(84,SCSIDiskInterrupt, 320, 0FFh)	; NEWGEN SCSI disk 
) FI
)FI

IF (wsType EQ ngenMaster) THEN (
HardwareInterrupt(68, SigIsr, 128, 0)		; Cluster comm interrupts
HardwareInterrupt(255,FloppyInterrupt, 320, 0FFh); Floppy interrupt 
IF(fHDisks NE 0) THEN (
HardwareInterrupt(67,HardDiskInterrupt, 320, 0FFh)	; hard disk
HardwareInterrupt(84,SCSIDiskInterrupt, 320, 0FFh)	; NEWGEN SCSI disk 
)FI
)FI

HardwareInterrupt(64,XINTR0, 8000h+128, 0)	; XINTRO
HardwareInterrupt(65,RawCommNub, 8000h+128, 0)	; RS232 comm interrupts
HardwareInterrupt(66,XINTR1, 8000h+128, 0)		; XINTR1
HardwareInterrupt(69,TimerInterrupt, 8000h+256, 0FFh); programmable timer
HardwareInterrupt(70,IntHKbd, 512, 0FFh)	; keyboard
HardwareInterrupt(71,HINTR71, 128, 0FFh)	; Special OEM 
HardwareInterrupt(80, RTCInterrupt, 128, 0)
HardwareInterrupt(81,XINTR3, 128, 0FFh)	; Special OEM 
HardwareInterrupt(82,XINTR4, 128, 0) 		; XINTR4
HardwareInterrupt(83,LpInterrupt, 256, 0FFh); Line printer interrupthandler
HardwareInterrupt(87,HINTR87, 128, 0FFh)	; Special OEM 

; end of ctosp definitions

)else(
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

IF (FS) THEN (' Not used even in FS.  FS does SetIntHandler.
MediatedInterrupt(15,0FFh,FloppyInterrupt)	; Floppy interrupt handler
IF(fHDisks NE 0) THEN (
MediatedInterrupt(67,0FFh,HardDiskInterrupt)	; hard disk
MediatedInterrupt(84,0FFh,SCSIDiskInterrupt)	; SCSI disk 
)FI)FI' FS

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

IF (FS) THEN (' Not used even in FS.  FS does SetIntHandler.
MediatedInterrupt(15,0FFh,FloppyInterrupt)	; Floppy interrupt handler
IF(fHDisks NE 0) THEN (
MediatedInterrupt(67,0FFh,HardDiskInterrupt)	; hard disk
MediatedInterrupt(84,0FFh,SCSIDiskInterrupt)	; SCSI disk 
)FI)FI' FS

MediatedInterrupt(69,0FFh,TimerInterrupt)	; programmable timer
MediatedInterrupt(70,0FFh,IntHKbd)	; keyboard
)FI
)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 (' Not used even in FS.  FS does SetIntHandler.
IF (FS) THEN (
     MediatedInterrupt(12, 0FFh, HardDiskInterrupt)	; mass storage device
)FI' FS
) FI    
)FI' Megaframe


;
; The following list of request codes are those requests for which the
; cluster agent will NOT mark the user as using resources on the master
; and therefore require no termination on the master. Clusters
; which issue to the master only the requests which are in this list will 
; not have termination requests sent to the master.
;
RequestNoRemoteTermination(14)		;GetDateTime
RequestNoRemoteTermination(235)	;CheckForMail
RequestNoRemoteTermination(101Ah)	;RemoteTermination
EndRemoteTermination
;


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(11)	;CTOS File system
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
AssignSysExch(9)	;exchFsPocket
)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 they choose 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		11	12		11
;	exchChgUsrN		10	12		10
;	exchMstrAgent	0	0		12
;	exchResex		11	1011	11
;	exchLog			10	12		10 (or 3 if SRP)
;	exchFilterPros	0	017	0
;	exchMem			11	11		11 (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

IF (fMFHardware) THEN (
SymExchange(exchgResex, 11)		; Utility

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
IF((clusterConfig EQ 1) AND NOT localFS) THEN(' CWS
    SymExchange(exchgResex, 10)' CTOS.LIB sends ResetVideo to exch 10.
) ELSE (
    SymExchange(exchgResex, 11)
)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
    MapExchange(5,exchgFilSys2, exchgMassIO)
    MapExchange(6,exchgFilSys3, exchgLclFs)	; File system manager
    MapExchange(7,exchgFilSys4, exchgResex)	; Utility
    MapExchange(8,exchgChgUsrN, exchgLclFs)	; MultiPart Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, 0)
    MapExchange(10,exchgLog, exchgResex)
    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, 17)	; File system filter sends to agent and local fs
    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)
    MapExchange(11,exchgFilterPros, 17)
)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 manager
    MapExchange(5,exchgFilSys2, exchgMassIO)
    MapExchange(6,exchgFilSys3, exchgLclFs)	; File system manager
    MapExchange(7,exchgFilSys4, exchgResex)	; Utility
    MapExchange(8,exchgChgUsrN, exchgLclFs)	; MultiPart Change User Num Rq for FS
    MapExchange(9,exchgMstrAgent, exchgAgent)
    MapExchange(10,exchgLog,  exchgResex)
    MapExchange(11,exchgFilterPros, 0)
)FI

IF (fVarPar) THEN(
    MapExchange(12,exchgMem, exchSched)
    MapExchange(13,exchgVp, exchSched)
) ELSE (
    MapExchange(12,exchgMem, exchgResex)
    MapExchange(13,exchgVp, 0)
)FI
IF (fKbdRes) THEN(
    MapExchange(14,exchgKbd, exchgKbdRes)
) ELSE (
    MapExchange(14,exchgKbd, 0)
)FI

MapExchange(15,exchgOvly, exchgResex)

IF (clusterConfig EQ 0) THEN(
MapExchange(16,exchRemoteTerm, 0)	;standalone
)ELSE(
IF (clusterConfig EQ 1) THEN(
MapExchange(16,exchRemoteTerm, exchgAgent) ;cluster
)ELSE(
MapExchange(16,exchRemoteTerm, 5)	;master
)FI
)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).
;
IF (FS) THEN (' Only FALSE works for exchange
    OsProcDesc(MassIo,		    256, 3,  FALSE)
IF (fMFHardware) THEN (
    OsProcDesc(LogProcess,	    256, 5,  FALSE)
) FI

) ELSE (' CTOS

IF (fMFHardware) THEN (
OsProcDesc(IccSvr,		    512, 2, 19)
; File Processor
If (fFP) Then (
    OsProcDesc(KbdProcess,	    256, 3,  TRUE)
    OsProcDesc(LclFsFilterProcess,	    128, 3, TRUE)
    OsProcDesc(FileSystem,	    512, 4, 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(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(TerminationProcess, 356, 9,  TRUE)
) FI

; Storage Processor (SMD  tape)

If (fDP) Then (
    OsProcDesc(KbdProcess,	    512, 3, TRUE)
    OsProcDesc(LclFsFilterProcess,	    128, 4, TRUE)
    OsProcDesc(FileSystem,	    512, 5, 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(TerminationProcess, 356, 6,  TRUE)
) FI

) ELSE (' Workstations

;
; Standalone:
;
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(LclfsFilterProcess, 256, 3,  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
)FI' CTOS
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 (FS) THEN (
	InitProcIntDisable(FsIn1)
	InitProcIntDisable(ReleaseFileCode)
	InitProcIntDisable(InitSysCom)
	InitProcIntEnable(InitRtc)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(AddressBootBlock)
	InitProcIntEnable(SysDeviceInit)

) ELSE (' CTOS
IF (fMFHardware) THEN (
InitProcHardWare(MemoryInit)
InitProcHardWare(ClockTest)


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

If (fDebugger NE 0) Then (
    InitProcIntEnable(InitDebugNub)
) Fi
InitProcIntEnable(AddressBootBlock)
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(AddressBootBlock)
	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(AddressBootBlock)
	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(AddressBootBlock)
	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(AddressBootBlock)
	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(AddressBootBlock)
	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(AddressBootBlock)
	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(AddressBootBlock)
	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(AddressBootBlock)
	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(InitUcbs)
	InitProcIntDisable(DAIFromHardware)
	InitProcIntDisable(WsInit)
	InitProcIntEnable(WsInit1)
	InitProcIntEnable(DAIIntoXID)
	InitProcIntEnable(InitVam)
	InitProcIntEnable(AddressBootBlock)
	InitProcIntEnable(SysDeviceInit)
    InitProcIntEnable(InitConfig)

	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar) THEN (
	 InitProcIntEnable(InitVpSwapFile)
	 InitProcIntEnable(InitVpStructures)
	 )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(InitUcbs)
	InitProcIntDisable(InitSysCom)
	InitProcIntDisable(InitRtc)
	IF (localFS NE 0) THEN (
		InitProcIntDisable(DAIFromHardware)
		InitProcIntDisable(WsInit)
		InitProcIntEnable(WsInit1FirstHalf)
	)FI

	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(AddressBootBlock)
	IF (localFS NE 0) THEN (
		InitProcIntEnable(DAIFromDisks)
		InitProcIntEnable(DAIIntoXID)
		InitProcIntEnable(WsInit1SecondHalf)
	)FI
	InitProcIntEnable(SysDeviceInit)
if(ctosp)then(
	InitProcIntEnable(RelocateFsData)
)fi
    InitProcIntEnable(InitConfig)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar) THEN (
	 InitProcIntEnable(InitVpSwapFile)
	 InitProcIntEnable(InitVpStructures)
	 )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(InitUcbs)
	InitProcIntDisable(InitSyscom)
	InitProcIntDisable(InitRtc)

	InitProcIntEnable(InitVam)
	InitProcIntEnable(FsIn2)
	InitProcIntEnable(AddressBootBlock)
	InitProcIntEnable(SysDeviceInit)
if(ctosp)then(
	InitProcIntEnable(RelocateFsData)
)fi
    InitProcIntEnable(InitConfig)
    InitProcIntEnable(InitMstr)
	InitProcIntEnable(InitDebugNub)
	InitProcIntEnable(LoadFileInit)
	InitProcIntEnable(InitNlsTables)
	IF (fVarPar) THEN (
	 InitProcIntEnable(InitVpSwapFile)
	 InitProcIntEnable(InitVpStructures)
	 )FI
)FI
'	Common to all workstation OSs
	InitProcIntEnable(InitLoadProc)
)FI' Workstation

' Common to all OSs
	InitProcIntEnable(InitStatus)

)FI' CTOS
;
;
; 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

IF(*isdef(ExtCrashDumpFile)) THEN (
    ExtCrashDumpSpec(ExtCrashDumpFile,)
    )
ELSE (
    ExtCrashDumpSpec([Sys]<Sys>ExtCrashDump.run,)
    )FI

IF(*isdef(OEM1File)) THEN (
    OEM1Spec(OEM1File,)
    )
ELSE (
    OEM1Spec([Sys]<Sys>OEM1.run,)
    )FI

IF(*isdef(OEM2File)) THEN (
    OEM2Spec(OEM2File,)
    )
ELSE (
    OEM2Spec([Sys]<Sys>OEM2.run,)
    )FI

IF(*isdef(OEM3File)) THEN (
    OEM3Spec(OEM3File,)
    )
ELSE (
    OEM3Spec([Sys]<Sys>OEM3.run,)
    )FI

IF(*isdef(OEM4File)) THEN (
    OEM4Spec(OEM4File,)
    )
ELSE (
    OEM4Spec([Sys]<Sys>OEM4.run,)
    )FI
;
; NGen Module Definition
; Format is  DefineXbusModule(id,size,fRMOS,fMode3Master) where size is in
; kilobytes.
;
; If a module has many ids then list each.
; Size can be 96, 224, 480 or 0(no window).
; Setting fRMOS to TRUE makes the module addressable from real mode programs
;      running under a protected mode OS.
; Setting fMode3Master to TRUE means that the module is a master for mode
; 3 dma. If a mode 3 master is present on the xbus, the loader will only
; load programs above 16 megabytes which have been linked 'HighMemProtected'
; or 'HighMemGdtProtected' (see '[Run file type]' parameter of link form).
;
if(ctosp)then(

DefineXbusModule(47,96,FALSE,FALSE)	' *PC001*
DefineXbusModule(49,0,FALSE,TRUE)	' * QIC tape *
DefineXbusModule(50,0,FALSE,TRUE)	' * phone *
DefineXbusModule(51,0,FALSE,TRUE)	' * phone *
DefineXbusModule(52,0,FALSE,TRUE)	' * ethernet *
DefineXbusModule(53,0,FALSE,TRUE)	' * ethernet *
DefineXbusModule(56,96,TRUE,FALSE)	' * monochrome graphics *
DefineXbusModule(57,96,TRUE,FALSE)	' * color graphics *
DefineXbusModule(60,224,FALSE,FALSE)	' *GC003*
DefineXbusModule(61,224,FALSE,FALSE)	' *GC003*
DefineXbusModule(62,224,FALSE,FALSE)	' *GC003*
DefineXbusModule(63,224,FALSE,FALSE)	' *GC003*
DefineXbusModule(68,96,TRUE,FALSE)	' *GC102*
DefineXbusModule(80,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(81,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(82,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(83,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(84,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(85,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(86,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(87,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(88,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(89,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(90,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(91,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(92,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(93,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(94,96,TRUE,FALSE)	' *GCX04*
DefineXbusModule(95,96,TRUE,FALSE)	' *GCX04*

DefineXbusModule(132,0,FALSE,TRUE)	' * Unisys QIC *
DefineXbusModule(195,0,FALSE,TRUE)	' * Unisys EN3 *
DefineXbusModule(196,0,FALSE,TRUE)	' * Unisys TR2 *
DefineXbusModule(197,0,FALSE,TRUE)	' * Unisys ID2 *
)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
IF (nSCSI GE 1) THEN  (SCSIdevice(z0,z0)) FI
IF (nSCSI GE 2) THEN  (SCSIdevice(z1,z1)) FI
IF (nSCSI GE 3) THEN  (SCSIdevice(z2,z2)) FI
IF (nSCSI GE 4) THEN  (SCSIdevice(z3,z3)) FI
IF (nSCSI GE 5) THEN  (SCSIdevice(z4,z4)) FI
IF (nSCSI GE 6) THEN  (SCSIdevice(z5,z5)) FI
IF (nSCSI GE 7) THEN  (SCSIdevice(z6,z6)) FI
IF (nSCSI GE 8) THEN  (SCSIdevice(z7,z7)) FI
IF (nSCSI GE 9) THEN  (SCSIdevice(z8,z8)) FI
IF (nSCSI GE 10) THEN  (SCSIdevice(z9,z9)) FI
IF (nSCSI GE 11) THEN  (SCSIdevice(z10,z10)) FI
IF (nSCSI GE 12) THEN  (SCSIdevice(z11,z11)) 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

DefineXbusModule(51,0,FALSE,TRUE)	' * phone *
DefineXbusModule(52,0,FALSE,TRUE)	' * ethernet *
DefineXbusModule(53,0,FALSE,TRUE)	' * ethernet *
DefineXbusModule(56,96,TRUE,FALSE)	' * monochrome graphics *
DefineXbusModule(57,96,TRUE,FALSE)	' * color graphics *
DefineXbusModule(60,224,FALSE,FALSE)	' *GC003*
DefineXbusModule(61,224,FALSE,FALSE)	' *GC003*
DefineXbusModule(62,224,FALSE,FALSE)	' *GC003*
DefineXbusMo