Google
 

Trailing-Edge - PDP-10 Archives - tops20v41_monsrc - monitor-sources/stg.mac
There are 95 other files named stg.mac in the archive. Click here to see a list.
; *** Edit 7456 to STG.MAC by GSCOTT on 23-Apr-87, for SPR #19597
; Write session records properly when a job is attached, detached, or its
; session remark is changed. Also make sure session start time is correct. 
; *** Edit 7406 to STG.MAC by RASPUZZI on 29-Dec-86, for SPR #20215
; Don't check for extended addressing if we are a KS because we don't have
; extended addressing. 
; *** Edit 7324 to STG.MAC by RASPUZZI on 17-Jun-86, for SPR #20058
; Fix the SFTAD% JSYS to work as the documentation says it will. Also, make
; sure that TPRCYC and ARRCYC are properly initialized in STG. 
; *** Edit 7259 to STG.MAC by WONG on 14-Mar-86, for SPR #18580
; Add batch info to Usage Session Record.
; *** Edit 7203 to STG.MAC by WAGNER on 21-Nov-85
; Edit 7164 caused undefined symbol DELPGQ. Make global and put in STG. 
; Edit 7171 to STG.MAC by TBOYLE on 22-Oct-85, for SPR #20772
; Put HNGU0F and HNGU1F under global flags. 
; Edit 7151 to STG.MAC by TBOYLE on 12-Sep-85, for SPR #20179
; Save FFL and FPC in JOBCOF. Increase UPDL from 300 to 400. 
;Edit 6711 to STG.MAC by MOSER on Thu 21-Mar-85, for SPR #20519
;		MAKE VK100 WIDTH 84
;EDIT 6711 - VK100 WIDTH IS 84 NOT 80 
;Edit 3147 to STG.MAC by TBOYLE on Fri 10-Aug-84, for SPR #18393
;		HNGU0F, HNGU1F support for DTR drop on LOGOUT.
;Edit 3139 to STG.MAC by LOMARTIRE on Thu 19-Jul-84
;		Increase MAXBLK again to allow more SRV connections.
;;		Adjust NRVAR PSECT limits.
;Edit 3131 to STG.MAC by LOMARTIRE on Wed 27-Jun-84, for SPR #20194
;		Increase DECnet string space (MAXBLK) since edit 2962 did
;Edit 3024 to STG.MAC by MOSER on Fri 7-Oct-83, for SPR #18819
;		PREVENT PITRAP - MAKE RLDFRK RESIDENT
;EDIT 3024 - PREVENT PITRAP MAKE RLDFRK RESIDENT
;EDIT 2954 BY HAUDEL ON JUN 15 83 FOR SPR 18939
;Edit 2941 by MOSER on Thu 7-Apr-83, for SPR #18939
;		ADD COFTIM. TIME TO BE DETACHED AFTER CARRIER OFF B4 LOGOUT
;EDIT 2941 - ADD COFTIM TIME A JOB IS DETACHED BEFORE LOGOUT AFTER COF
; UPD ID= 243, FARK:<4-1-WORKING-SOURCES.MONITOR>STG.MAC.5,  15-Nov-82 09:45:08 by DONAHUE
;Edit 2873 - Increase SNPDC for WATCH
;Edit 2868 - Add copyright notice
; UPD ID= 77, FARK:<4-1-WORKING-SOURCES.MONITOR>STG.MAC.4,   3-May-82 11:55:50 by ZIMA
;Edit 2615 - add MMAPWD for SETSPD to use.
; UPD ID= 62, FARK:<4-1-WORKING-SOURCES.MONITOR>STG.MAC.3,   8-Apr-82 16:21:13 by DONAHUE
;Edit 2009 - Add VK100/VT125 support
; UPD ID= 9, FARK:<4-1-WORKING-SOURCES.MONITOR>STG.MAC.2,  10-Mar-82 17:21:36 by ZIMA
;Edit 2001 - Change LOADMODULEs for MFLIN/MFLOUT for Autopatch consistency.
;<4-1-FIELD-IMAGE.MONITOR>STG.MAC.3, 25-Feb-82 20:47:55, EDIT BY DONAHUE
;UPDATE COPYRIGHT DATE
; UPD ID= 995, FARK:<4-WORKING-SOURCES.MONITOR>STG.MAC.5,  22-Feb-82 09:43:38 by ZIMA
;Edit 1984 - Remove CDUNIT, adjust CDERBF for bytes instead of words.
; UPD ID= 801, FARK:<4-WORKING-SOURCES.MONITOR>STG.MAC.4,  15-Sep-81 14:27:24 by SCHMITT
;Edit 1942 - Include USGMUP
; UPD ID= 334, FARK:<4-WORKING-SOURCES.MONITOR>STG.MAC.3,  15-Dec-80 17:02:10 by DEUFEL
;EDIT 1820 - Add DZSPWD data structure under KS10 conditional.
; UPD ID= 327, FARK:<4-WORKING-SOURCES.MONITOR>STG.MAC.2,  14-Dec-80 00:13:24 by ZIMA
;EDIT 1818 - Remove DMPBUF to recover unused address space.
;<4.MONITOR>STG.MAC.307,  3-Jan-80 08:10:31, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
; UPD ID= 33, SNARK:<4.MONITOR>STG.MAC.306,  28-Nov-79 10:51:17 by MILLER
;TCO 4.2582. ADD FKTIMW
;<4.MONITOR>STG.MAC.305, 20-Nov-79 14:14:18, EDIT BY GRANT
;INCREASE MAXBLK, THE SWAPPABLE FREE SPACE USED BY NSP
;<4.MONITOR>STG.MAC.304, 20-Nov-79 11:30:36, EDIT BY DBELL
;TCO 4.2574 - ADD PI5CNT
;<4.MONITOR>STG.MAC.303, 31-Oct-79 14:34:41, EDIT BY MURPHY
;PTYSTM
;<4.MONITOR>STG.MAC.302, 24-Oct-79 15:53:04, EDIT BY MURPHY
;TSKED, TTOLST
;<4.MONITOR>STG.MAC.301, 24-Oct-79 11:52:10, EDIT BY MURPHY
;TRPDSP
;<4.MONITOR>STG.MAC.300, 23-Oct-79 15:26:46, EDIT BY GRANT
;TCO 4.2543 - ADD GIVTIM, RCVTIM, AND RCVTMO - REMOVE GOKTMO
;<4.MONITOR>STG.MAC.299, 19-Oct-79 17:22:22, EDIT BY MURPHY
;ADD NBSL
;<4.MONITOR>STG.MAC.298, 28-Sep-79 12:20:53, EDIT BY MURPHY
;REMOVE RITH FROM LOAD MODULE LIST
;<4.MONITOR>STG.MAC.297, 25-Sep-79 16:30:15, EDIT BY MILLER
;TCO 4.2487. ADD TABLE ENTRIES FOR .GOOAD GETOK FUNCTION
;<4.MONITOR>STG.MAC.296, 20-Sep-79 12:30:08, EDIT BY MILLER
;ADD RLDFRK
;<4.MONITOR>STG.MAC.293, 14-Sep-79 15:55:44, Edit by KOHN
;<4.MONITOR>STG.MAC.292, 14-Sep-79 15:38:12, EDIT BY MILLER
;TCO 4.2469. ADD .GOACC ACJ FUNCTION
;<4.MONITOR>STG.MAC.290, 14-Sep-79 15:11:03, Edit by KOHN
;<4.MONITOR>STG.MAC.289, 14-Sep-79 11:44:53, Edit by KOHN
;<4.MONITOR>STG.MAC.287, 12-Sep-79 18:42:20, Edit by KOHN
;ADD STORAGE FOR AYDIN DISPLAY
;<OSMAN.MON>STG.MAC.1, 10-Sep-79 16:05:23, EDIT BY OSMAN
;TCO 4.2412 - Move definition of BUGHLTs, BUGCHKs, and BUGINFs to BUGS.MAC
;<4.MONITOR>STG.MAC.285,  1-Sep-79 22:09:57, EDIT BY R.ACE
;PUT EFILIN BACK (GRUMBLE)
;<4.MONITOR>STG.MAC.284, 29-Aug-79 13:50:58, EDIT BY R.ACE
;TCO 4.2429 - DEFINE CDPTIM BASED ONLY ON PCDPN
;<4.MONITOR>STG.MAC.283, 24-Aug-79 06:18:12, EDIT BY R.ACE
;<4.MONITOR>STG.MAC.282, 24-Aug-79 05:55:47, EDIT BY R.ACE
;TCO 4.2398 - ALWAYS LOAD FILINI (NO MORE EFILIN)
;<4.MONITOR>STG.MAC.281, 17-Aug-79 03:40:59, EDIT BY GILBERT
;TCO 4.2408: DEFINE RESFRZ.
;<4.MONITOR>STG.MAC.280, 12-Aug-79 19:14:25, EDIT BY GILBERT
;TCO 4.2388: DELETE ALL REFERENCES TO SWPCOR
;<4.MONITOR>STG.MAC.279,  7-Aug-79 15:42:21, EDIT BY HALL
;ADD FLKCNT AND FLKOWN
;<4.MONITOR>STG.MAC.278, 28-Jun-79 14:38:05, Edit by KONEN
;ADD FKXORA -- IDXORA FOR FORK DURING STRUCTURE CREATION
;<4.MONITOR>STG.MAC.277, 26-Jun-79 10:36:30, EDIT BY HALL
;REARRANGE RECENT ADDITIONS TO PSB
;<4.MONITOR>STG.MAC.276, 26-Jun-79 10:31:27, EDIT BY HALL
;ADD PSBITS
;<4.MONITOR>STG.MAC.275, 26-Jun-79 08:54:36, EDIT BY HALL
;ADD PSLEVT AND PSCHNT FOR USER MODE EXTENDED ADDRESSING
;<4.MONITOR>STG.MAC.274, 19-Jun-79 12:53:32, EDIT BY HALL
;INCREASE NUMBER OF ATS TERMINALS TO 96
;<4.MONITOR>STG.MAC.273, 13-Jun-79 16:09:02, Edit by KONEN
;SET UP ASCII TIME AND DATE FOR TYPEOUT AT BUGHLT
;<4.MONITOR>STG.MAC.272, 31-May-79 15:41:28, EDIT BY KIRSCHEN
;ADD USER FOR WHOM CACHED ACCOUNT WAS VALIDATED
;<4.MONITOR>STG.MAC.271, 29-May-79 14:53:03, EDIT BY KIRSCHEN
;INCREASE FREE SPACE SLIGHTLY FOR ATS
;<4.MONITOR>STG.MAC.270, 28-Apr-79 12:55:16, EDIT BY MILLER
;ADD WA
;<4.MONITOR>STG.MAC.269, 25-Apr-79 20:09:24, EDIT BY JBORCHEK
;ADD I8COP AND SCTLW
;<4.MONITOR>STG.MAC.268, 25-Apr-79 15:20:33, EDIT BY OSMAN
;PUT DUMMY NAMINI TO CLEAR NODE NAME FOR NON-DECNET SYSTEM
;<4.MONITOR>STG.MAC.267, 25-Apr-79 00:10:02, Edit by MCLEAN
;MAKE GOKTMC SMALLER FOR NOW
;<4.MONITOR>STG.MAC.266, 19-Apr-79 16:03:11, EDIT BY BLOUNT
;CHANGE PAGE SIZE OF LA120 FROM 60 TO 66
;<4.MONITOR>STG.MAC.265, 18-Apr-79 00:28:22, Edit by MCLEAN
;<4.MONITOR>STG.MAC.264, 18-Apr-79 00:10:17, Edit by MCLEAN
;<4.MONITOR>STG.MAC.263, 17-Apr-79 11:31:06, Edit by MCLEAN
;<4.MONITOR>STG.MAC.262, 16-Apr-79 17:28:16, Edit by MCLEAN
;<4.MONITOR>STG.MAC.261, 15-Apr-79 22:18:33, Edit by MCLEAN
;<4.MONITOR>STG.MAC.260, 12-Apr-79 14:50:18, EDIT BY HALL
;TCO 4.2230 - ADD JB0XFR
;<4.MONITOR>STG.MAC.259, 11-Apr-79 14:20:40, EDIT BY DBELL
;DEFINE SYMBOL EP (PAGE NUMBER OF THE EPT) TO MAKE DUMP EXAMINATIONS EASY
;<4.MONITOR>STG.MAC.258,  9-Apr-79 13:52:39, EDIT BY HALL
;MORE ON 4.2226 PLUS ADD A SEMICOLON TO MCLEAN'S EDIT LINE
;<4.MONITOR>STG.MAC.257,  9-Apr-79 13:21:13, EDIT BY HALL
;TCO 4.2226 - INCREASE NLFKS TO BE EQUAL TO NUFKS
;<4.MONITOR>STG.MAC.256,  3-Apr-79 14:32:31, Edit by MCLEAN
;ADDITOIONS FOR GETOK
;<4.MONITOR>STG.MAC.255,  2-Apr-79 13:12:54, Edit by MCLEAN
;FIX ENQ TO REFUSE AS DEFAULT
;<4.MONITOR>STG.MAC.254, 29-Mar-79 10:37:02, EDIT BY MILLER
;ADD CLSIRT
;<4.MONITOR>STG.MAC.253, 14-Mar-79 23:58:03, EDIT BY DBELL
;MAKE NUMBER OF MDDT DATA PAGES BE NDDTPG, WHICH IS 2
;<4.MONITOR>STG.MAC.252, 14-Mar-79 20:11:30, EDIT BY KIRSCHEN
;MAKE CARD PUNCH PRESENT BY DEFAULT
;<4.MONITOR>STG.MAC.251, 11-Mar-79 12:57:35, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.MONITOR>STG.MAC.250, 10-Mar-79 13:33:11, EDIT BY MILLER
;CHANGE MEANING OF FSTTBL
;<4.MONITOR>STG.MAC.249,  6-Mar-79 10:19:30, EDIT BY MILLER
;ADD A DUMMY RELMT ROUTINE
;<4.MONITOR>STG.MAC.248,  5-Mar-79 16:45:55, EDIT BY KIRSCHEN
;ADD COMMENT FOR EDIT .247 - REMOVE UNUSED LOGICAL LINK FREE POOL,
; ADD ADDITIONAL SPACE FOR DDCMP ON 2020 WITH ATS.
;<4.MONITOR>STG.MAC.246,  2-Mar-79 14:26:39, EDIT BY MILLER
;REMOVE TLABBF, AGAIN.
;<4.MONITOR>STG.MAC.245, 27-Feb-79 13:17:15, EDIT BY BOSACK
;MAKE RESIDENT FREEPOOL USE COMPUTED SIZE, NOT CONSTANT
;<4.MONITOR>STG.MAC.244, 26-Feb-79 11:05:52, EDIT BY MILLER
;PUT BACK TLABBF
;<4.MONITOR>STG.MAC.243, 23-Feb-79 14:35:09, Edit by KONEN
;MAKE SYS:EDIT.EXE THE DEFAULT EDITOR
;<4.MONITOR>STG.MAC.242, 21-Feb-79 16:29:29, EDIT BY MILLER
;REMOVE TLABBF
;<4.MONITOR>STG.MAC.241, 18-Feb-79 09:06:13, EDIT BY KIRSCHEN
;ADD OUTTIM, OUTIVL FOR NSP BACKGROUND TASK WAKEUP
;<4.MONITOR>STG.MAC.240, 18-Feb-79 00:46:04, Edit by MCLEAN
;ADD FKCNT COUNT OF ACTIVE FORKS IN THIS JOB
;<4.MONITOR>STG.MAC.239, 17-Feb-79 13:20:35, EDIT BY DBELL
;ADD SYMPAG TO PSB
;<4.MONITOR>STG.MAC.238, 16-Feb-79 11:33:17, EDIT BY MILLER
;ADD TLAB13
;<4.MONITOR>STG.MAC.237, 11-Feb-79 05:06:38, EDIT BY GILBERT
;Move edit from version 235 out of IFE SMFLG conditional for 2020s
;<4.MONITOR>STG.MAC.236,  7-Feb-79 10:23:43, EDIT BY OSMAN
;MOVE OURNAM/OURCNT OUT OF DCN CONDITIONAL FOR GETJI, SETJB, JOB INITIALIZATION
;<4.MONITOR>STG.MAC.235,  4-Feb-79 22:26:21, EDIT BY GILBERT
;Get rid of spurious character on /G141 to BOOT
;<4.MONITOR>STG.MAC.234,  1-Feb-79 16:17:50, Edit by MCLEAN
;INCREASE SIZE OF NSKDP
;<4.MONITOR>STG.MAC.233, 31-Jan-79 08:59:37, EDIT BY OSMAN
;PUT CLOSING PARENTHESE ON TY MACRO CALL, AND ADD TY1 ENTRIES
;<4.MONITOR>STG.MAC.233, 30-Jan-79 16:22:30, EDIT BY OSMAN
;ADD TY ENTRIES FOR LA38, LA120
;<4.MONITOR>STG.MAC.232, 29-Jan-79 03:57:25, EDIT BY DBELL
;ADD HSYSWP AREA, CHANGE HSYPAG TO HSYBLK, ADD OSECTB AND SSECTB
;<4.MONITOR>STG.MAC.231, 23-Jan-79 18:09:56, Edit by MCLEAN
;MORE CDP CHANGES
;<4.MONITOR>STG.MAC.230, 23-Jan-79 17:39:56, Edit by MCLEAN
;FIX CDPN DEFS TO BE PCDPN DEFS
;<4.MONITOR>STG.MAC.228, 19-Jan-79 16:29:36, EDIT BY MURPHY
;XGC VARIABLES
;<4.MONITOR>STG.MAC.226, 15-Jan-79 22:15:25, EDIT BY GILBERT
;FIX VERSION SKEW BETWEEN MCLEAN, MILLER, KONEN, LCAMPBELL, GILBERT, DBELL
;<4.MONITOR>STG.MAC.225, 15-Jan-79 14:13:08, Edit by KONEN
;ADD STRWRD TO PSB TO HOLD STRUCTURE INFORMATION
;<4.MONITOR>STG.MAC.224, 15-Jan-79 07:51:13, EDIT BY GILBERT
;More TCO 4.2155:
;	Move symbols out of the RSCOD area before using the EPT.
;<4.MONITOR>STG.MAC.223, 14-Jan-79 15:08:38, Edit by MCLEAN
;REMOVE SPDBLK,RTSKED
;<4.MONITOR>STG.MAC.221, 12-Jan-79 17:42:45, EDIT BY HALL
;INCREASE RESIDENT POOL FOR TIMERS (.RSTMQ) BECAUSE BLOCK IS NOW
;TWICE AS LONG.
;ADD TMLSTL
;<4.MONITOR>STG.MAC.220, 11-Jan-79 17:21:53, EDIT BY MILLER
;<4.MONITOR>STG.MAC.219, 11-Jan-79 14:44:01, EDIT BY MILLER
;MOVE SWPF TO NRCOD
;<4.MONITOR>STG.MAC.218, 11-Jan-79 13:31:01, EDIT BY DBELL
;MOVE SWPF INTO RSCOD PSECT
;<4.MONITOR>STG.MAC.217, 10-Jan-79 17:14:41, Edit by LCAMPBELL
;<4.MONITOR>STG.MAC.216, 10-Jan-79 16:02:39, Edit by LCAMPBELL
; Save 2020T monitor as TMONITR.EXE
;<4.MONITOR>STG.MAC.215, 10-Jan-79 13:00:20, EDIT BY MILLER
;ADD TLAB12
;<4.MONITOR>STG.MAC.214,  9-Jan-79 16:28:50, Edit by MCLEAN
;MAKE TTSPWD RESIDENT
;<4.MONITOR>STG.MAC.213,  8-Jan-79 11:00:19, EDIT BY MILLER
;DO NOT CREATE BTB AREA IF 2060 MONITOR
;<4.MONITOR>STG.MAC.212,  8-Jan-79 07:00:31, EDIT BY GILBERT
;TCO 4.2155 - Implement hidden symbol tables:
;	Add HIDSYM and BUGSTF feature tests.
;	Add storage for SYTBL PSECT, alternate EPT/MMAP, etc.
;	Make PSECT bounds names uniform.
;<MURPHY.MON>STG.MAC.2,  3-Jan-79 17:50:12, EDIT BY MURPHY
;FKBSPW
;<4.MONITOR>STG.MAC.210,  5-Jan-79 11:12:04, Edit by LCAMPBELL
; At startup, CALL IMPINT, not CALL IMPRST
;<4.MONITOR>STG.MAC.209,  4-Jan-79 15:09:22, Edit by MCLEAN
;REMOVE SF%DOK DEFINITION
;<4.MONITOR>STG.MAC.208, 28-Dec-78 17:23:42, Edit by LCAMPBELL
; Change name of KS10 ARPA driver from IMP11B to IMAN22
;<4.MONITOR>STG.MAC.207, 23-Dec-78 12:34:04, EDIT BY MILLER
;ADD TLAB11
;<4.MONITOR>STG.MAC.206, 22-Dec-78 14:25:14, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.205, 20-Dec-78 15:08:58, EDIT BY MURPHY
;SET POSPGF=1
;<4.MONITOR>STG.MAC.204, 18-Dec-78 17:03:09, EDIT BY MILLER
;ADD PIBITS DEF
;<4.MONITOR>STG.MAC.203, 14-Dec-78 15:31:17, EDIT BY OSMAN
;ADD PIDSPJ
;<4.MONITOR>STG.MAC.202, 13-Dec-78 23:34:25, EDIT BY KIRSCHEN
;ADD SEMICOLON TO COMMENT "TEMPORARILY CHANGE PIDSPQ..." SO STG ASSEMBLES
;<4.MONITOR>STG.MAC.201, 13-Dec-78 16:22:47, EDIT BY KONEN
;(ALIAS OSMAN)
;TEMPORARILY CHANGE PIDSPQ BACK TO 2 UNTIL EFFECT OF 5 IS STUDIED
;<4.MONITOR>STG.MAC.200, 13-Dec-78 11:21:29, EDIT BY OSMAN
;FIX DEFINITIONS OF MAXPID, PIDTBS TO BE A FUNCTION OF PIDSPQ
;<4.MONITOR>STG.MAC.198, 13-Dec-78 10:45:18, EDIT BY OSMAN
;CHANGE PIDSPQ FROM 2 TO 5.  ALSO, DEFINE MAXPID IN TERMS OF PIDSPQ INSTEAD OF IN TERMS OF 2
;<4.MONITOR>STG.MAC.197,  7-Dec-78 14:31:14, EDIT BY MURPHY
;NEW SWAP LOGIC
;<4.MONITOR>STG.MAC.196,  4-Dec-78 14:44:07, EDIT BY MILLER
;ADD FILMTP DEF TO JFN BLOCK
;<4.MONITOR>STG.MAC.195, 23-Nov-78 15:45:50, EDIT BY JBORCHEK
;<4.MONITOR>STG.MAC.194, 22-Nov-78 14:39:38, EDIT BY JBORCHEK
;ADD OLD ARPA HOST NUMBER AND NETWRK NUMBER CELLS
;<4.MONITOR>STG.MAC.193, 20-Nov-78 14:29:29, EDIT BY BOSACK
;ELIMINATE UNUSED CELLS
;<4.MONITOR>STG.MAC.192, 19-Nov-78 15:30:31, Edit by MCLEAN
;ADD OVRBCT FOR EXTRA TTY BUFFERS
;<4.MONITOR>STG.MAC.191, 12-Nov-78 13:44:20, EDIT BY MILLER
;DEFINE BUTPGA TO BE CONINCIDENT WITH SNPDAT.
;<4.MONITOR>STG.MAC.190,  6-Nov-78 17:40:28, Edit by LCAMPBELL
; Make LHOSTN return -1 on non-ARPA systems
;<4.MONITOR>STG.MAC.189,  1-Nov-78 13:28:30, EDIT BY JBORCHEK
;MAKE ARPA GETAB SIMULATIONS RETURN 0 FOR NON-ARPA SYSTEM
;<4.MONITOR>STG.MAC.188,  1-Nov-78 11:38:31, EDIT BY JBORCHEK
;<4.MONITOR>STG.MAC.187, 30-Oct-78 08:25:59, Edit by LCAMPBELL
; MOVE ATSTYM OUTSIDE DCN CONDITIONAL FOR DUMMY ATSINI
;<4.MONITOR>STG.MAC.186, 25-Oct-78 17:10:01, EDIT BY MILLER
;ADD NEW GIVOK/GETOK FOR MT ACCESS
;<4.MONITOR>STG.MAC.183, 24-Oct-78 15:55:54, EDIT BY OSMAN
;TCO 4.2060 - ADD LLSR
;<4.MONITOR>STG.MAC.182, 23-Oct-78 20:54:43, Edit by MCLEAN
;TCO 4.2063 ADD BATSTF BATCH STREAM AND FLAGS WORD
;<KONEN>STG.MAC.4, 10-Aug-78 10:13:35, Edit by KONEN
;ADD WORD TO STRUCTURE BLOCK TO ENABLE FORK-ONLY MOUNTS (VS JOB)
;[BBN-TENEXD]<3-EONEIL>STG.MAC.6,  9-Aug-78 12:51:45, Ed: EONEIL
;ADDED .PFOFL FOR OFF-LINE FILE ATTRIBUTE
;<4.MONITOR>STG.MAC.179, 17-Oct-78 10:33:47, EDIT BY MILLER
;ADD TLAB10
;<4.MONITOR>STG.MAC.178, 12-Oct-78 17:09:35, EDIT BY MILLER
;ADD .PFACC AND .PFEXP
;<2MCLEAN>STG.MAC.176, 29-Sep-78 23:13:34, Edit by MCLEAN
;MAKE MINIMUM TTY BUFFER COUNT BE 1
;<4.MONITOR>STG.MAC.176,  1-Oct-78 22:11:49, EDIT BY DBELL
;TCO 4.2027 - ADD SRTTIM WORD IN JSB FOR TIME JOB WAS STARTED
;<4.MONITOR>STG.MAC.175, 29-Sep-78 13:57:16, Edit by LCAMPBELL
; Call device-dependent routine at startup to reset IMP interface
;<4.MONITOR>STG.MAC.174, 29-Sep-78 10:09:44, EDIT BY MILLER
;<4.MONITOR>STG.MAC.173, 28-Sep-78 16:35:13, EDIT BY MILLER
;ADD JOBSLD
;<4.MONITOR>STG.MAC.172, 28-Sep-78 11:52:50, Edit by LCAMPBELL
; INCREASE SIZE OF SEND ALL BUFFER TO AVOID SLOWNESS ON ARPA SYSTEMS
;<4.MONITOR>STG.MAC.171, 28-Sep-78 10:41:13, EDIT BY ENGEL
;ADD DUMMY NTCOFF FOR DCN=0
;<4.MONITOR>STG.MAC.170, 27-Sep-78 14:42:33, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.169, 24-Sep-78 11:34:14, EDIT BY HALL
;TCO 1900 - ADD DUMMY ENTRIES FOR CKATSQ AND DOATSQ
;<4.MONITOR>STG.MAC.168, 23-Sep-78 08:53:07, Edit by LCAMPBELL
; LOAD IMP11B IF KS ARPA MONITOR
;<MURPHY.MON>STG.MAC.6, 25-Sep-78 10:15:13, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.167, 22-Sep-78 10:11:36, EDIT BY HELLIWELL
;FIX CONDITIONALS FOR PI6 CODE TO INCLUDE PTPN
;<4.MONITOR>STG.MAC.166, 21-Sep-78 14:43:01, EDIT BY ENGEL
;MAKE NSPMCB RESIDENT
;<4.MONITOR>STG.MAC.165, 21-Sep-78 08:53:57, EDIT BY ENGEL
;ADD NSPMCB - FLAG WHERE EACH FLAG INDICATES A DEAD MCB PORT
;<4.MONITOR>STG.MAC.164, 19-Sep-78 15:27:36, EDIT BY HALL
;TCO 1900 - ADD DUMMY CHKATS
;<MURPHY.MON>STG.MAC.4, 21-Sep-78 17:39:42, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.163, 18-Sep-78 12:45:06, Edit by LCAMPBELL
; Allocate ARPAnet buffers in section zero for KS10, remove AN1SEC
;<4.MONITOR>STG.MAC.162, 18-Sep-78 12:21:23, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.161, 16-Sep-78 15:18:12, EDIT BY MILLER
;ADD TWO MORE GETOK ENTRIES
;<4.MONITOR>STG.MAC.160, 14-Sep-78 21:44:54, Edit by MCLEAN
;FIX IT SO MAX FORK FOR GETOK BEFORE CHECK IS 5
;<MURPHY.MON>STG.MAC.2,  8-Sep-78 11:22:55, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.158, 13-Sep-78 10:29:14, Edit by LCAMPBELL
; Set ANBSEC to 0 for KS10 to minimize code changes elsewhere
;<4.MONITOR>STG.MAC.157,  7-Sep-78 18:04:36, Edit by LCAMPBELL
; Create new flavor of STG, STGASM (2020T)
;<4.MONITOR>STG.MAC.156,  5-Sep-78 14:47:12, Edit by MCLEAN
;<4.MONITOR>STG.MAC.155,  5-Sep-78 13:03:17, Edit by MCLEAN
;MAKE MT AND MTA CHARACTISTICS THE SAME
;<4.MONITOR>STG.MAC.154,  2-Sep-78 17:52:12, EDIT BY JBORCHEK
;ADD TWO FLAG WORDS FOR DBGIM JSYS
;<4.MONITOR>STG.MAC.153,  2-Sep-78 02:43:52, Edit by MCLEAN
;FIX GTOKPR TO BE RESIDENT CODE
;<4.MONITOR>STG.MAC.152,  1-Sep-78 22:13:10, EDIT BY OSMAN
;add VT100 goodies
;<4.MONITOR>STG.MAC.151,  1-Sep-78 15:21:56, EDIT BY JBORCHEK
;REMOVE IMPLBT AND NOHOST
;<4.MONITOR>STG.MAC.150, 31-Aug-78 17:15:36, Edit by MCLEAN
;MAKE CYLUN2 558 FOR DIAGNOSTICS TO HAVE TO MAINT CYL'S
;<4.MONITOR>STG.MAC.149, 29-Aug-78 15:59:22, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.148, 29-Aug-78 13:32:45, Edit by LCAMPBELL
; Add dummy entry points for new ARPA GETABs for non-ARPA monitors
;<4.MONITOR>STG.MAC.147, 27-Aug-78 09:46:38, EDIT BY MILLER
;ADD CLSCTL
;<4.MONITOR>STG.MAC.145, 25-Aug-78 16:54:11, Edit by MCLEAN
;MODIFY DV MACRO TO PERMIT NEW CHARACTERISTICS WITH UNIT #
;<4.MONITOR>STG.MAC.144, 24-Aug-78 08:21:01, EDIT BY MILLER
;ADD CSHCLS
;<4.MONITOR>STG.MAC.143, 23-Aug-78 17:21:34, Edit by MCLEAN
;<4.MONITOR>STG.MAC.142, 23-Aug-78 11:00:31, EDIT BY JBORCHEK
;INCREASE SIZE OF IRREGULAR MSG BUFFER FOR 96 BIT LEADERS
;<4.MONITOR>STG.MAC.141, 23-Aug-78 00:02:55, Edit by MCLEAN
;INCREASE DIRECTORY CACHE SIZE TO 20
;<4.MONITOR>STG.MAC.140, 22-Aug-78 11:20:37, EDIT BY JBORCHEK
;ADD 96 BIT LEADER STORAGE. MAKE LDR96B BE PART OF GETAB
;<4.MONITOR>STG.MAC.139, 21-Aug-78 22:40:33, Edit by MCLEAN
;ADD MORE NR STUFF FOR TAPE
;<4.MONITOR>STG.MAC.138, 16-Aug-78 19:38:22, EDIT BY MILLER
;TCO 1900 - MOVE DEFINITIONS OF ATMAX AND HTNADR HERE FROM ATSSRV, 
; ADD NATMSK AND ATTMSK
;<4.MONITOR>STG.MAC.137, 16-Aug-78 01:13:01, Edit by MCLEAN
;GETOK ADDITION OF COMMENTS AND DGOMDD
;<4.MONITOR>STG.MAC.136, 14-Aug-78 18:09:16, EDIT BY MILLER
;MOVE CLSRJA SO IT IS NOT IN THE WAY OF GETAB ENTRIES
;<4.MONITOR>STG.MAC.135, 14-Aug-78 12:39:16, EDIT BY MILLER
;<4.MONITOR>STG.MAC.134, 14-Aug-78 11:57:17, EDIT BY MILLER
;ADD CLSSUM AND CLSRJA
;<4.MONITOR>STG.MAC.133, 13-Aug-78 12:14:56, EDIT BY MILLER
;REMOVE JOBQ,CLSQ, AND CLSQI
;<4.MONITOR>STG.MAC.132, 11-Aug-78 08:06:12, EDIT BY MILLER
;ADD CLSDST
;<KONEN>STG.MAC.2,  2-Aug-78 17:09:55, Edit by KONEN
;ADD WORD TO STRUCTURE BLOCK TO ENABLE FORK-ONLY MOUNTS (VS JOB)
;<4.MONITOR>STG.MAC.130,  1-Aug-78 16:58:46, EDIT BY MILLER
;ADD GET CACHE STORAGE
;<4.MONITOR>STG.MAC.129,  1-Aug-78 11:47:34, Edit by KIRSCHEN
;ADD NODLOK
;<4.MONITOR>STG.MAC.128, 31-Jul-78 23:45:35, Edit by MCLEAN
;ADD MTCLVA,MTCLVL FOR NON MAGTAPE SYSTEMS
;<4.MONITOR>STG.MAC.127, 31-Jul-78 10:58:14, EDIT BY MILLER
;ADD NTCMAX
;<4.MONITOR>STG.MAC.126, 31-Jul-78 10:22:52, Edit by KIRSCHEN
;<4.MONITOR>STG.MAC.125, 31-Jul-78 09:12:43, Edit by KIRSCHEN
;ADD NODTBL
;<4.MONITOR>STG.MAC.124, 28-Jul-78 15:40:04, Edit by HALL
;TCO 1900 - MOVE ATBPFG HERE FROM ATSSRV
;<4.MONITOR>STG.MAC.123, 28-Jul-78 00:11:36, Edit by MCLEAN
;<4.MONITOR>STG.MAC.122, 23-Jul-78 14:52:16, EDIT BY MILLER
;REMOVE PAGE FIELD FROM TY1 MACRO
;<4.MONITOR>STG.MAC.121, 21-Jul-78 16:12:32, EDIT BY MILLER
;INCREASE PIPDB BY ONE WORD. MOVE AROUND PSB DEFS
;<4.MONITOR>STG.MAC.120, 20-Jul-78 00:48:50, Edit by MCLEAN
;<4.MONITOR>STG.MAC.119, 19-Jul-78 23:20:26, Edit by MCLEAN
;<4.MONITOR>STG.MAC.118, 18-Jul-78 02:13:04, Edit by MCLEAN
;ADD DIRRDM READ UPDATE MASK
;<4.MONITOR>STG.MAC.117, 18-Jul-78 00:10:42, Edit by MCLEAN
;<4.MONITOR>STG.MAC.116, 17-Jul-78 23:53:44, Edit by MCLEAN
;<4.MONITOR>STG.MAC.49,  6-May-78 21:18:16, Edit by MCLEAN
;ADD RP07 (DSKSZ2)
;<4.MONITOR>STG.MAC.114, 16-Jul-78 00:37:07, Edit by MCLEAN
;TCO 1946 READ UPDATE MASK ADDED FOR SMON/TMON JSYS
;<4.MONITOR>STG.MAC.113, 14-Jul-78 14:31:33, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.112, 14-Jul-78 00:13:09, Edit by MCLEAN
;ADD DIRCAD FOR DIRECTORY CACHE
;<4.MONITOR>STG.MAC.111, 13-Jul-78 20:54:05, EDIT BY MILLER
;ADD JOBQ
;<4.MONITOR>STG.MAC.110, 13-Jul-78 20:17:01, EDIT BY MILLER
;ADD CLSSHI AND JOBDST. REMOVE CLSDST
;<3A.MONITOR>STG.MAC.50, 13-Jul-78 18:30:35, Edit by ENGEL
;MOVE MTMXDM BACK TO MAGTAP WHERE IT BELONGS
;<4.MONITOR>STG.MAC.108, 11-Jul-78 13:46:39, EDIT BY MILLER
;ADD BUTPG AND BUTPGA DEFS HERE
;<4.MONITOR>STG.MAC.107, 10-Jul-78 13:26:30, EDIT BY MILLER
;ADD CLASS SCHEDULER VARIABLES
;<2MCLEAN>STG.MAC.111,  9-Jul-78 23:10:38, Edit by MCLEAN
;ADD DIRECTORY CACHE FOR MAPDIR
;<2MCLEAN>STG.MAC.110,  7-Jul-78 13:13:11, Edit by MCLEAN
;<2MCLEAN>STG.MAC.109,  7-Jul-78 00:10:50, Edit by MCLEAN
;<2MCLEAN>STG.MAC.106,  6-Jul-78 02:34:00, Edit by MCLEAN
;<4.MONITOR>STG.MAC.105,  3-Jul-78 02:57:31, Edit by JBORCHEK
;REMOVE STG FOR ARPANET BIT TABLES
;<4.MONITOR>STG.MAC.104, 30-Jun-78 17:38:31, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.102, 29-Jun-78 00:54:11, Edit by MCLEAN
;MOVE BUGHLT DISPATCH SETUP BEFORE FIRST BUGHLT
;<4.MONITOR>STG.MAC.101, 27-Jun-78 19:53:32, EDIT BY JBORCHEK
;ADD DUMMY GTNCP AND GTHST JSYS'S
;<4.MONITOR>STG.MAC.100, 26-Jun-78 13:42:17, Edit by KIRSCHEN
;ADD ATSTYM
;<4.MONITOR>STG.MAC.99, 26-Jun-78 11:59:00, EDIT BY MURPHY
;REMOVED LALL
;<4.MONITOR>STG.MAC.98, 26-Jun-78 02:03:44, Edit by JBORCHEK
;CHANGES TO ARPA STG FOR HASHING
;<4.MONITOR>STG.MAC.97, 24-Jun-78 11:16:02, EDIT BY MILLER
;ADD "CRTRGN" TO PSB
;<4.MONITOR>STG.MAC.96, 23-Jun-78 16:12:01, EDIT BY MURPHY
;<4.MONITOR>STG.MAC.95, 22-Jun-78 09:02:45, EDIT BY MILLER
;TCO 1924. ADD NEW FIELD TO TTYPE1 TO ENABLE XON/XOFF
;<4.MONITOR>STG.MAC.94, 20-Jun-78 16:39:11, Edit by JBORCHEK
;REMOVE IDXTAB FROM PSB IF EXADF
;<4.MONITOR>STG.MAC.93, 20-Jun-78 13:03:41, Edit by MCLEAN
;<4.MONITOR>STG.MAC.92, 20-Jun-78 10:54:39, EDIT BY MILLER
;MOVE KLLUUO DEF TO MAKE MACRO HAPPY
;<4.MONITOR>STG.MAC.91, 20-Jun-78 09:47:42, EDIT BY MILLER
;CHANGE DEFINITION OF KLLUUO
;<3A.MONITOR>STG.MAC.46, 20-Jun-78 09:35:57, EDIT BY MILLER
;ONE MORE EDIT
;<3A.MONITOR>STG.MAC.45, 20-Jun-78 09:34:03, EDIT BY MILLER
;CHECK FOR 2060 MONITOR RUNNING ON A MODEL A. IF SO, GIVE NOXADR BUGHLT
;<4.MONITOR>STG.MAC.89, 20-Jun-78 08:38:53, EDIT BY MILLER
;DEFINE DRMASZ AS DRSMDA IF NOT EXTENDED ADDRESSING
;<4.MONITOR>STG.MAC.88, 20-Jun-78 01:20:16, EDIT BY BOSACK
;<4.MONITOR>STG.MAC.87, 20-Jun-78 00:47:06, EDIT BY BOSACK
;<4.MONITOR>STG.MAC.86, 19-Jun-78 21:59:49, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1023,  6-Jun-78 02:33:09, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1022,  5-Jun-78 23:58:00, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1021,  5-Jun-78 21:34:09, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1020,  5-Jun-78 20:44:03, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1019,  5-Jun-78 19:33:13, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1018,  5-Jun-78 18:38:25, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1017,  5-Jun-78 18:09:42, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1016, 31-May-78 18:51:02, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1015, 31-May-78 18:38:49, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1014, 31-May-78 18:35:15, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1013, 31-May-78 18:17:34, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1012, 31-May-78 18:07:02, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1011, 31-May-78 17:47:07, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1010, 31-May-78 16:51:28, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1009, 31-May-78 16:44:30, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1008, 31-May-78 16:35:15, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1007, 31-May-78 16:31:30, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1006, 31-May-78 15:42:23, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1005, 24-May-78 18:01:54, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1004, 24-May-78 17:39:23, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1003, 24-May-78 17:33:41, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1002, 24-May-78 17:22:00, EDIT BY BOSACK
;<1BOSACK>STG.MAC.1001, 24-May-78 17:15:05, EDIT BY BOSACK
;<1BOSACK>STG.ORG.33, 24-May-78 15:18:03, EDIT BY BOSACK
;<4.MONITOR>STG.MAC.84, 19-Jun-78 14:52:08, EDIT BY KIRSCHEN
;ADD SYMBOL, DRSMDA, MAZ SIZE OF A DIR ON A MODEL A
;<4.MONITOR>STG.MAC.83, 18-Jun-78 17:59:55, Edit by MCLEAN
;FIX COMMENTS FOR GTOKPR
;<4.MONITOR>STG.MAC.82, 18-Jun-78 14:08:04, Edit by JBORCHEK
;MAKE HOSTNN RESIDENT
;<4.MONITOR>STG.MAC.81, 12-Jun-78 05:32:02, Edit by JBORCHEK
;ADD HOSTNN
;<3A.MONITOR>STG.MAC.41,  8-Jun-78 17:13:47, EDIT BY MURPHY
;TCO #1894 - QUEUE OF TTY LINES TO START OUTPUT
;<4.MONITOR>STG.MAC.79,  8-Jun-78 16:54:45, Edit by JBORCHEK
;ADD NEW NCP TABLE NETHST
;<3A.MONITOR>STG.MAC.40,  8-Jun-78 11:04:35, EDIT BY MILLER
;ADD NEW DEFS FOR ASGFRE TO ESTABLISH LIMITS FOR JOB 0 ACTIVITY
;<4.MONITOR>STG.MAC.77,  7-Jun-78 12:22:44, Edit by HELLIWELL
;ADD MEMTAB FROM 3A
;<4.MONITOR>STG.MAC.76,  7-Jun-78 00:08:48, Edit by JBORCHEK
;ADD MORE SPACE TO HOST NAME TABLE
;<4.MONITOR>STG.MAC.75,  6-Jun-78 14:56:58, Edit by JBORCHEK
;ADD DUMMY IMPLT5
;<4.MONITOR>STG.MAC.74,  6-Jun-78 01:18:36, Edit by JBORCHEK
;FIX UP NETWORK STORAGE AND PUT IN AN1SEC CONDITIONAL
;<4.MONITOR>STG.MAC.73,  5-Jun-78 14:50:04, Edit by HALL
;TCO 1900 - FIX THE ATSINI REFERENCE UNDER ATS CONDITIONAL
;<4.MONITOR>STG.MAC.72,  5-Jun-78 13:57:50, Edit by DBELL
;INCREASE SCHEDULAR STACK TO PREVENT MONPDL WHEN TLINKING A PTY
;<4.MONITOR>STG.MAC.71,  3-Jun-78 22:00:51, Edit by JBORCHEK
;ADD EXTRA SQMSK AND SQVAL TABLES
;ADD IMPLT5 FOR EXTENDED HOST NUMBERS
;<4.MONITOR>STG.MAC.70,  3-Jun-78 20:27:30, Edit by JBORCHEK
;ADD DMPBUF AND SNOOP STORAGE
;<4.MONITOR>STG.MAC.69,  3-Jun-78 17:20:42, Edit by JBORCHEK
;REMOVE DEBUG STORAGE FOR IMPDV
;<3A.MONITOR>STG.MAC.37, 31-May-78 15:11:14, EDIT BY BOSACK
;ADD TEMP XBIO FOR 3A
;<4-NEW>STG.MAC.67,  1-Jun-78 12:34:28, Edit by FORTMILLER
;PUT DX20 CODE IN
;<4.MONITOR>STG.MAC.66, 30-May-78 10:06:53, Edit by KIRSCHEN
;ADD NSPINT LOADMODULE
;<4.MONITOR>STG.MAC.65, 29-May-78 14:42:52, EDIT BY MILLER
;RESERVE SPACE FOR CRD IN DTEDTV
;<4.MONITOR>STG.MAC.64, 28-May-78 16:02:19, Edit by BORCHEK
;TCO #1900 SAYS ADDED DUMMY ATSINI BUT WAS LEFT OUT
;<4.MONITOR>STG.MAC.63, 28-May-78 14:04:00, Edit by BORCHEK
;FIX CASE OF DCN=0 AND ATS=0 DEFINING NSPINI TWICE
;<4.MONITOR>STG.MAC.62, 19-May-78 16:11:39, Edit by MCLEAN
;<4.MONITOR>STG.MAC.61, 18-May-78 10:52:49, Edit by MCCLURE
; Change DUP to KDP
;<4.MONITOR>STG.MAC.60, 17-May-78 17:44:07, EDIT BY MILLER
;FIX TYPEO
;<4.MONITOR>STG.MAC.59, 17-May-78 16:21:18, EDIT BY MILLER
;MOVE STSBLK TO 110
;<4.MONITOR>STG.MAC.58, 17-May-78 15:31:39, EDIT BY MILLER
;ADD STSBLK. FIXED AT 107
;<4.MONITOR>STG.MAC.57, 17-May-78 13:33:10, Edit by ENGEL
;<4.MONITOR>STG.MAC.56, 16-May-78 14:32:02, EDIT BY MURPHY
;<MURPHY.MON>STG.MAC.3,  1-May-78 12:28:13, EDIT BY MURPHY
;TCO #1904 - WORKING SET SWAPPING
;<3A.MONITOR>STG.MAC.25, 12-Apr-78 17:23:19, EDIT BY MURPHY
;TCO #1901 - SCHEDULER CONTROLS FOR INTERACTIVE/COMPUTATIONAL BIAS
;<4.MONITOR>STG.MAC.45, 13-Apr-78 09:44:41, Edit by HALL
;CHANGE 'IFG ATS' TO 'IFN ATS'
;<3A.MONITOR>STG.MAC.28, 15-May-78 18:21:05, EDIT BY MILLER
;TCO 1186. DEFINE SWDST
;<4.MONITOR>STG.MAC.54, 15-May-78 17:39:13, Edit by HALL
;TCO 1900 - ADD SINM AND SOUTM ENTRY POINTS FOR NON-ATS MONITORS
;<4.MONITOR>STG.MAC.53, 15-May-78 12:27:09, Edit by ENGEL
;<4.MONITOR>STG.MAC.52, 15-May-78 11:02:16, Edit by ENGEL
;TCO 1900 - ADD ATSSRV QUEUE POINTERS
;<4.MONITOR>STG.MAC.51, 14-May-78 21:28:12, Edit by MCLEAN
;<2MCLEAN>STG.MAC.51, 14-May-78 21:23:39, Edit by MCLEAN
;<2MCLEAN>STG.MAC.50, 14-May-78 15:51:36, Edit by MCLEAN
;<2MCLEAN>STG.MAC.49, 11-May-78 02:02:15, Edit by MCLEAN
;ADDITIONS FOR GETOK/GIVOK
;<4.MONITOR>STG.MAC.49, 13-May-78 13:13:03, Edit by HALL
;TCO 1900 - DUMMY ATSINI FOR MONITORS WITH ATS=0
;<4.MONITOR>STG.MAC.48, 22-Apr-78 19:56:34, Edit by BORCHEK
;NNTBFS IS NOW IN PARAMS SO GET RID OF IT
;<3A.MONITOR>STG.MAC.26, 21-Apr-78 12:57:54, Edit by MCLEAN
;ADD CD20 STG FOR KS
;<3A.MONITOR>STG.MAC.25, 12-Apr-78 17:23:19, EDIT BY MURPHY
;TCO #1901 - SCHEDULER CONTROLS FOR INTERACTIVE/COMPUTATIONAL BIAS
;<4.MONITOR>STG.MAC.45, 13-Apr-78 09:44:41, Edit by HALL
;TCO 1900 - CHANGE 'IFG ATS' TO 'IFN ATS'
;<3A.MONITOR>STG.MAC.24, 10-Apr-78 21:48:01, Edit by MCLEAN
;<3A.MONITOR>STG.MAC.23, 10-Apr-78 21:44:24, Edit by MCLEAN
;INITALIZATION FOR KS CARDREADER
;<4.MONITOR>STG.MAC.43, 10-Apr-78 12:49:48, EDIT BY MILLER
;GET RID OF EDIT HISTORY. WAS CLOBBERED BY TECO SOMEHOW
;<4.MONITOR>STG.MAC.42,  7-Apr-78 10:49:03, EDIT BY MILLER
;**;[2868] Add 7 lines at SEARCH -2L	PED	15-NOV-82
DEFINE CPYRYT (FUNCT)<
	 FUNCT <
THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

COPYRIGHT (C) 1976,1977,1978,1979,1980,1981,1982,1983 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
>>


	SEARCH PROLOG,PHYPAR,SERCOD
	TTITLE STG

   IFN KLFLG,<
	SEARCH PROKL>
   IFN SMFLG,<
	SEARCH PROKS>


;PARAMETER-DEPENDENT STORAGE FOR ALL MODULES

EXT <PAGRST,PGRINI,TTINIT,SCDIN>
EXT <PI7P,PIAPR,PIINIT,PGRRST,SWPRST,PISC7,SCKATM>

	SWAPCD			;SOME SWAP CODE HERE BEFORE FIRST RESCD


;MISCELANEOUS DEFINITIONS

DEFINE NDG (SYM,VAL)<
   IFNDEF SYM,<
	SYM==:VAL>>

	DRSMDA==:30		;MAX SIZE OF A DIR ON A MODEL A
NDG	PIBITS,0		;PI ACCOUNTING BITS FOR KL METER
				; NOT USED ON OTHER PROCESSORS
NDG	BUGSTF,1		;BUGSTRINGS PRESENT
NDG	HIDSYM,1		;SYMBOLS NOT IN MONITOR VAS
				;USE /SYMSEG:PSECT:SYVAR IN LINK FILE IF OFF
				;USE /SYMSEG:PSECT:INCOD IN LINK FILE IF ON
NDG	EXADF,0			;EXTENDED DIRECTORY FLAG
NDG	NTTD10,0		;NUMBER OF DC10 LINES
   IFG DTFLG,<NDLL==:5>		;IF A FE PRESENT, MUST HAVE 5 DLS
   IFE DTFLG,<NDLL==:0>		;IF NO FE PRESENT, NDLL=0
	NTTFE==:NDHL+NDLL	;NUMBER OF FE LINES
;NUMBER OF LINES, INCLUDING LINE 0 FOR THE CTY
NDG	NLINES,NTTFE+NTTMCB+NTTPTY+NTTD10+NTTNVT+NTTDZ+1
   IFG ACTLNS-NLINES,<ACTLNS==:NLINES> ;ADJUST VALUE AS APPROPRIATE
NDG	DLSN,NTTD10		;NUMBER OF DC LINES
NDG	NTTBL,1			;DEFAULT NUMBER BUFFERS PER LINE
NDG	NTTBL1,2		;# OF BUFFERS FOR "FAST" LINES
NDG	NTTBF,ACTLNS*NTTBL1	;NUMBER OF TTY BUFFERS
NDG	TTSIZ,40		;SIZE OF INDIVIDUAL TTY BUFFER (POWER OF 4)
NDG TTBSIZ,200			;BIG BUFFER SIZE
NDG	DSKN,1			;DSK IS PRESENT (MANDATORY)
NDG	 RP10F,0		;DISK TYPE IS RP10
NDG	 RH10F,0		;RH10
NDG	 RH20F,1		;RH20
NDG	 RH11F,0		;RH11
NDG	  RP04F,1		;RP04
NDG	DRMN,0			;DRUM IS PRESENT
NDG	 RS04F,0		;DRUM TYPE IS RS04
NDG	 RC10F,0		;DRUM TYPE IS RC10
NDG	DTAN,0			;NUMBER OF dectape units
NDG	 TM02F,1		;TM02/TU16
IFN KLFLG,<NDG	DX20F,1		;DX20/TU70,71,72>
IFN SMFLG,<NDG	DX20F,0		;DX20/TU70,71,72>
NDG	PCDPN,1			;CARD PUNCH IS PRESENT BY DEFAULT
NDG	PLTN,0			; PHYSICAL Plotter exists
NDG	PTPN,0			; Paper tape punch exists
NDG	PTRN,0			; Paper tape reader exists
NDG	VBCN,0			;VB10C PRESENT
NDG	 NRVCPG,0		;NUMBER OF PAGES TO RESERVE FOR VB10C
NDG	DLXN,0			;NUMBER OF UNITS ON DL10
NDG	CMAN,0			;NUMBER OF AYDIN DISPLAYS
   IFG DLXN,<
	NDG	DLIBFP,<<DLXN+3>/4>	;# OF INPUT BUFFER AND CONTROL PAGES
	NDG	DLOBFP,<<DLXN+3>/4>	;  "  OUTPUT	"
   >;IFG DLXN


	DMSMAX==:1050		;LEGAL DMS JSYS'S ARE 1000-1050
	PRAMAX==:200		;MAXIMUM SIZE OF PRARG BLOCK

	SYSDPT==:777740		;DIRECTORY PROTECTION OF SYSTEM AND SUBSYS
	SYSFPT==:777752		;FILE PROTECTION DEFAULT FOR SUBSYS AND  SYSTEM

	PSNUM==:0		;PUBLIC STR NUMBER 
	USRLH==:500000		;LEFT HALF OF A 36 BIT USER NUMBER
	.DFACT==:^D220100	;DEFAULT ACCOUNT NUMBER

	DEFINE LOADMODULE (A) <
IRP A,<	EXTERNAL $'A>>
;section number definitions

NDG MSEC1,1			;section 1- code
NDG DRSECN,2			;section 2- directories
NDG IDXSEC,3			;section 3- index table
NDG BTSEC,4			;section 4- bit table
   IFE SMFLG,<
NDG ANBSEC,5			;section 5- arpanet buffers
   >
   IFN SMFLG,<
NDG ANBSEC,0			;so KS code doesn't break
   >
NDG MAXSEC,5			;max section number
	MSEC1B==:<MSEC1>B17	;DEFINE SECTION 1 PC FORMAT
;FORCE THE LOADING OF THE CORRECT MODULES

LOADMODULE <LDINIT,SCHED,PAGEM,FORK,MEXEC,SYSERR,COMND>
LOADMODULE <DEVICE,DIRECT,ENQ,FREE,FUTILI,GTJFN,IO,IPCF,JSYSA>
;**;[2001] Change 2 lines at LOADMODULE <JSYSF,...> +0L	JGZ	10-MAR-82
LOADMODULE <JSYSF,LOGNAM,LOOKUP,MSTR,SWPALC,DISC,FILMSC,MFLIN> ;[2001] 
LOADMODULE <MFLOUT,DATIME,TIMER,EDDT,MDDT> ;[2001] 

;CONDITIONALS TO LOAD PROPER REL FILE

IFNDEF PHYIOF,<	PHYIOF==:0>
   IFN DX20F!RP04F!TM02F,<	PHYIOF==:1>
IFG PHYIOF,<	
		LOADMODULE PHYSIO
		LOADMODULE DIAG
		LOADMODULE POSTLD
		LOADMODULE DSKALC
>
IFE EXADF,<	LOADMODULE FILINI>
IFN EXADF,<	LOADMODULE EFILIN>
IFG RH20F,<	LOADMODULE PHYH2>
IFG RH11F,<	LOADMODULE PHYH11>
IFG RP04F,<	LOADMODULE PHYP4>
IFG DRMN,<
 IFE PHYIOF,<
  IFG RS04F,<	LOADMODULE RS04SV>
 >
 IFG PHYIOF&RS04F,<	LOADMODULE PHYS4>
 IFG RC10F,<	LOADMODULE RC10SV>>
IFG CMAN,<	LOADMODULE DSPLAY>
IFG DLSN+DTEN,<
	IFE NETN,<	LOADMODULE TTYSRV>
	IFG NETN,<	LOADMODULE TTYSNV>
>
IFN SMFLG,<	
	IFE NETN,<	LOADMODULE TTYSSM>
	IFN NETN,<	LOADMODULE TTYASM>
>
IFG DTAN,<	LOADMODULE DECTAP>
IFG FEN,<	LOADMODULE FESRV>
IFG MTAN,<
	MTDFDN==:4		;DEFAULT MAGTAPE DENSITY (1600 BPI)
	MTDFRS==:PGSIZ*1	;DEFAULT RECORD SIZE IS 1000 WORDS
	MTDFDM==:1		;DEFAULT MAGTAPE DATA MODE IS CORE DUMP
	MTDFPA==:0		;DEFAULT MAGTAPE PARITY IS ODD
MTMXDN==:5			;MAXIMUM DENSITY IS 6250 BPI
	LOADMODULE MAGTAP
	LOADMODULE TAPE
	IFG DX20F,<LOADMODULE PHYX2>
	LOADMODULE PHYM2>
IFN SMFLG,<	LOADMODULE APRSSM>
IFE SMFLG,<	LOADMODULE APRSRV>
IFG DTEN,<	LOADMODULE DTESRV>
IFG DCN,<	LOADMODULE <NSPSRV,FILNSP,NSPINT>>
IFN ATS,<	LOADMODULE <FILATS,ATSSRV,NRMSRV>>
IFG KDPN,<	LOADMODULE KDPSRV>
IFN SMFLG,<	LOADMODULE DTESM>
IFE SMFLG,	<LOADMODULE LINEPR>
IFN SMFLG,	<LOADMODULE LINPSM>
IFG PCDPN,<	LOADMODULE CDPSRV>
IFG CDRN,<	
IFN SMFLG,<	LOADMODULE CDRSM>
IFE SMFLG,	<LOADMODULE CDRSRV>>
IFG PLTN,<	LOADMODULE PLT>
IFG PTPN,<	LOADMODULE PTP>
IFG PTRN,<	LOADMODULE PTR>
IFG VBCN,<	LOADMODULE VBC>
IFG DLXN,<	LOADMODULE DLX>
IFG NETN,<	LOADMODULE IMPDV
		LOADMODULE NETWRK
IFE SMFLG,<	LOADMODULE IMPANX>
IFN SMFLG,<	LOADMODULE IMAN22>
>
;RESIDENT STORAGE WHICH MUST BE DEFINED ON A PAGE BOUNDARY.
;THESE ARE ALL DEFINED FIRST AND MUST BE A MULTIPLE OF 512 WORDS
;EACH.

RS(ZROCOR,0)			;START OF STORAGE AREA TO CLEAR
RS(KIEPT,PGSIZ)			;EXECUTIVE PAGE TABLE
	EP==:KIEPT/PGSIZ	;DEFINE PAGE NUMBER FOR FILDDT
RS(SKHWPT,PGSIZ)		;HW PAGE TABLE WHEN SCHED RUNNING
RS(MMAP,PGSIZ)			;MONITOR MAP
   IFG DLXN,<
RS(DLBASE,PGSIZ*DLIBFP)	 ;RESIDENT PAGES FOR DL10
RS(DLOBUF,PGSIZ*DLOBFP)
   >;IFG DLXN
IFN SMFLG,<RS(LPBUF,LPTN*PGSIZ)>	;LINEPRINTER BUFFER SPACE
IFN NETN,<
IFN SMFLG,<RS(NTBFIX,0)>	;NO INDEX PAGE FOR NET BUFFER SECTION
IFE SMFLG,<RS(NTBFIX,PGSIZ)>	;INDEX PAGE FOR NET BUFFER SECTION
>
IFN KDPN,<RS(KMCPAG,KDPN*PGSIZ)>	;A PAGE FOR EACH KDP(KMC11/DUP11)

;MEMORY MANAGEMENT DATA BASE

RS CST0,MAXCOR			;CORE STATUS TABLES
	RS SPCRES,0		;END OF SPECIAL RESIDENT PAGES.
				;USED BY PAGEM CODE THAT
				;UNLOCKS PAGES. PUT ALL
				;SPECAIL PAGES (I.E. PAGE TABLES,
				;UPT'S) BEFORE THIS DEFINITION
RS CST1,MAXCOR
RS CST2,MAXCOR
RS CST3,MAXCOR
   IFN PHYIOF,<
RS CST5,MAXCOR		;**TEMP** UNTIL CSTONR MOVED
   >				;END IFN PHYIOF
RS SPTO,NOFN			;OFN TBALE ONLY
RS SPT,SSPT			;SPECIAL/SHARED PAGES TABLE
RS SPTH,SSPT
RS OSECTB,2			;STORAGE OF ORIGINAL MSECTB WORDS FOR EDDT
RS SSECTB,2			;NEW MSECTB WORDS FOR EDDT TO USE
RS TOTRC,1			;TOTAL NUMBER REAL CORE PAGES
RS NRPMIN,1			;MINIMUM VALUE OF NRPLQ
RS NRPLEV,1			;HIGHEST NORMAL LEVEL OF NRPLQ
RS GCMINP,1			;MIN PAGES NEEDED BY GC, = NRPMIN+NRPLEV
RS CGFLG,1			;DEASSIGNED PAGES MAY EXIST IF .G. 0

RS NRPLQ,1			;NUMBER OF PAGES ON REPLACABLE QUEUE
RS SRPLQ,1			;SWAP REPLACABLE QUEUE  TAIL,,HEAD
RS DRPLQ,1			;DISK REPLACABLE QUEUE  TAIL,,HEAD

;**;[7203] ADD DELPGQ STORAGE (FROM PAGEM.MAC)	DSW	11/21/81
RS DELPGQ,1			;QUEUE OF DELETED PAGES
RS NSPMQ,1			;NUMBER OF PAGES ON SPECIAL MEM QUEUE
RS SPMQ,1			;"SPECIAL" MEMORY QUEUE TAIL,,HEAD
RS SPMLCK,1			;LOCK ON PROCESS CONTEXT MANIPULATION OF SPMQ
RS SPMONR,1			;FORK WHICH OWNS SPMLCK
RS SPMTPG,1			;PAGE FOR SCHED TEST RTN
RS SPMTIM,1			;WATCHDOG TIME FOR SCHED TEST RTN
RS PI5CNT,1			;NUMBER OF UNVECTORED PI 5 INTERRUPTS
   IFE SMFLG,<
NMD16K==:<MAXCOR*PGSIZ+37777>/40000 ;MAX # MEM MODULES, 16K EACH
RS MEMTAB,<<NMD16K+^D35>/^D36>	;TABLE INDICATING INT/EXT MEM
   >				;END IFN SMFLG

;SYSTEM RESIDENT JOB TABLES

RS JOBDIR,NJOBS			;ATTACHED DIRECTORY,,LOGIN DIRECTORY
RS JOBNAM,NJOBS			;JOB BITS,,SUBSYS NAME INDEX
NR JOBPNM,NJOBS			;JOB PROGRAM NAME
RS JOBRT,NJOBS			;JOB RUN TIME
RS JOBRTL,NJOBS			;JOB RUN TIME LIMIT
	;DEFSTR JOBRTP,JOBRTL,35,23 ; Ptr to runtime limit blk
	;DEFSTR TIMCNT,JOBRTL,12,13 ; # of clocks in use by job
RS JOBPT,NJOBS			;CONTROL TTY,,TOP FORK

;QUOTA ENFORCEMENT TABLES

NR ALOC1,NOFN			;DIR # ,, OFN COUNT
NR ALOC2,NOFN			;COUNT OF PAGES LEFT

NR OFNLEN,NOFN			;ACTUAL END OF FILE

;GET FILE CACHE STORAGE

NDG FSMAX,20			;MAX NUMBER OF ENTRIES IN CACHE
;FSN==:3				;# OF WORDS PER ENTRY
NR FGLOCK,1			;THE LOCK WORD
NR FSTTBL,FSMAX			;NUMBER OF ENTRIES


;TIME ZONE STORAGE

NR TIMZON,1			;NUMBER OF HOURS LOCAL TIME LAGS GREENWICH


;MEMORY ERROR REPORTING STORAGE

RS ERRTBL,1			;QUEUE HEADER

;ARCHIVE SYSTEM

RS IPPKFR,1			; Flag word used to indicate ARCMSG
				; waiting for a free packet (IPCF)
;**;[7324] Remove 2 lines from IPPKFR:+1L	MDR	17-JUN-86
RS NRTWTS,1			; Should waits for retrievals fail?
				;  non-0 implies fail rather than wait
;CLASS SCHEDULER STORAGE

RS MJBUSE,1			;HIGHEST JOB IN USE
RS RDRTIM,1			;TIME TO DO NEXT REORDER
RS UTLTIM,1			;TIME TO COMPUTE UTILIZATION
RS UTLINT,1			;INTERVAL TO COMPUTE NEXT UTIL
RS OLDSLD,1			;PREVIOUS SOLD TIME
RS CLASSF,1			;IF NON-ZERO, DOING CLASSY SCHEDULING
RS CLSCTL,1			;CLASS CONTROL WORD
	NDG MAXCLS,10		;NUMBER OF CLASSES
RS CLSUTL,MAXCLS		;CLASS UTILIZATION
RS JOBCLS,NJOBS			;CLASS PER JOB
RS JOBUTL,NJOBS			;JOB UTILIZATION
RS JOBIRT,NJOBS			;JOB INCREMENTAL RUN-TIME
RS JOBDST,NJOBS			;JOB "DISTANCE"
;RS JOBSLD,NJOBS			;ACCUMULATED SOLD TIME PER JOB
RS CLSSHR,MAXCLS
RS WA,MAXCLS			;WINDFALL ALLOCATION (OR -1)
RS CLSSHI,MAXCLS		;SHARE PER MEMBER
RS CLSCNT,MAXCLS
RS CLSDST,MAXCLS		;CLASS DISTANCE
RS CLSSUM,MAXCLS		;INTEGRAL OF NRUN FOR CLASSES
RS CLSIRT,MAXCLS		;CLASS INCREMENTAL RUN TIME
;SYSTEM RESIDENT FORK TABLES
; STRUCTURE DEFINED FOR SOME VARIABLES BUT NOT PRESENTLY USED
; CONSISTENTLY THROUGHOUT CODE.

RS FKPGS,NFKS			;PTB,,PSB   SPT NUMBERS
	;DEFSTR FKPSB,FKPGS(FX),35,18
	;DEFSTR FKUPT,FKPGS(FX),17,18
RS FKSTAT,NFKS			;FORK WAIT TEST
RS FKPGST,NFKS			;TEST WORD WHILE IN PAGE WAIT
				;ALSO TOD ENTERED WAITLIST
RS FKQ1,NFKS			;REMAINING QUANTUM
	;DEFSTR FKQTM,FKQ1(FX),35,36
RS FKQ2,NFKS			;FORK SCHEDULING QUANTITIES
	;B0-B17 - FLAGS, MAX QUEUE, CURRENT QUEUE
;	B18-35 - FKWTL: LOC OF WAIT LIST PTR FOR BLOCKED FORK
RS FKBSPW,NFKS			; UNUSED ,, BALSET LIST PTR
RS FKSWP,NFKS			;SWAPPING DATA
	;B0-B5 - FLAGS; B18-B35 - FKHST: MEM DEMAND HISTORY
RS FKNBW,NFKS			;TIME OF START OF BALSET WAIT
RS FKJTQ,NFKS			; Jsys Traps queue of forks
				;  waiting to PSI their monitor
RS FKPT,NFKS			;BALSET ENTRY TIME ,, FORK QUEUE PTRS
	;DEFSTR FKBET,FKPT(FX),17,18
RS FKINT,NFKS			;FORK INTERRUPT COMMUNICATION REG
RS FKINTB,NFKS			;INTERRUPT CHANNELS REQUEST
RS FKJOB,NFKS			;JOB NUMBER ,, JSB
	;DEFSTR FKJSB,FKJOB(FX),35,18
	;DEFSTR FKJOBN,FKJOB(FX),17,18
RS FKNR,NFKS			;AGE,,BALANCE SET SIZE (RESERVE)
	;DEFSTR FKXAGE,FKNR(FX),8,9 ;AGE AT LAST XGC
	;DEFSTR FKAGE,FKNR(FX),17,9 ;CURRENT AGE
	;DEFSTR FKWSS,FKNR(FX),35,18 ;WORKING SET SIZE
RS FKWSP,NFKS			;WORKING SET PARAMETERS - NWSCE,,N
	;DEFSTR FKCSIZ,FKWSP(FX),35,18 ;CURRENT SIZE
				;ALSO LH USED WHILE ENTERING BALSET
RS FKTIME,NFKS			;TIME AT WHICH FORK WAS PUT ON CURRENT QUEUE
RS FKCNO,NFKS			; SPTN OF HWPT ,, CORE NUMBER
	;DEFSTR HWPTN,FKCNO(FX),17,18

;TABLES FOR SETNM

NNAMES==:^D40			;NUMBER OF NAMES ALLOWED

RS SNAMES,NNAMES		;SIXBIT NAME OF SUBSYSTEM
RS STIMES,NNAMES		;ACCUMULATED RUNTIME OF SUBSYSTEM
RS SPFLTS,NNAMES		;ACCUMULATED PAGE FAULTS OF SUBSYSTEM
RS SSIZE,NNAMES			;WORKING SET SIZE INTEGRAL
RS SNBLKS,NNAMES		;NUMBER OF BLOCKS
;MONITOR STATISTICS
;N.B. THIS TABLE IS AVAILABLE THROUGH GTTAB AND IS USED BY WATCH, EXEC, ETC.
;THE RELATIVE LOCATION OF WORDS WITHIN THE TABLE SHOULD NOT BE CHANGED.

NSTAT==:0			;COUNT NUMBER STAT WORDS

;SPECIAL VERSION OF RS FOR STAT WORDS - COUNTS TOTAL

DEFINE STATRS (SYM,NUM)<
	NSTAT=NSTAT+NUM
   RS SYM,NUM
   >

STATRS SKDTM0,1			;TIME SPENT IN SKDNUL WITH BALSET EMPTY
STATRS SKDTM1,1			;TIME SPENT IN SKDNUL WITH BALSET NON-EMPTY
STATRS SKDTM2,1			;TIME SPENT RUNNING SCHEDULER
STATRS SPTTIM,1			;TIME SPENT IN PAGER TRAP CODE

STATRS DRMRD,1			;NUMBER OF DRUM READS
STATRS DRMWR,1			;NUMBER OF DRUM WRITES
STATRS DSKRD,1			;NUMBER OF DISK READS
STATRS DSKWR,1			;NUMBER OF DISK WRITES

STATRS TTYBKS,1			;NUMBER OF TTY WAKEUPS
STATRS TTINTS,1			;NUMBER OF TERMINAL INTERRUPTS
STATRS BSTSUM,1			;INTEGRAL OF NBPROC DT
STATRS RJTSUM,1			;INTEGRAL OF NBPROC+NGOJOB DT

NRJAVS==:3			;NUMBER OF EXPONENTIAL AVERAGES MAINTAINED
STATRS RJAV,NRJAVS			;EXPONENTIAL AVERAGE OF NUMBER RUNNABLE FORKS

STATRS DSKWT,1			;SUM OF PROCESS DSK WAIT TIMES
STATRS DRMWT,1			;SUM OF PROCESS DRUM WAIT TIMES

STATRS NTTYIN,1			;TOTAL NUMBER TERMINAL INPUT CHARS
STATRS NTTYOT,1			;TOTAL NUMBER TERMINAL OUTPUT CHARS

STATRS NGCCOR,1			;COUNT OF GCCOR'S
STATRS GCCTIM,1			;INTEGRAL OF GCCOR TIME
STATRS NREMR,1			;COUNT OF WS REMOVALS WHILE RUNNABLE
STATRS BSWT,1			;SUM OF PROCESS WAIT TIMES

STATRS SKDOVH,1			;ACCUMULATED SCHED OVERHEAD TIME IN HP UNITS
STATRS SKDIDL,1			;ACCUMULATED IDLE TIME IN HP UNITS
STATRS SKDSWP,1			;ACCUMULATED SWAP-WAIT TIME IN HP UNITS
STATRS USRTIM,1			;ACCUMULATED USER TIME IN MILLISECONDS

STATRS HQFSUM,1			;INTEGRAL OF NHQFK DT
STATRS LQFSUM,1			;INTEGRAL OF NLQFK DT

STATRS DWRWT,1			;SUM OF PROCESS DISK WRITE WAIT
STATRS NAJBAL,1			;NUMBER OF FORCED AJBALS CALLS
STATRS SNRSUM,1			;INTEGRAL OF SUMNR
STATRS RPQSUM,1			;INTEGRAL OF NRPLQ
STATRS HSPTTM,1			;HP PAGER TRAP TIME
STATRS NCSWCH,1			;NUMBER OF CONTEXT SWITCHES
STATRS BGNDTM,1			;TIME DOING BACKGROUND STUFF (TTCH7, ETC.)

STATRS STRPCT,1			;SYSTEM TOTAL PAGE TRAPS
STATRS SRPQSC,1			;SYSTEM TOTAL "SAVES" FROM RPLQ
STATRS SGCCWR,1			;NUMBER WRITES FROM GCCOR

STATRS NWSSUM,1			;INTEGRAL OF NUMBER WS IN MEM
STATRS SKDFIL,1			;INTEGRAL OF WAIT TIME WO SWAP WAITS
STATRS NWSLOD,1			;COUNT OF WS LOADS
STATRS NREMJ,1			;COUNT OF BALSET REMOVALS WHILE RUNNABLE
STATRS SXGCWR,1			;NUMBER WRITES FROM XGC

;***** END OF STATISTICS TABLE *****

;LOAD AVERAGE COMPONENTS (GETAB TABLES)

RS CLSRJA,<MAXCLS*NRJAVS>	;RUN AVGS FOR CLASSES
RS HQLAV,NRJAVS			;HIGH-QUEUE AVERAGES
RS LQLAV,NRJAVS			;LOW-QUEUE AVERAGES

;**TEMP** 3A ONLY
RS(XB2RED,1)
RS(XB2WRT,1)
;**TEMP END**
;SCHED VARIABLES

NSKDP==:110			;SIZE OF SCHED PDL
RS SKDPDL,NSKDP			;SCHEDULER LOCAL PDL

RS SCKATM,1			;ALARM TIME - MIN OF ALL SCHED CLOCKS
RS OLDTCK,1			;  "
RS PISC7R,4
RS PI7AC1,2			;TEMPS AT PISC7
RS ALARMT,1			;MIN TIME OF FORKS ON CLKLST
RS SKDTHS,1			;TIME IN SCHED SO FAR THIS PASS
RS SKDLST,1			;LAST READING OF HP CLOCK
RS SKDLRT,1			;RUNTIME OF LAST TRIP THRU SCHEDULER
RS SNPSV1,1			;PLACE TO SAVE AN AC WHILE CHECKING PC
				; TO SEE IF IT IS IN A SNOOP BREAK POINT

RS FORKX,1			;INDEX OF CURRENTLY RUNNING FORK
RS FREJOB,1			;LIST OF FREE JOBS

RS WTLST,1			;WAITING FORK LIST
RS WT2LST,1			;WAITING FORKS TO BE WAKED BY UNBLK1
RS TTILST,1			;LIST OF FORKS WAITING FOR TTY INPUT
RS TTOLST,1			; .. .. TTY OUTPUT EVENTS
RS FRZLST,1			; .. .. UNFREEZING
RS TRMLST,1			; .. .. INFERIOR FORK TERMINATION
RS CLKLST,1			; .. .. CLOCK

RS JTLST,1			; JSYS traps queue
RS JTLSTL,1			; ... last; doubly linked list of forks
				; waiting on JTLCK to PSI some mon fork

RS GOLST,1			;RUNNABLE FORK LIST

RS JB0FLG,1			;RUN JOB 0 REQUEST
RS FRECB,1			;FREE CORE NUMBER BITS

RS FREFK,1			;LIST OF FREE FORKS
RS SYSIFG,1			;SYSTEM HAS BEEN INITIALIZED IF NOT 0
RS PWRDWN,1			;POWER FAILURE DETECTED IF .G. 0, DONE IF .L. 0
RS RLODPC,4			;PC'S FOR KEEP ALIVE RELOAD
RS FPTABL,MAXSEC+1		;PAGEM DISPATCH FOR SECTION NUMBERS
RS NBPROC,1			;NUMBER OF PROCESSES IN BAL SET
RS NBWT,1			;NUMBER WAITING PROCESSES IN BALSET
RS NBSWP,1			;NUMBER FORKS IN SWAP WAIT
RS MAXBP,1			;MAX NUMBER OF JOBS IN BAL SET
RS BSQNT0,1			;VALUE OF BSQNT AT START OF LAST RUNNING

RS SUMNR,1			;SUM OF RESERVE PAGES, ALL PROCESSES IN MEM
RS SUMBNR,1			;SUM WORKING SETS IN BALSET
RS NWSEPG,1			;NUMBER PAGES WSETS ENTERING MEMORY
RS BALSHC,1			;COUNT OF PAGES IN BALSET BECAUSE OF SHARING
RS NXTCNF,1			;NEXT FORK TO CHECK - GCNO
RS RELCB,1			;MASK OF CORE NUMBERS RELEASED BUT NOT CLEARED
RS MAXNR,1			;MAX VALUE OF SUMNR
RS MAXHNR,1			;MAX NR OF BALSET HOLDING FORKS
RS BSLST,1			;LIST OF BALSET HOLDING FORKS
RS NBSL,1			;NUMBER OF BALSET HOLDING FORKS
RS NEBAL,1			;NUMBER OF PROCESSES NOW ENTERING BALSET
RS REMFGS,1			;FLAGS SET ON REMBSJ/REMBSF

RS NPMAX,1			;MAX NUMBER OF PAGES IN CORE FOR ONE PROCESS
RS SNPMAX,1			;SMALL NPMAX FOR LOADED CONDITIONS
RS IRJAV,1			;NEAREST INTEGER TO RJAV
RS WSMTIM,1			;TIME FOR NEXT WSMGT
RS RWSOKF,1			;FLAG - OK TO DO REMWS
RS NWSMEM,1			;NUMBER WS IN MEM

RS NHQFK,1			;NUMBER FORKS ON .L. MAXQ
RS NLQFK,1			;NUMBER FORKS ON MAXQ
;SCHEDULER VARIABLES

RS SCHFLG,1			;PERMANENT SCHEDULER FLAGS
RS SKEDF1,1			;START PROCESS VIA CH7 BREAK IN 1
RS SKEDF3,1			;PROCESS CLOCK COUNTED TO 0
RS SKEDFC,1			;FORCE CLEAR OF BALSET & MEMORY
RS INSKED,1			;IN SCHEDULER IF NON-ZERO
RS SSKED,1			;LAST JOB RUNNING WAS NOSKED
RS SETPAG,1		;TEMP FOR SETTING PAGER AT SCDR
RS RSKCHK,4			;XPCW DESTINATION

RS PSKED,1			;PAGE TRANSFER COMPLETED
RS QSKED,1			;BLOCKED FORK NOW UNBLOCKED IF .G. 0
RS TSKED,1			;TTY OUTPUT EVENT IF .N. 0
RS BSKED,1			;FORK VOLUNTARILY LEFT BALSET IF .G. 0

RS NGOJOB,1			;NUMBER OF RUNNABLE JOBS

RS RJTTIM,1			;TIME AT LAST UPDATE TO RJTSUM
RS RJATIM,1			;TIME OF NEXT RJAV UPDATE
RS RJAVS1,1			;RJTSUM AT LAST RJAV UPDATE
RS RJAVS2,1			;HQFSUM AT LAST RJAV UPDATE
RS RJAVS3,1			;LQFSUM AT LAST RJAV UPDATE

;CLOCKS COUNTED DOWN AND TESTED, PARALLEL TO PCLKT, DON'T REORDER

RS BSQNT,1			;RUNNING JOB REMAINING QUANTUM
RS TIM1,1			;SCHED FAST CLOCK
RS TIM2,1			;SECOND CLOCK, 100 MS

RS FKT0,1			;CLOCK AT START OF RUNNING
RS FKT1,1			;TIME USED SINCE SETRT
RS TIM0,1			;TODCLK AT LAST C1STAT

RS SCDRQI,1			;SCHEDULER REQUEST QUEUE
RS SCDRQO,1
NSCDRQ==:^D33			;SIZE OF SCHED REQUEST QUEUE
RS SCDRQB,NSCDRQ

RS TODCLK,1			;MILLISECOND CLOCK, MONOTONICALLY INCREASING
RS TODPWL,1			;TIME OF DAY (IN SECONDS) BY POWER LINE CLOCK
RS CHKTIM,1			;TIME AT WHICH JOB 0 CONSIDERED OVERDUE

RS SCDRN1,1			;RUN ONLY JOB N IF N .G. -1
;DIRECTORY RELATED STORAGE

	RS MXDIRN,1		;MAXIMUM DIRECTORY NUMBER
	RS NDIRPG,1		;MAX # OF PAGES FOR A DIRECTORY FILE
	RS FBTSIZ,1		;SIZE OF FREE BIT TABLE BLOCK

RS IDXORA,1			;WORD CONTAINING START OF INDEX TABLE
RS DIRORA,1			;WORD CONTAINING BASE ADR OF MAPPED DIR
NDG DIRRDM,777777777700		;DEFAULT MASK FOR DIRECTORY READ UPDAATE
RS DIRRDU,1			;READ UPADTE MASK
RS DIRCLK,1			;DIRECTORY CACHE LOCK
NDG	DIRCSZ,^D25		;DIRECTORY CACHE SIZE
RS DIRCSH,DIRCSZ*5		;DIRECTORY CACHE TABLE
RS BTBORA,1			;WORD CONTAINING BASE ADR OF MAPPED BIT TABLE

;MISC STORAGE

;SYSTEM STARTUP FLAG. REPLACES DIDSCA AND STOKF

RS STARTF,1
NR (JB0XFR,1)			;WHERE TO GO ON ERROR IN FORK 0
;STORAGE FOR BUGHLT AND BUGCHK

RS BUGHLT,2
RS SVVEXM,1			;SAVE VALID EXAMINE IN BUGTYO
				;USED IN KS10 TO SAVE KEEPALIVE WORD
RS BUGLCK,1			;LOCK ON BUGXXX ROUTINES
RS BUGCHK,2
RS BUGINF,2			;INFORMATIONAL BUGCHK

RS BUGACS,20			;ACS
RS BUGACU,20			;PLACE TO SAVE PREV CONTEXT ACS
	BUGPLN==:^D12		;PUSH DOWN LIST SIZE
RS BUGPDL,BUGPLN		;PUSH DOWN LIST
	BUGMAX==:5		;DONT LET MORE THAN 5 IN QUEUE
RS BUGCNT,1			;COUNT OF BUG BLOCKS IN QUEUE
RS BUGNUM,1			;NUMBER OF BUG CHECKS SINCE STARTUP
RS BUGSEB,1			;SYSERR BLOCK POINTER
RS BUGP,1			;PLACE TO STORE P DURING BUG HLT/CHK
RS BUGP1,1
RS BUGP2,1
RS BUGP3,1
RS BUGTMS,1			;TIME TO STORE NEXT BUGTIM
	BUGINT==:^D<5*60000>	;INTERVAL FOR STORING BUGTIM-5 MINUTES
RS BUGTIM,4			;ASCII TIME AND DATE STORED FOR BUGHLT


;STORAGE FOR THE UTEST JSYS

RS UTLOCK,1			;CONTAINS THE FORK # OF OWNER
RS UTBASE,1			;THE STARTING ADR OF ROUTINE BEING TESTED
RS UTLEN,1			;THE NUMBER OF WORDS BEING TESTED
UTNPG==:2			;NUMBER OF PAGES OF STORAGE SPACE
NUTWDS==UTNPG*PGSIZ		;WORDS OF BUFFER SPACE FOR UTEST
NRP UTPGS,NUTWDS		;BUFFER SPACE
;STORAGE FOR TTYSRV

NCHBF==:<TTSIZ-1>*4		;NUMBER OF CHARS IN 1 BUFFER

;TTY BUFFERS--INPUT, OUTPUT, AND ECHO
;BUFFERS ARE OF SIZE TTSIZ, AND START AT LOCATIONS N*TTSIZ+1

RS TTBUFS,NTTBF*TTSIZ+TTSIZ

;WORD THAT CONTAINS THE UNIT NUMBER ON THE .FEDLS DEVICE BY WHICH
;THE FRONT END KNOWS THE CTY.  USED IN IDCTY.

	RS CTYINT,1

RS TCOERR,1			;TCOUT SETS THIS IF FAILS IN SCHEDULER CONTEXT
RS SALCNT,1			;COUNT OF LINES DOING SENDALL

;STORAGE

RS TTFREC,1			;COUNT OF FREE BUFFERS
RS TTFREB,1			;LIST OF FREE BUFFERS
NTSQWD==:<NLINES+^D35>/^D36	;NUMBER OF WORDS IN START OUTPUT QUEUE
RS TTSOQ,NTSQWD			;START OUTPUT QUEUE, ONE BIT PER LINE
RS PTYSTM,1			;PTY START TIME

;BIG BUFFER

RS TTBIGI,1			;INPUT INDEX
RS TTBIGO,1			;OUTPUT INDEX
RS TTBIGC,1			;COUNT
RS TTBBUF,TTBSIZ		;BUFFER
RS TTQCNT,1			;COUNT OF SPECIAL LINE ITEMS

RS TTCQLN,1			;CONTROL OP CURRENT LINE NUMBER
RS TTHNGL,1			;LINE BEING EXAMINED FOR HUNG
RS TTHNGT,1			;TIME AT WHICH LINE WILL BE DEFINED AS HUNG
RS TTHNGN,1			;LAST HUNG LINE ,, NUMBER UNHANGS DONE
RS LINKF,1			;LINKED OUTPUT CHAR IN NOT 0
RS IMECHF,1			;IMMEDIATE ECHO OUTPUT CHAR IF NON-0
RS TTCHIC,1			;INPUT CHARACTER IN TTCHI
   IFN SMFLG,<RS DZCHCT,1>	;"CLOCK" FOR DZ11 PI CHECK
   IFG DTFLG!SMFLG,<		;FOR FE CONFIGURATIONS
SNDSIZ==:41			;SIZE FOR A SEND ALL BUFFER
RS SNDALL,SNDSIZ		;ALLOCATE THE BUFFER
>
RS TTSTAT,NLINES		;STATIC DATA
RS TTACTL,NLINES		;POINTER TO DYNAMIC DATA
RS TTSPWD,NLINES		;INPUT,,OUTPUT SPEEDS
RS TTCSAD,NLINES		;ROUTINE FOR SCHEDULER TO CALL
RS TTCSTM,NLINES		;TIME TO CALL ROUTINE IN TTCSAD
;**;[1820] Insert several lines at RS TTCSTM + 1L	DAD	15-DEC-80
IFN SMFLG,<RS DZSPWD,NLINES>	;[1820] SPECIAL SPEED WORD FOR DZ11 LINES
				;[1820] THIS TABLE MIRRORS TTSPWD FOR FRONT-END
				;[1820] LINES. THIS TABLE CONTAINS THE CURRENT
				;[1820] SPEED FOR ANY GIVEN DZ11 LINE...TTSPWD
				;[1820] CONTAINS THE PERMANENT SPEED FOR REMOTE,
				;[1820] NON-AUTOBAUD LINES. .MORSP FUNCTION OF 
				;[1820] MTOPR RETURNS THE SPEED FROM DZSPWD AND
				;[1820] NOT TTSPWD FOR KS10'S.

;STORAGE FOR STRING CONTAINING VERSION AND NAME OF MONITOR
NR SVN,NSVNT			;TEXT IS READ FROM SYSTEM:MONNAM.TXT
				; OR DEFAULTED TO A PREASSEMBLED STRING
				; AT TSVN
;DISK SIZE DATA DESCRIBING ALL KNOWN DISK TYPES
;THE ACTUAL TABLES ARE IN RESIDENT STORAGE AND ARE DEFINED LATER IN
;THIS MODULE.  DSKSZ0 CONTAINS THE RP04/RP05 DATA; DSKSZ1 CONTAINS THE
;RP06 DATA.,2; DSKSZ2 CONTAINS RP07 DATA AND DSKSZ3 CONTRAINS
;RM03 DATA;; AND DSKSIZ CONTAINS POINTERS TO THESE TABLES.

IFN RP04F,<

NWSEC==:200			;NUMBER OF WORDS PER SECTOR
;PGSIZ==:1000			;WORDS PER PAGE - DEFINED IN PROLOG

;DATA FOR RP04 AND RP05

SECPG0==PGSIZ/NWSEC		;SECTORS PER PAGE
LPPCT0==0			;LOST SECTORS PER CYL
SECSF0==^D20			;SECTORS PER SURFACE
SECCY0==^D19*SECSF0		;SECTORS PER CYLINDER
PAGCY0==SECCY0/SECPG0		;PAGES PER CYLINDER
CYLUN0==^D400			;CYLINDERS PER UNIT
SECUN0==SECCY0*CYLUN0		;SECTORS PER UNIT
BTWCY0==<PAGCY0+^D35>/^D36	;NUMBER BIT WORDS IN BIT TABLE FOR A CYLINDER
MINFP0==PAGCY0/3		;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
				; IN DSKASN
MAXFP0==PAGCY0*CYLUN0		;PAGES PER UNIT FOR DAKASN TURNING POINT
USSCU0==^D13			;MICROSECONDS PER LATOPT UNIT


;DATA FOR RP06

SECPG1==PGSIZ/NWSEC		;SECTORS PER PAGE
SECSF1==^D20			;SECTORS PER SURFACE
SECCY1==^D19*SECSF1		;SECTORS PER CYLINDER
PAGCY1==SECCY1/SECPG1		;PAGES PER CYLINDER
CYLUN1==^D800			;CYLINDERS PER UNIT
SECUN1==SECCY1*CYLUN1		;SECTORS PER UNIT
LPPCT1==0			;LOST SECTORS PER CYL
BTWCY1==<PAGCY1+^D35>/^D36	;NUMBER OF BIT WORDS PER CYLINDER IN BIT TABLE
MINFP1==PAGCY1/3		;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
				; IN DSKASN
MAXFP1==PAGCY1*CYLUN1		;PAGES PER UNIT FOR DSKASN TURNING POINT
USSCU1==^D13			;MICROSECONDS PER LATOPT UNIT

;DATA FOR RP07

SECPG2==PGSIZ/NWSEC		;SECTORS PER PAGE
SECSF2==^D30			;SECTORS PER SURFACE
SECCY2==^D30*SECSF2		;SECTORS PER CYLINDER
PAGCY2==SECCY2/SECPG2		;PAGES PER CYLINDER
CYLUN2==^D558			;CYLINDERS PER UNIT
SECUN2==SECCY2*CYLUN2		;SECTOR PER UNIT
LPPCT2==0			;LOST SECTORS PER CYL
BTWCY2==<PAGCY2+^D35>/^D36	;NUMBER F BIT WORDS PER CYLINDER IN BIT TABLE
MINFP2==PAGCY2/3		;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
				; IN DSKASN
MAXFP2==PAGCY2*CYLUN2		;PAGES PER UNIT FOR DSKASN TURNING POINT
USSCU2==^D8			;MICROSECONDS PER LATOPT UNIT
;DATA FOR RM03

SECPG3==PGSIZ/NWSEC		;SECTORS PER PAGE
LPPCT3==2			;LOST SECTORS PER CYL
SECSF3==^D30			;SECTORS PER SURFACE
SECCY3==<^D5*SECSF3>-LPPCT3	;SECTORS PER CYLINDER
PAGCY3==SECCY3/SECPG3		;PAGES PER CYLINDER
CYLUN3==^D820			;CYLINDERS PER UNIT
SECUN3==SECCY3*CYLUN3		;SECTORS PER UNIT
BTWCY3==<PAGCY3+^D35>/^D36	;NUMBER OF BIT WORDS PER CYLINDER IN BITTABLE
MINFP3==PAGCY3/3		;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
MAXFP3==PAGCY3*CYLUN3		;PAGES PER UNIT FOR DSKASN TURNING POINT
USSCU3==^D8			;MICROSECONDS PER LATOPT UNIT

BTBMAX==:15000			;MAXIMUM WORDS AVAILABLE FOR BIT TABLE
BTBTOP==:3100			;SIZE OF TOP HALF FOR OLD DISKS
BTBBOT==:11300			;SIZE OF BOTTOM HALF FOR OLD DISKS

;BIT TABLE

RS BTBSIZ,1			;MAXIMUM WORDS AVAILABLE FOR BITTABLE
BTBLEN==:BTBMAX		;LENGTH OF BITTABLE IF IN SECTION 0
IFN NETN!EXADF,<IFE SMFLG,<BTBLEN==:0>> ;DO NOT RESERVE SPACE IN SECTION 0
NRP BTB,BTBLEN

;NOTE THAT THE OLD ASSUMPTION THAT SOME CYLINDERS ARE NOT AVAILABLE
;FOR FILES HAS BEEN REMOVED.  LOTRK (THE FIRST AVAILABLE CYLINDER) IS
;NOW ALWAYS 0, AND HITRK (THE HIGHEST AVAILABLE CYLINDER) IS THE LAST
;CYLINDER IN THE STRUCTURE, WHICH IS CONTAINED IN SDBCYL IN THE SDB

LOTRK==:0
>
RS BTBLCK,1			;BIT TABLE LOCK
RS DERRHD,1			;HEADER FOR BAT BLOCK QUEUE
ERRLNK==:4			;OFFSET IN ERROR NODE FOR THE LINK

;VARIABLES HOLDING PARAMETERS OF PUBLIC STRUCTURE


RS NSSUN,1			;# OF SWAPPING SECTORS PER UNIT
RS FSSUN,1			;FIRST SWAPPING SECTOR ON UNIT 


;VARIABLES USED BY FSI ROUTINES

RS FSIBLK,20			;TEMPORARY BLOCK
RS FEFSIZ,1			;SIZE OF FRONT END FILE SYSTEM IN PAGES
RS BOTSIZ,1			;SIZE OF BOOTSTRAP.BIN IN PAGES
NPGSFE==:NTRFE*PAGCY0		;DEFAULT NUMBER OF PAGES IN FE FILE SYSTEM
NPGSBT==:NTRBT			;DEFAULT NUMBER OF PAGES IN BOOTSTRAP.BIN

DSKMSK==:777774			;BITS NOT USED IN LH OF DISK ADDRESS

;HOME BLOCKS

IFN RP04F,<
HOME::	0			;BOOT STRAP FOR THE 11
	1			;HOME BLOCK
	2			;BAT BLOCK
	3			;RESERVED
	4			;RESERVED
	5			;RESERVED
	6			;RESERVED
	7			;RESERVED
	10			;RESERVED
	11			;RESERVED
	12			;SECONDARY HOME BLOCK
	13			;SECONDARY BAT BLOCK
NHOME==:.-HOME
>


;DO NOT REORDER ERROR WORDS, USED BY GETAB

NDSKEW==:^D10			;NUMBER OF ERROR WORDS FOR GETAB

RS DSKRCE,1			;COUNT OF RECOVERABLE ERRORS
RS DSKRER,4			;COMMAND WORDS AND ERROR BITS OF LAST ERROR
RS DSKNRE,1			;COUNT OF NON-RECOVERABLE ERRORS
RS DSKLER,4			;COMMAND WORDS AND ERROR BITS LAST NON-REC ERR
RS DSPSFK,1			;FORK,,PSI FOR DISK ONLINE/OFFLINE INTERRUPT

;PARAMETERS FOR THE BAT BLOCK ERROR QUEUE

NODSIZ==:5			;SIZE OF AN ENTRY
MAXNOD==:^D10			;NUMBER IN FREE POOL
RS IOERRQ,MAXNOD*NODSIZ		;ALLOCATE THE POOL
RS IOERRH,1			;THE QUEUE HEADER

;BAT BLOCK VARIABLES

CODBAT==:606060			;UNLIKELY CODE IN BATCOD
MAXBFR==:^D61*2			;MAX FREE SPACE IN BAT BLOCK
MAXBAD==:^D511			;MAX BAD SPOTS IN A BAD PAIR
BAT1P==:4			;OFFSET OF FIRST BAD PAIR
;STRTAB AND SDB DEFINITIONS

NR (UCSEED,1)			;SEED FOR UNIQUE CODE FOR EACH STRUCTURE
NR (STRLOK)			;LOCK FOR THE DISMOUNT CODE

NDG STRN,^D16			;MAXIMUM NUMBER OF STR'S ALLOWED
RS STRTAB,STRN			;TABLE OF POINTERS TO SDB'S

NDG MXSTRU,4			;MAX # OF PACKS IN A STRUCTURE
				; (ASSUMES RP04'S, USED TO LIMIT SDBUDB)
HOMTBL==:MXSTRU			;LENGTH OF HOMTAB
	MXPGUN==:<HOMTBL*PAGCY0*CYLUN0> ;MAX DISK ADDRESS
RS HOMTAB,HOMTBL		;LOGICAL TO PHYSICAL MAPPING
				; (CHANNEL,,UNIT) PER LOGICAL UNIT


;SDB - STRUCTURE DATA BLOCK FORMAT

SDBNAM==:0			;STRUCTURE NAME
SDBNUM==:1			;NUMBER OF UNITS IN STRUCTURE
SDBSIZ==:2			;SIZE IN SECTORS OF EACH UNIT IN STR
SDBSTS==:3			;STATUS FLAGS,,INITING FORK
SDBRXB==:4			;ADDRESS OF ROOT DIR INDEX BLOCK
SDBBXB==:5			;ADDRESS OF BACKUP COPY OF ROOT DIR
SDBNSS==:6			;NUMBER OF SWAPPING SECTORS PER UNIT
SDBFSS==:7			;FIRST SWAPPING SECTOR PER UNIT
SDBBTB==:10			;OFN OF BIT TABLE
SDBFRC==:11			;COUNT OF FREE PAGES ON STRUCTURE
SDBIDX==:12			;HANDLE'S OF INDEX TABLE AND ROOT-DIRECTORY
SDBLDN==:13			;LAST DIRECTORY NUMBER ON THIS STRUCTURE
SDBLCA==:14			;LAST CYLINDER ASSIGNED BY DSKASN
SDBCYL==:15			;TOTAL CYLINDERS IN STRUCTURE
SDBBT0==:16			;LENGTH OF TOP HALF OF BIT TABLE
SDBBT1==:17			;LENGTH OF BOTTOM HALF OF BIT TABLE
SDBTYP==:20			;ADDRESS OF DSKSIZ TABLE FOR THIS TYPE OF DISK
SDBFLK==:21			;FILE LOCK COUNT,,UNIQUE CODE
SDBCNT==:22			;MOUNT COUNT,,OPEN FILE COUNT
SDBPUC==:23			;PACK UNIQUE CODE FOR MEDIA IDENTIFICATION
SDBOMF==:24			;ORIGINAL MINIMUM FREE PAGES LIMIT
SDBMXF==:25			;BOUNDRY ABOVE WHICH SDBMFP=SDBOMF
SDBMFP==:26			;MIN FREE PAGES BELOW WHICH DSKASA
				;CHANGES ASSIGNMENT ALGORITHM
SDBUDB==:27			;FLAGS,,POINTERS TO UDB'S

SDBLN==:SDBUDB+MXSTRU		;LENGTH OF ONE SDB
RS SDBBL0,SDBLN			;STRUCTURE DATA BLOCK FOR PS
;STORAGE FOR RESIDENT FREE SPACE POOL

	.RESP1==:0		;HIGHEST PRIORITY, ALWAYS TRY TO ASSIGN SPACE
				;NO PAGE FAULTS ALLOWED
	.RESP2==:1		;SECOND LEVEL, NO PAGE FAULTS ALLOWED
				;BUT DONT ASSIGN SPACE IF BELOW RESMIN
	.RESP3==:2		;PROCESS CONTEXT. PAGE FAULTS ALLOWED.
				;LOCK DOWN MORE SPACE IF NECESSARY

	.RESGP==:0		;GENERAL RESIDENT FREE SPACE POOL
	.RESTP==:1		;TERMINAL POOL
	.RESNP==:2		;NETWORK POOL
	.RSTMP==:3		; TIMER pool

	RESQTL==:4		;NUMBER OF POOLS OF RESIDENT FREE SPACE

	.RESGQ==:10000		;GENERAL QUOTA - USED BY PHYSIO FOR UDBS
				;   CDBS, KDBS, AND FOR SDBS.
				;   APPROXIMATELY 8 CHANNELS, 40 DRIVES,
				;   AND 16 ONLINE STRUCTURES
	.RESTQ==:40*ACTLNS	;TERMINAL QUOTA - USED BY TTYSRV
	.RESEQ==:1000		;ERROR QUOTA - USED BY ALCSEB (SYSERR)
	.RESNQ==:^D<50*2*40>	;NETWORK QUOTA - MESSAGE SIZE * ( # OF
				;   INPUT MESSAGES + # OF OUTPUT MESSAGES)
				;   * # OF ACTIVE LINKS
	IFN <ATS*SMFLG>,<.RESNQ==:.RESNQ+^D1000>
				;Increase buffers for DDCMP on 2020 with ATS
	.RSTMQ==:3*^D8*NJOBS	; For TIMER 3 per job, 8 words each
	RESFRM==:400/4		;BLOCKS GUARANTEED FOR .RESP1 REQUESTS
	RESFRA==:RESFRM*3	;AVERAGE AMOUNT OF FREE SPACE LOCKED DOWN
	RESFRB==:RESFRA+^D25	;SMALL INCREMENT OVER RESFRA FOR
				; JOB 0 COMPLETION

RS RESMIN,1			;MINIMUM LEVEL FOR ALL BUT LEVEL 1 REQUESTS
RS RESAVE,1			;AVERAGE AMOUNT OF FREE SPACE LOCKED
RS UPRSAV,1			;LIMIT FOR JOB 0 ACTIVITY
RS RESFRE,1			;COUNT OF FREE BLOCKS LEFT
RS RESFFB,1			;FIRST FREE 4 WORD BLOCK
RS RESIFL,1			;INITIALIZATION FLAG = -1 DURING STARTUP
	NRESFP==:2*<.RESGQ+.RESTQ+.RESNQ+.RSTMQ>/3000
				;# OF PAGES IS 2/3 OF SUM OF QUOTAS
	NRESFB==:NRESFP*PGSIZ/4	;NUMBER OF RESIDENT FREE 4 WORD BLOCKS
NRP RESFRP,<NRESFP*PGSIZ>	;RESERVE SPACE FOR RESIDENT FREE POOL
	RESFRZ==:RESFRP+<NRESFP*PGSIZ>-1 ;END OF RESIDENT FREE POOL
	RESBTL==:<NRESFP*PGSIZ/4+^D35>/^D36 ;LENGTH OF BIT TABLE
RS RESBTB,RESBTL		;RESIDENT FREE SPACE BIT TABLE
RS RESBAS,1			;BASE ADDRESS OF THE RESIDENT FREE POOL
RS RESUTB,RESQTL		;RESIDENT FREE SPACE USAGE TABLE
INTERN NDEV,DVXTT0

; Initial device tables used to initialize the working device tables

;CHARACTERISTICS DEFINITIONS AND MODE DEFINITIONS

DSCHR==DV%OUT!DV%IN!DV%DIR!DV%MDD
STRCHR==DV%OUT!DV%IN!DV%DIR!DV%MDD
DSCH1==0
STRCH1==0
DSMOD==DV%M0!DV%M1!DV%M2!DV%M3!DV%M4!DV%M5!DV%M6!DV%M7!DV%M10!DV%M11!DV%M12!DV%M13!DV%M14!DV%M15!DV%M16!DV%M17

MTCHR==DV%OUT!DV%IN!DV%AS
MTCH1==0
MTMOD==DV%M0!DV%M17

DTCHR==DV%MDV!DV%OUT!DV%IN!DV%DIR!DV%AS
DTCH1==0
DTMOD==DV%M0!DV%M17

   IFG FEN,<
FECHR==DV%IN!DV%OUT!DV%AS
FECHR1==0
FEMOD==DV%M0>

PRCHR==DV%IN!DV%AS
PRCH1==0
PRMOD==DV%M0!DV%M1!DV%M10!DV%M13!DV%M14

PPCHR==DV%OUT
PPPCHR==DV%OUT!DV%AS
PPCH1==D1%SPL
PPPCH1==0
PPMOD==DV%M0!DV%M1!DV%M10!DV%M13!DV%M14

VBCHR==DV%OUT!DV%IN!DV%AS
VBCH1==0
VBMOD==DV%M0!DV%M17


   IFG CDRN,<
CDRCHR==DV%IN!DV%AS
CDRCH1==0
CDRMOD==DV%M0!DV%M10
   >
LPCHR==DV%OUT
PLPCHR==DV%OUT!DV%AS
LPCH1==D1%SPL
PLPCH1==0
LPMOD==DV%M0

CRCHR==DV%IN
CRCH1==D1%SPL
CRMOD==DV%M0

CPCHR==DV%OUT			;SPOOLED CARD PUNCH
CPCH1==D1%SPL
CPMOD==DV%M0+DV%M10

PCPCHR==DV%OUT!DV%AS			;PHYSICAL CARD PUNCH
PCPCH1==0
PCPMOD==DV%M0

TTYCHR==DV%OUT!DV%IN!DV%AS
TTYCH1==0
TTYMOD==DV%M0!DV%M10

PTYCHR==DV%OUT!DV%IN!DV%AS
PTYCH1==0
PTYMOD==DV%M0

NULCHR==DV%OUT!DV%IN
NULCH1==0
NULMOD==DV%M0!DV%M1!DV%M2!DV%M3!DV%M4!DV%M5!DV%M6!DV%M7!DV%M10!DV%M11!DV%M12!DV%M13!DV%M14!DV%M15!DV%M16!DV%M17

NETCHR==DV%OUT!DV%IN!DV%DIR
NETCH1==0
NETMOD==DV%M0!DV%M5!DV%M6!DV%M7

PLCHR==DV%OUT
PPLCHR==DV%OUT!DV%AS
PLCH1==D1%SPL
PPLCH1==0
PLMOD==DV%M0

DLXCHR==DV%IN!DV%OUT!DV%AS
DLXCH1==0
DLXMOD==DV%M0

DCNCHR==DV%IN!DV%OUT
DCNCH1==0
DCNMOD==DV%M0

;DEFINITIONS FOR APPLICATIONS TERMINALS

ATSCHR==DV%IN!DV%OUT
ATSCH1==0
ATSMOD==DV%M0

;DEFINITIONS FOR CMA DEVICE (AYDIN DISPLAY)
CMCHR==DV%OUT!DV%AS
CMCH1==0
CMMOD==DV%M17
DEFINE DV (NAME,UNITS,TYPE,DISP,CHAR1,CHAR2,MODES,CHAR3)<
	SIXBIT /NAME/
	XWD NDEV,DISP
	EXP CHAR1!<TYPE>B17!MODES
	EXP CHAR2+CHAR3+UNITS
   IFE UNITS,<NDEV==:NDEV+1>
NDEV==:NDEV+UNITS>
DVTSTP==:4			;STEP SIZE FOR INIDVT TABLE

;DEVICE INITIALIZATION TABLE (LOADED IN SWAPPABLE CODE SEGMENT)

NDEV==:0

INIDVT::	DV(DSK,0,0,DSKDTB,DSCHR,DSCH1,DSMOD,0) ;DSK ALWAYS EXISTS
DVXST0==:NDEV
		DV(STR,STRN,0,DSKDTB,STRCHR,STRCH1,DSMOD,0)
DVXSTN==:NDEV
IFG MTAN,<
	DV(MTA,MTAN,2,MTADTB,MTCHR,MTCH1,MTMOD,0) ;MAGTAPE
	DV(MT,MTAN,2,MTDTB,MTCHR,MTCH1,MTMOD,DV%PSD)	;MT (FOR USER)
>
IFG DTAN,<	DV(DTA,DTAN,3,DTADTB,DTCHR,DTCH1,DTMOD,0)> ;DECTAPE
IFG PTRN,<	DV(PTR,PTRN,4,PTRDTB,PRCHR,PRCH1,PRMOD,0)> ;PTR
IFG SPTPN,<	DV(PTP,0,5,SPLDTB,PPCHR,PPCH1,PPMOD,0) ;SPOOLED PTP
		DV(PTP,SPTPN,5,SPLDTB,PPCHR,PPCH1,PPMOD,0)> ;SPOOLED PTP UNITS
IFG PTPN,<	DV(PPTP,PTPN,5,PTPDTB,PPPCHR,PPPCH1,PPMOD,0)> ;PTP
IFG VBCN,<	DV(VBC,0,6,VBCDTB,VBCHR,VBCH1,VBMOD,0)> ;VB10 DISPLAY
IFG CMAN,<	DV(CMA,CMAN,.DVADS,CMADTB,CMCHR,CMCH1,CMMOD,0)> ;AYDIN DISPLAY
		DV(LPT,0,7,SPLDTB,LPCHR,LPCH1,LPMOD,0) ;SPOOL LPT ALWAYS EXISTS
IFG LPTN,<	DV(LPT,LPTN,7,SPLDTB,LPCHR,LPCH1,LPMOD,0)> ;SPOOLED LPT UNITS
DVXLP0==:NDEV
IFG LPTN,<
	DV(PLPT,LPTN,7,LPTDTB,PLPCHR,PLPCH1,LPMOD,0)> ;PHYSICAL LPT
		DV(CDR,0,10,SPLDTB,CRCHR,CRCH1,CRMOD,0)	;SPOOLED CDR
   IFG CDRN,<DVXCD0==:NDEV
	DV(PCDR,CDRN,10,CDRDTB,CDRCHR,CDRCH1,CDRMOD,0)> ;PCDR
   IFG CDPN,<	DV(CDP,0,21,SPLDTB,CPCHR,CPCH1,CPMOD)> ;SPOOLED CDP
   IFG PCDPN,<	DV(PCDP,PCDPN,21,CDPDTB,PCPCHR,PCPCH1,CPMOD)>	;PHYSICAL CDP
   IFG FEN,<	DV(FE,FEN,11,FEDTB,FECHR,FECHR1,FEMOD,0)	;THE FE DEVICES
   >
DVXTT0==:NDEV			;SAVE DEV TABLE INDEX OF FIRST TTY
		DV(TTY,NLINES,12,TTYDTB,TTYCHR,TTYCH1,TTYMOD,0) ;TTYS ALWAYS EXIST
IFG NTTPTY,<	DV(PTY,NTTPTY,13,PTYDTB,PTYCHR,PTYCH1,PTYMOD,0)> ;PSEUDO TTY
		DV(NUL,0,15,NILDTB,NULCHR,NULCH1,NULMOD,0) ;THE NULL DEVICE
IFG NETN,<	DV(NET,0,16,NETDTB,NETCHR,NETCH1,NETMOD,0)>
IFG SPLTN,<	DV(PLT,0,17,SPLDTB,PLCHR,PLCH1,PLMOD,0) ;SPOOLED PLOTTER
		DV(PLT,SPLTN,17,SPLDTB,PLCHR,PLCH1,PLMOD,0)> ;SPOOLED PLT UNITS
IFG PLTN,<	DV(PPLT,PLTN,17,PLTDTB,PPLCHR,PPLCH1,PLMOD,0)> ;PLOTTER
IFG DLXN,<	DV(DLX,DLXN,20,DLXDTB,DLXCHR,DLXCH1,DLXMOD,0)> ;DL10
IFG DCN,<	DV(DCN,0,22,DCNDTB,DCNCHR,DCNCH1,DCNMOD,0)
		DV(SRV,0,23,SRVDTB,DCNCHR,DCNCH1,DCNMOD,0)>
IFN ATS,<	DV(ATS,0,24,ATSDTB,ATSCHR,ATSCH1,ATSMOD,0)> ;APPLICATIONS TERMINALS
	BLOCK 2*DVTSTP		;LEAVE ROOM TO PATCH 2 DEVICES
NINIDV==:.-INIDVT

NDEV=NDEV+2			;LEAVE ROOM TO PATCH 2 DEVICES

RS(DEVLCK)			; Lock for assigning devices
NR(DEVNAM,NDEV)			; Sixbit device name
NR(DEVCHR,NDEV)			; Device characteristics
NR(DEVCH1,NDEV)			;DEV CHAR WORD # 2
NR(DEVCH2,NDEV)		; DIR NUMBER OF SPOOL DIRECTORY
NR(DEVDSP,NDEV)			; Lh = ofn if any, rh = dispatch table address
RS(DEVUNT,NDEV)			; Lh = job of assigner, rh = unit number
;PARAMETERS AND STORAGE FOR ACCOUNT VALIDATION

NR ACTOFN,1		;OFN FOR <SYSTEM>ACCOUNTS-TABLE.BIN
NR ACTPGN,1		;FILE PG # MAPPED INTO ACCOUNT WINDOW PAGE
NR ACTLCK,1		;LOCK FOR HASH TABLE AND ACCOUNT WINDOW PAGE
NR AVALON,1		;ACCOUNT VALIDATION RUNNING IF NONZERO

NRP(HSHPG,PGSIZ)	;HASH TABLE PAGE
NRP(ACTPG,PGSIZ)	;ACCOUNT WINDOW PAGE

HASHLN==:PGSIZ-1		;# OF HASH VALUES FOR ACCOUNT VALIDATION
;PARAMETERS AND DATA STORAGE FOR IPCF,ENA, AND NETWORK STRINGS

ENQBKS==:6			;ENQ/DEQ BLOCK SIZE (OPTIMUM)
HSHLEN==:3*NJOBS		;LENGTH OF ENQ/DEQ HASH TABLE
ENFREL==:HSHLEN*ENQBKS		;FREE SPACE FOR ENQ/DEQ
PDFKTL==:<NFKS+^D35>/^D36	;LENGTH OF FORK BIT TABLE

PIDHDS==:5			;LENGTH OF PID HEADER
MESHDS==:6+MAXLW+WPN		;LENGTH OF MESSAGE HEADER (SEE MESALN, MESLLN IN IPCF.MAC)
PAGMSZ==:MESHDS+3		;LENGTH OF PAGE MESSAGE
MAXMSL==:^D30			;MAXIMUM LENGTH OF A NON-PAGE MESSAGE
MAXSMS==:^D60			; Maximum system packet size
MINPHL==:4			;MINIMUM SIZE OF PID DESCRIPTOR BLOCK
SWOPTL==:MESHDS+^D12		;OPTIMAL LENGTH OF FREE STORAGE BLOCK
PIDSSQ==:^D20			;STANDARD SEND QUOTA
PIDSRQ==:^D20			;STANDARD RECEIVE QUOTA
PIDSPQ==:5			;PID QUOTA, MAXIMUM PIDS ALLOWED PER NON-PRIVILEGED JOB
PIDSPJ==:2			;PIDS GUARANTEED PER JOB IF NONE USE MORE
IPCCFL==:<.IPCCC>B32		;FLAGS USED WHEN SENDING AN IPCC
				;   REQUEST TO INFO

MAXPID==:NJOBS*PIDSPJ		;HIGHEST POSSIBLE PIDTBL INDEX (0 ISN'T USED AS AN INDEX)
PIDTBS==:1+MAXPID/2		;NUMBER OF WORDS NEEDED FOR ONE HALFWORD PER PID
PDFREL==:MAXPID*<PIDHDS+SWOPTL>	;FREE SPACE SIZE (1 MESS/PID)

SRVSPC==^D32
DCNSPC==^D15
MAXBLK==:0
IFN DCN,<
MAXBLK==:SRVSPC*^D60+DCNSPC*^D40 ;STRING SPACE FOR NETWORK CONNECTIONS
>
ENQMXF==:ENFREL+PDFREL*3/4	;MAXIMUM ENQ FREE SPACE UTILIZATION
SWFREL==:PDFREL+MAXBLK+ENFREL	;IPCF STORAGE + ENQ/DEQ STORAGE+NET STRINGS
MAXPIT==:<SWFREL+PAGMSZ-1>/PAGMSZ ;MAXIMUM NUMBER OF PAGES IN TRANSIT
PIDPBL==:<MAXPIT+^D35>/^D36	;LENGTH OF PIT BIT TABLE
PIDFTL==:<MAXPIT+^D511>/^D512	;LENGTH OF PIT OFN TABLE

NR(PIDTBL,PIDTBS)		;PID TABLE HAS HALFWORD PER PID
				;  THE HALF WORD POINTS TO THE HEADER
				;  OF THE PID IF IT EXISTS

	SPDTBL==:10		;LENGTH OF SYSTEM PID TABLE SET BY USERS
NR(SPIDTB,SPDTBL)		;TABLE OF COMMONLY USED PIDS

NR(PIDLOK,1)			;LOCK ON PID FREE POOL AND DATA STRUCT.
NR(NXTPID,1)			;NEXT UNIQUE # TO BE USED AS LH OF PID
NR(INFOPD,1)			;PID OF SYSTEM INFO
NR(INFOPV,1)			;PUBLIC VALUE OF SYSTEM INFO PID
NR(PIDLST,1)			;NUMBER OF FIRST FREE PID, 0 IF NONE

NR(PIDMXP,1)			;HIGHEST PAGE IN PAGES-IN-TRANSIT FILE
NR(PIDPBT,PIDPBL)		;BIT TABLE OF PAGES-IN-TRANSIT FILE
NR(PIDFTB,PIDFTL)		;TABLE OF PTN'S OF FORKS FOR PAGES IN TRANSIT

NR(SWPFRE,7)			;FREE SPACE HEADER BLOCK
NR(SWFREE,SWFREL)		;FREE STORAGE SPACE FOR MESSAGES
				;AND HEADERS

NR(PIDCNT,NJOBS)		;TABLE OF QUOTAS AND COUNTS FOR IPCF

RS(PDFKTB,PDFKTL)	;ONE BIT PER FORK, WAKE UP TABLE
; DEFAULT DEFINITIONS FOR GETOK

GT%DEF==77B11

NDG	DGOUSR,0!GT%DEF		;USER REQUESTS
NDG	DGOASD,SF%DOK!GT%DEF	;ASSIGN DEVICE
NDG	DGOCAP,SF%DOK!GT%DEF	;ENABLE CAPABILITIES
NDG	DGOCJB,SF%DOK!GT%DEF	;CREATE JOB
NDG	DGOLOG,SF%DOK!GT%DEF	;LOGIN
NDG	DGOFKN,5		;DEFAULT NUMBER OF FORKS BEFORE GETOK IS CALLED
NDG	DGOCFK,SF%DOK!GT%DEF+DGOFKN	;CREATE FORK
NDG	DGOTBR,SF%DOK!GT%DEF
NDG	DGOLGO,SF%DOK!GT%DEF	;LOGOUT OVER QUOTA
NDG	DGOENQ,0!GT%DEF		;ENQ OVER QUOTA
NDG	DGOCRD,SF%DOK!GT%DEF	;CREATE DIRECTORY
NDG	DGOSMT,SF%DOK!GT%DEF	;INCREMENT MOUNT COUNT
NDG	DGOMDD,SF%DOK!GT%DEF	;ENTRY TO MDDT
NDG	DGOCLS,SF%DOK!GT%DEF	;SET CLASS
NDG	DGOCL0,SF%DOK!GT%DEF	;SET CLASS AT LOGIN ONLY
NDG	DGOMTA,0!GT%DEF		;NO ACCESS FOR MT'S
NDG	DGOACC,0!GT%DEF		;NO ACCESS
NDG	DGOOAD,SF%DOK!GT%DEF	;OPEN ASSIGNABLE DEVICE

;DEFAULT TIMEOUT FOR GETOK

NDG	GIVTIM,200000		;GIVOK TIMEOUT TIMER
NDG	RCVTIM,200000		;RCVOK TIMEOUT TIMER

; STORAGE FOR GETOK,GIVOK,RCVOK

	RESCD
GTOKPR::DGOUSR		;ONE ENTRY PER LEGAL GETOK/GIVOK FUNCTION (THIS ENTRY IS USER REQUESTS)
	DGOASD		;ASSIGN DEVICE
	DGOCAP		;ENABLE CAPABILITIES
	DGOCJB		;CREATE JOB
	DGOLOG		;LOGIN
	DGOCFK		;CREATE FORK
	DGOTBR		;TERMINAL BAUD RATE
	DGOLGO		;LOGOUT WHEN DIR OVER QUOTA
	DGOENQ		;ENQ QUOTA SETTING
	DGOCRD		;CREDIR
	DGOSMT		;SMOUNT
	DGOMDD		;MDDT ENTRY
	DGOCLS		;SET CLASS FOR JOB
	DGOCL0		;SET CLASS AT LOGIN
	DGOMTA		;MT ACCESS
	DGOACC		;ENTRY FOR ACESS JSYS
	DGOOAD		;ASSIGN DEVICE VIA OPENF
MXGOKF==:.-GTOKPR	;SIZE OF TABLE
	SWAPCD

RS (GETOKF,1)		;ARGUMENT LIST POINTER
RS (GOKNRQ,1)		;REQUEST NUMBER FOR NEXT FREE NUMBER
RS (GOKQED,1)		;FLAG FOR Q'ED GETOK REQUESTS
RS (GOKLCK,1)		;LOCK FOR GETOK Q
RS (ACJJN,1)		;JOB NUMBER OF ACCESS CONTROL JOB
RS (ACJFN,1)		;FORK NUMBER OF ACCESS CONTROL JOB
RS (RCVTMO,1)		;RCVOK TIMEOUT TIME
;LOCAL STORAGE FOR ENQ/DEQ
ENFKTL==:<NFKS+^D35>/^D36	;LENGTH OF FORK BIT TABLE

NR(HSHTBL,HSHLEN)		;HASH TABLE FOR ENQ LOCKS

NR(ENQLOK,1)			;DATA BASE LOCK FOR ENQ AND DEQ
NR(ENQSPC,1)			;COUNT OF FREE SPACE AVAILABLE FOR ENQ'S
NR(ENQLTL,1)			;LIST OF LONG TERM LOCKS
NR(ENQLTS,1)			;TIME OF NEXT GARBAGE COLLECT

RS(ENFKTB,ENFKTL)		;WAKE UP TABLE - ONE BIT PER FORK

;LOCAL STORAGE FOR DIRECTORY LOCK ENQ/DEQ

LCKDBN==:<NFKS+^D35>/^D36	;LENGTH OF FORK BIT TABLE

RS LCKDBT,LCKDBN		;FORK BIT TABLE, ONE BIT PER FORK

; Local storage for TIMER

RS (TIMLCK,1)			; Lock on TIMER Q's
RS (TMLSTL,1)			;FORK THAT LAST LOCKED TIMLCK
RS (TIMMLQ,1)			; Elapsed time clock Q head
RS (TIMDTQ,1)			; Date & time clock Q head
RS (TMNSS,1)			; # times scheduler has scanned Q's
RS (TMMUSE,1)			; # milliseconds use by scheduler

;LOCAL STORAGE FOR PTY

RS PTYSTS,NTTPTY			;STATUS BITS

;STORAGE FOR CRJOB JSYS

NR (CRJAC1,1)			;CALLER'S AC1 FLAG BITS
NR (CRJACT,11)			;ACCOUNT FOR NEW JOB LOGIN (STRING)
RS (CRJANS,1)			;ANSWER CELL FROM SCHED OR EXEC0
RS (CRJCAM,1)			;CAP MASK TO APPLY AT LOGIN TIME
RS (CRJCPU,1)			;CPU TIME LIMIT
NR (CRJEVO,1)			;ENTRY VECTOR OFFSET FOR NEW JOB
NR (CRJEXF,1)			;EXEC FLAGS FOR NEW JOB
NR (CRJFAC,20)			;FORK'S AC'S FOR NEW JOB
NR (CRJFIL,40)			;FILE NAME TO RUN IN NEW JOB
RS (CRJJNO,1)			;JOB NUMBER, SET AT SCHED LEVEL
RS (CRJLCK,1)			;LOCK ON ALL THIS DATA, SCHED TESTED
NR (CRJOJC,1)			;OWNING JOB'S CAPABILITIES
NR (CRJONJ,1)			;OWNING JOB'S JOB NUMBER
NR (CRJPJF,1)			;PRIMARY JFNS FOR NEW JOB
NR (CRJPSW,10)			;LOGIN PASSWORD FOR NEW JOB
RS (CRJSLO,1)			;PID TO SIGNAL ON LOGOUT
NR (CRJTTY,1)			;REQUESTED TTY FOR NEW JOB
NR (CRJUSR,10)			;NAME STRING TO LOG NEW JOB IN AS
NR (JOBONT,NJOBS)		;OWNER OF THIS JOB IN RH, ELSE -1
				; ALSO, B1 MEANS JOB WANTS TO LOG OUT
;SM10 DEPENDENT DATA

; UNIBUS ADAPTER SAVE AREAS

   IFN SMFLG,<
RS (SMADNX,4)			;NXT FREE NPR MAP FOR UBA
RS (SMUAMR,1)			;VALUE TO USE FOR SM10 UNIBUS ADAPTER MAINT REG
RS (SMUASR,1)			;VALUE TO USE FOR SM10 UNIBUS ADAPTER STATUS REG

   > ;END IFN SMFLG
IFG DTAN,<

; Private storage for dectapes

DTNBUF==3*DTAN+2			;Number of buffers is one for read
				;One for write, one for directory, and
				;2 more for double buffering 1st files
DTNBUF==:<DTNBUF+3>/4*4		;Round to next higher page boundary
NDBMSK==:-1_<^D36-3*DTAN>		;Mask for unavailble 2nd buffers

RS(DTALCK,DTAN)			;Lock word
RS(DTASTS,DTAN)			;Lh -- status bits (see below)
				;Rh -- directory location (0 if none)
RS(DTIBF1,DTAN)			;Bit 0 -- buffer busy
				;Bit 1 -- error in this buffer
				;Bits 2-11 -- next input block number
				;Bits 13-17 -- input file number
				;Rh -- location of input buffer 1
RS(DTIBF2,DTAN)			;Bit 0 -- buffer busy
				;Bit 1 -- error in this buffer
				;Bits 2-11 -- current block number
				;Bit 12 -- if doing a nop spacing (rew etc)
				;Bit 13 -- if unloading
				;BIT 14 -- WRITE LOCK CHECK REQUESTED
				;BIT 15 -- WRITE OK (NOT LOCKED OUT) AT LAST CHECK
				;BIT 16 -- ACCESS OK (SELECTED) AT LAST CHECK
				;BIT 17 -- LAST MOUNT REQUESTED NO DIR READ
				;Rh -- location of input buffer 2 (0 if none)
RS(DTOBF1,DTAN)			;Bit 0 -- buffer busy
				;Bit 1 -- error in this buffer
				;Bits 2-11 -- next output block number
				;Bit 12 -- last buffer
				;Bits 13-17 -- output file number
				;Rh -- location of output buffer 1
RS(DTOBF2,DTAN)			;Bit 0 -- buffer busy
				;Bit 1 -- error in this buffer
				;Bits 2-11 -- first block number of output file
				;Bit 12 -- last buffer
				;Rh -- location of output buffer 2 (0 if none)
RS(DTAPTR,DTAN)			;Temp pointer to directory entry
RS(DTAIOW,DTAN)			;Iowd during dead reckoning
RS(DTARKN,DTAN)			;Bit 0 -- dead reckoning for a write
				;Bit 1 -- going backward
				;Bits 8-17 -- block number
				;Rh -- chain to next dead reckoning unit (-1 if end)
RS(DTARCE,DTAN)			;Total error count
NRP(DTABUF,DTNBUF*200)		;Dectape buffers
   >				;END IFG DTAN
   IFG DLXN,<

	DLMASK==:100		;SIZE OF PDP-10 MEMORY BLOCK IN PDP-11
	DLNPIS==:20		;SIZE OF PI LEVEL STACK
	DLIMIN==:20		;MINIMUM SIZE OF INPUT BUFFER
	DLNOB==:2		;NUMBER OF OUTPUT BUFFERS
	DLNIB==:2		;NUMBER OF INPUT BUFFERS

;SIZE OF EACH OUTPUT BUFFER
	DLOBFL==:<DLOBFP*PGSIZ/<<DLXN+3>/4*4*DLNOB>>

DEFINE DLSTOR (X,Y)<
	X==:DLPC+DLBASE
IFB <Y>,<DLPC==DLPC+1>
IFNB <Y>,<DLPC==DLPC+Y>>

DLPC==0			;DEFINE AREAS USED BY PDP-11'S

DLSTOR(DLINTW)			;INTERRUPT VECTOR WORD
DLSTOR(DLUNIT)			;UNIT NUMBER OF THIS PDP-11
DLSTOR(DLOC11)			;COUNT OF OUTPUT BYTES FOR TO 11 TRANS
DLSTOR(DLOP11)			;POINTER TO OUTPUT BUF FOR TO 11 TRANS
DLSTOR(DLIC11)			;COUNT OF BYTES IN INPUT BUF FOR TO 10
DLSTOR(DLIP11)			;POINTER TO INPUT BUF FOR TO 10 TRANS

DLPC==DLXN*DLMASK		;NOW DEFINE LOCAL STORAGE

DLSTOR(DLUBAS,0)		;START OF PER 11 LOCAL STORAGE AREA

DLSTOR(DLXSTS,DLXN)		;STATUS WORD
DLSTOR(DLXPNT,DLXN)		;LH=INITIAL BYTE POINTER, RH = S-FIELD
DLSTOR(DLXOCT,DLXN)		;COUNT OF BYTES IN A FULL OUTPUT BUF
DLSTOR(DLXICT,DLXN)		;COUNT OF BYTES IN A FULL INPUT BUF
DLSTOR(DLXBPW,DLXN)		;BYTES PER WORD
DLSTOR(DLOCNT,DLXN)		;# OF BYTES LEFT TO FILL OUTPUT BUFFER
DLSTOR(DLOPNT,DLXN)		;POINTER TO 10 OUTPUT BUFFER
DLSTOR(DLICNT,DLXN)		;# OF BYTES LEFT TO EMPTY BUFFER
DLSTOR(DLIPNT,DLXN)		;POINTER TO 10 INPUT BUFFER
DLSTOR(DLOBCT,DLXN)		;# OF FULL OUTPUT BUFFERS
DLSTOR(DLIBCT,DLXN)		;# OF FULL INPUT BUFFERS
DLSTOR(DLON11,DLXN)		;NEXT OUTPUT BUF TO BE GIVEN TO 11
DLSTOR(DLIN11,DLXN)		;NEXT INPUT BUF TO GIVE TO 11 TO FILL
DLSTOR(DLON10,DLXN)		;NEXT OUTPUT BUF TO BE FILLED BY 10
DLSTOR(DLIN10,DLXN)		;NEXT INPUT BUF TO BE GIVEN TO 10 USER
DLSTOR(DLOBFC,<DLNOB*DLXN>)	;# OF BYTES IN EACH OUTPUT BUFFER
DLSTOR(DLIBFC,<DLNIB*DLXN>)	;# OF BYTES IN EACH INPUT BUFFER
DLSTOR(DLXIMP,<<DLXN+3>/4*20>)	;4 WORD BLOCKS USED BY XPCW ON INTERRUPTS
DLSTOR(DLAC,5)			;PLACE TO STORE ACS DURING AN INTERRUPT
DLSTOR(DLACP,1)			;PLACE TO STORE P DURING INTERRUPTS
DLSTOR(DLPISK,DLNPIS)		;INTERRUPT LEVEL STACK

DLIBUF==:DLPC+DLBASE			;END OF LOCAL STORAGE
DLIBFL==:<PGSIZ*DLIBFP-DLPC>/<DLNIB*DLXN> ;REST OF PAGE IS FOR INPUT BUFFERS

IFL DLIBFL-DLIMIN,<PRINTX NOT ENOUGH ROOM FOR INPUT BUFFERS!>
   >				;END OF IFG DLXN
;STORAGE FOR CMA DEVICES (AYDIN DISPLAY)

  IFG CMAN,<

RS(DRBACS,20)			;STORAGE TO SAVE AC'S
	LCMAPD==:55		;LENGTH OF PDL
RS(CMAIPD,LCMAPD)		;INTERRUPT PDL
RS(CMALCK,CMAN)			;LOCK FOR DEVICE DATA BASE
RS(CMASTS,CMAN)			;STATUS
RS(CMINDX,1)			;COUNT OF CMA DEVICES
RS(CMOWNR,CMAN)			;OWNING FORK,,DR11-B BLOCK ADDRESS
RS(CMALAE,CMAN)			;LAST AYDIN ERROR
RS(CMAERC,CMAN)			;AYDIN ERROR INFO

	CMBUFN==:2		;NUMBER OF IORBS/BUFFERS
	MAXPPT==:20		;MAXIMUM PAGES PER BUFFER
				;.ALSO MAX PER DUMPI/O AND
				;EQUALS SIZE OF UBA WINDOW
	XRBLEN==:5+MAXPPT		;ALSO IN CMAPAR
	CMXLST==:XRBLEN		;START OF TRANSFER LIST
	CMIRBL==:CMXLST+MAXPPT+1 ;TOTAL LENGTH OF IORB
	CMABFL==:CMAN*CMBUFN*CMIRBL ;STORAGE REQUIRED FOR IORB'S
RS(CMXORB,CMABFL)		;STORAGE FOR IORB'S
	DRCHNN==:2		;MAX DR11-B'S (ALSO IN CMAPAR)
	DRBLEN==:21		;ALSO IN CMAPAR
CMDRBL==:DRBLEN*DRCHNN	;STORAGE REQUIRED FOR DR11B BLOCKS
RS(CMADRB,CMDRBL)		;STORAGE FOR DR11-B BLOCKS
RS(DRBTAB,DRCHNN)		;ADDRESSES OF DR11-B BLOCKS

NR(CMANR1,CMAN)			;CURRENT,,LAST XORB
NR(CMANR2,CMAN)			;LAST TRANSFER WORD COUNT,,LAST
NR(CMANR3,CMAN)			;LAST FUNCTION,NUMBER OF XORB'S QUEUED
NR(CMANR4,CMAN)			;FREE XORB'S LIST FOR UNIT
				;DUMP MODE IORB ADDRESS
NR(CMAPNM,CMAN)			;PROGRAM NAME
NR(CMAUDR,CMAN)			;USER DIRECTORY
  > ;END OF IFG CMAN
;STORAGE FOR DECNET

   IFG DCN,<			;ONLY IF PRESENT
NDG DCOPNM,4			;MAX LINKS PER JOB FOR NO PRIVILEGES
RS LLLLCK,1			;LL TREE LOCK
MAXEXP==:7			;EXP FOR MAXIMUM LL ADDRESS
MAXLNK==:1_<MAXEXP>-1		;GENERATE LARGEST LL ADDRESS
RS LLHEAD,1			;HEAD OF LL TREE
OBJMAX==:377			;MAX # OF OBJECTS
DECOBJ==:177			;MAX OBJECT # RESERVED TO DEC
NR OBJTBL,OBJMAX+1		;GENERATE LOOK UP TABLE
NR LASTSK,1			;WORD FOR GENERATING RANDOM TASK NAMES
LLBIT==:<MAXLNK+1+43>/44	;WORDS IN LL ADDRESS BIT TABLE
NR LLBITS,LLBIT			;BIT TABLE FOR AVAILABLE LINK INDEXES
NR BLKASG,1			;AMOUNT OF SWAPPABLE STRING SPACE NOW ASSIGNED
NR OURNUM,1			;LOCAL NODE NUMBER
	NDG NODNUM,100		;DEFAULT NODE NUMBER
NR NODLOK,1			;LOCK ON NODTBL
RS OUTQUE,1			;BACKGROUND TASK'S "OUTPUT REMAINING" QUEUE
NR OUTLOK,1			;LOCK ON OUTQUE
RS OUTTIM,1			;TIME TO RETRY BLOCKED OUTPUT
NR OUTIVL,1			;TIME INTERVAL BEFORE RETRYING BLOCKED OUTPUT
	NDG INIWAT,100		; DEFAULT IS 300 MS.
RS NSPMCB,1			;EACH BIT INDICATES A DED MCB PORT NUMBER (NSP)
RS RMSGQ,1			;EXPENDED MESSAGE QUEUE
RS MSGQ,1			;MESSAGE QUEUE
RS SMSGQ,1			;SCHEDULER'S MESSAGE Q
NR NSPLPB,1			;RH IS PORT FOR LOOPBACK TESTING
NR NODTBL,1			;ADDRESS OF TABLE OF KNOWN NODES
	NTCMAX==:5		;MAX # OF FORKS TO REMEMBER
NR NTCTAB,NTCMAX		;NETWORK TOPOLOGY CHANGE FORK TABLE
NR MCBDTE,DCN			;THE DTE # OF THE MCB FRONT END
NR NSPMAX,DCN			;MAX SEG SIZE OF INTERCEPT NODE
NR ITSNAM,<DCN*2>		;MCB'S NODE NAME
NR ITSNUM,DCN			;MCB'S NODE NUMBER
NR ITSID,<DCN*^D9>		;MCB'S SYSVER STRING
NR NAKCNT,DCN			;COUNT OF NAK'ED SEGS
MCPRON==:.VNMCB		;MCB PROTOCOL IF DCN ASSEMBLED IN
   >				;END OF IFG DCN CONDITIONAL

NR OURNAM,WPN			;SPACE TO HOLD LOCAL NODE NAME
NR OURCNT,1			;COUNT OF CHARS IN "OURNAM"

   IFE DCN,<MCPRON==:0>	;IF NO DCN, NO MCB PROTOCOL

;FOLLOWING IS A DUMMY FOR WHEN THERE IS NO DECNET. IT SHOULD NEVER BE EXECUTED

   IFE DCN,<
NTCOFF::SETZRO FKNTC		;TURN OFF BIT THAT CAUSED US TO GET HERE
	RETSKP>

;DEFINITION FOR ATS

IFN ATS,<
NDG ATJBMX,10			;MAXIMUM NUMBER OF HTN'S PER JOB
>
IFE ATS,<
NDG ATJBMX,0			;NO HTN'S IF NO ATS
>
RS ATSTYM,1			;ATS TIMER (NEEDED BY DUMMY ATSINI ALSO)
;STORAGE FOR KMC11'S

    IFLE KDPN,< ;ONLY IF NOT PRESENT
KDPINI==:R
KDPTSK==:R
    IFN SMFLG,<
.BOOT::	MCENT
	JRST UJSYS0
	>
	>
    IFN DCN,<
RS KDPFLG,1		;SET NONZERO WHEN NEED KMCTSK
    >
    IFG KDPN,<	;ONLY IF PRESENT
KMCQLN==:4+2*4*KDPN		;LENGTH OF KMC11 INPUT QUEUE
RS KMCINQ,KMCQLN		;QUEUE OF INPUT FOR KMC11
				; 1ST WORD IS PUTTER, 2ND WORD IS TAKER
				; REST IS 2 WORD ENTRIES
RS KMCACS,20		;INTERRUPT SAVE ACS
RS KMCIPL,50		;INTERRUPT PDL FOR KMC
RS KDPLIM,1		;LH IS NEGATIVE NUMBER OF DUP11'S ON SYSTEM
			; RH IS 0
RS KDPNLN,1		;POSITIVE NUMBER OF DUP11'S
RS KDPPAG,KDPN		;UBA ADR OF PAGE,,OUR ADR OF PAGE
RS KDPXPC,10		;XPCW BLOCK FOR KMC11 INTERRUPTS
    >
;STORAGE FOR DTE'S

IFG DTEN,<			;DTE STORAGE

RS UPFLAG,1			;WORD TO GENERATE CONTINUED MESSAGE
NRP DTERBT,1000			;PAGE TO DO -11 REBOOTS
EXTN <SVDTAC,INTDTE>		;NECESSARY EXTERNALS
RS LOAD11,1			;IF AN -11 NEEDS TO BE LOADED
RS LODFRK,1			;HANDLE OF MONITOR FORK DOING RELOADING
NQPKT==:^D20			;NUMBER OF QUEUE PACKETS
QPKT==:5			;SIZE OF A PACKET
RS(DTEDTE,1)			;CELL TO REMEMBER INTERRUPTING
				; DTE
RS (CTYUNT,1)			;FE PHYSICAL UNIT FOR TS TTY
RS (DTEQS,DTEN)			;SET UP DRIVER QUEUE HEADERS
QPKT1==QPKT*NQPKT
RS(COMQ,QPKT1)			;SET UP PACKETS
RS(COMH,1)			;THE QUEUE HEADER
RS(DTESTS,DTEN)			;DTE STATUS WORD
RS(DTEST1,DTEN)			;SECONDARY STATUS WORD
BUFSIZ==:^D33			;TRANSFER BUFFER SIZE
BYTBUF==:BUFSIZ*4		;BYTES PER BUFFER
RS(DTBFWD,DTEN)			;THE HEADER WORD FOR THE BUFFERS
DTESZ==:60			;SIZE OF INTERRUPT STACK
RS(DTETRA,2)			;WORD FOR INTERRUPT RETURN
RS(DTESKP,DTESZ)		;THE LOCAL STACK
RS(DTEACB,20)			;BLOCK TO SAVE REGISTERS
RS(DTEIND,DTEN)			;STORAGE FOR INDIRECT FUNCTIONS
PKTSIZ==:3			;THE QUEUE PACKETS
PKTSZ1==PKTSIZ*DTEN
RS(PKTADR,PKTSZ1)		;ONE PER DTE
COMSIZ==:COMDAT+COMRGN		;SIZE OF THE "BASIC" COMM REGION
CMSZ==:COMSIZ*<DTEN+1>+COMRGN*DTEN
RS(COMBUF,DTEN+1)		;SIZE OF "VECTOR" FOR THE COMM REGION
RS(COMBAS,CMSZ)			;ALLOCATE COMMUNICATIONS REGION
RS ENDRGN,0			;END OF COMM REGION
IEXSIZ==:CMSZ-<DTEN+1>		;INITIAL EXAMINE SIZE
RS(TAD11,3)			;TIME FROM -11 CELL
RS(TO11TM,3)			;PACKET TO SEND TIME TO THE -11
KLISIZ==^D10			;WORDS FOR KLINIK DATA BASE
KLIMAX==:<KLISIZ-1>*4		;MAX NUMBER OF BYTES IN KLINIK DATABASE
RS (KLIDTA,KLISIZ)		;KLINIK DATABASE
DEFINE DTEPRO (UNIT)<		;MACRO TO GENERATE DTE INTERRUPT VECTOR
DTEN'UNIT:BLOCK 3
	.+1
	JSR SVDTRJ		;;SAVE REGISTERS
	MOVEI A,UNIT
	DMOVE B,DTEN'UNIT	;;GET INTERRUPT PC
	DMOVEM B,DTETRA		;;TO COMMON TRAP CELL
	CONI DTE'UNIT,F		;;GET DTE STATUS
	JRST INTDTE		;;GO DO COMMON STUFF
>
DEFINE DTEINN (UNIT)<		;;TO GENERATE INTERRUPT VECTOR
	XPCW DTEN'UNIT		;;THE XPCW
>
   >				;END IFG DTEN

IFN DTFLG,<
;FIXED CORE ADDRESSES IN EPT FOR DTE PROTOCOL

DTEFLG==:KIEPT+444			;OPERATION COMPLETE FLAG
DTECKF==:KIEPT+445			;CLOCK INTERRUPT FLAG
DTECKI==:KIEPT+446			;CLOCK INTERRUPT INSTRUCTION
DTET11==:KIEPT+447			;TO 11 ARGUMENT
DTEF11==:KIEPT+450			;FROM 11 ARGUMENT
DTECMD==:KIEPT+451			;COMMAND WORD
DTESEQ==:KIEPT+452			;DTE20 OPERATION SEQUENCE NUMBER
DTEOPR==:KIEPT+453			;OPERATION IN PROGRESS FLAG
DTECHR==:KIEPT+454			;LAST TYPED CHARACTER
DTETMD==:KIEPT+455			;MONITOR TTY OUTPUT COMPLETE FLAG
DTEMTI==:KIEPT+456			;MONITOR TTY INPUT FLAG
DTESWR==:KIEPT+457			;CONSOLE SWITCH REGISTER
SDTE==:3			;SHIFT VALUE FOR EPT DTE SET

   >				;END IFN DTFLG
   IFN SMFLG,<

; EPT RESERVED LOCATIONS

SMTEPT==:KIEPT+100	;POINTERS TO SM10 VECTOR TABLE
>

MSECTB=:KIEPT+540		;MONITOR SECTION TABLE

;CELLS IN EXEC PROCESS TABLE (EPT)
	USECTO==:540		;OFFSET IN PT FOR USER SECTION
	MXSECN==:37		;HIGHEST POSSIBLE SECTION NUMBER

EPTMHI=:KIEPT+200		;MAP FOR HIGH EXEC (400-777)
EPTTPI=:KIEPT+420		;TRAP INSTRUCTIONS
EPTMLO=:KIEPT+600		;MAP FOR LOW EXEC (0-337)
KIEMP==:KIEPT			;BASE FOR MONITOR PAGES 400-777
;ADD RESIDENT STORAGE FOR TAPE SCEDULER TEST


;DTESRV STORAGE

NR BTLOCK			;LOCK ON BOOT PAGE (DTERBT)
;**;[3024] CHANGE 1 LINE AT BTLOCK + 1L	TAM	6-OCT-83
RS RLDFRK			;[3024] SYSTEM WIDE HANDLE OF RELOAD FORK
RS SNGPK1,6
RS SNGPK2,6

;LINEPRINTER STORAGE

NDG NLPBF,400			;DEFAULT BUFFER SIZE

RS(LPTTYP,LPTN)			;TYPE OF LPT VECTOR FOR DEVICE INDEPENDENCE
RS(LPTSTS,LPTN)			; Status word
RS(LPTST1,LPTN)			;SECOND STATUS WORD
RS(LPTST2,LPTN)			;THIRD STATUS WORD
RS(LPTST3,LPTN)			;YES
RS(LPTERR,LPTN)			; LAST ERROR WORD
RS(LPTCNT,LPTN)			; Buffer counter
NRP(LPTBUF,LPTN*2*NLPBF)	;2 BUFFERS
RS LPTCLS,LPTN			;LPTCHK CLOCK SWITCH
RS LPTCCW,LPTN			;BLKI/O PTR
RS LPTICT,LPTN			;INTERRUPT BYTE COUNT
RS LPTCKT,LPTN			;INTERVAL FOR LPTTIM
RS(LPTLCK,LPTN)			; Lock on opening lpt
RS (PGDATA,LPTN)		;PAGE COUNTER PLACED HERE TO SEND IT TO -11

NR (LPTOFN,LPTN)		;VFU,,RAM OFN'S TO PREVENT OPENS FOR WRITE
	LPFLSZ==:^D28		;NUMBER OF WORDS IN FILENAME BUFFERS
NR (VFUFIL,LPFLSZ*LPTN)		;ALLOCATE SWAPPABLE STORAGE FOR VFU FILE NAMES
NR (RAMFIL,LPFLSZ*LPTN)		;ALLOCATE SWAPPABLE STORAGE FOR RAM FILE NAMES
   IFN SMFLG,<
   IFG <LPTN-1>,<PRINTX %%ILLEGAL NUMBER OF LINEPRINTERS DEFINED FOR KS10>
RS L11A,LPTN			;HOLDS FAKE -11 ADDRESS OF BUFFER
RS LPWINA,LPTN			;ADDRESS OF UNIBUS WINDOW
RS LPACS,20			;AC'S DURING LPT INTERRUPT
	LPSLEN==:50		;LENGTH OF LPT INTERRUPT STACK
RS LPSTAK,LPSLEN		;PDL DURING LPT INTERRUPT
RS LPXJEN,1			;XJEN INSTRUCTION FOR DISMISSING LPT INTERRUPT
RS LPXPTB,LPTN*4		;LP INTERRUPT INSTRUCTION IS XPCW
				; TO 4-WORD BLOCK IN THIS TABLE
LPERSZ==:6			;NUMBER OF WORDS PER ERROR BLOCK
RS LPERBF,LPERSZ*LPTN		;ERROR BLOCK CONTAINING ERROR INFORMATION
				;FOR SYSERR.
   >	;END IFN SMFLG

   IFG FEN,<			;PRIVATE STORAGE FOR FE DEVICES
RS FEUDB0,FEN
RS FEUDB1,FEN
RS FEUDB5,FEN
RS FEUDB6,FEN
RS FEUDB7,FEN
RS FEUDB3,FEN
RS FEUDB4,FEN
RS FELOCK,1
   >				;END OF FE STORAGE DEFINITIONS

;PHYSICAL CARD PUNCH STORAGE	
	IFG PCDPN,<
CDPBFZ==:41			; Size of CDP buffer
RS(CDPBF1,CDPBFZ)		; First buffer
RS(CDPBF2,CDPBFZ)		; Second buffer
RS(CDPSTS)			; Status word
RS(CDPLCK)			; CDP open lock
RS(CDPCNT)			; Count of full buffers
RS(CDPITC)			; Count of items remaining in current buffer
RS(CDPPTR)			; Byte bointer for emptying current buffer
RS(CDPSIO)			; Saved ios during interrupt
   >				;END IFG PCDPN
;PHYSICAL CARD READER STORAGE

   IFG CDRN,<
CDRSIZ==:^D40			;SIZE OF A CARD IMAGE
CDRLEN==:2*CDRSIZ		;SPACE IN CDRBUF FOR 1 CDR
RS CDRCT1,CDRN			;BUFFER COUNT
RS CDRCKT,CDRN			;WORD FOR SCHEDULER TEST
RS CDRSTS,CDRN			;THE STATUS WORD
RS CDRST1,CDRN			;THE SECOND STATUS WORD
RS CDRST2,CDRN			;THIRD STATUS WORD
RS CARDCT,CDRN			;COUNT OF CARDS READ
RS CARDER,CDRN			;NUMBER OF "HARDWARE" ERRORS
RS CDRLCK,1			;THE CDR LOCK WORD
RS CDRCNT,1			;COUNT OF CDR'S OPENED
NRP CDRBUF,1000			;THE BUFFER PAGE
   IFN SMFLG,<			;KS PARAMETERS
RS CDUBAD,CDRN			;ADDRESS OF UBA WINDOW
RS CD11A,CDRN			;ADDRESS OF UBA-11 ADDRESS
;**;[1984] Revamp at RS CD11A +1L	JGZ	20-FEB-82
RS CDERBF,CDRN*<20/4>		;[1984] ERROR STATUS BYTES FOR CARDREADER
   >
   >

   IFG MTAN,<

;Private storage for magtapes

RS(MTALCK,MTAN)			;Lock word
RS(MTASTS,MTAN)			;Status of unit
NR(MTANR1,MTAN)			;NON-RESIDENT STORAGE FOR MAGTAPE
NR(MTANR2,MTAN)
NR(MTANR3,MTAN)
NR(MTANR4,MTAN)
NR(MTANR5,MTAN)
NR(MTANR6,MTAN)
RS(MTARS1,MTAN)			;RESIDENT STORAGE FOR MAGTAPE
RS(MTINDX,1)			;NUMBER OF REAL MTA'S ON SYSTEM, SET UP BY PHYM2
				; AND/OR PHYX2
RS(MTPSFK,MTAN)			;PSI,,FORK # FOR ONLINE/OFFLINE INTERRUPTS ON TAPE
RS(MTCUTB,MTAN)			;CDB ,, UDB TABLE

	MTBUFN==:2		;NUMBER OF BUFFERS/IORB'S
	MAXPPB==:20		;MAXIMUM PAGES PER BUFFER
	IRBLEN==:6		;LENGTH OF AN IORB (ALSO IN PHYPAR)
	MTIRSD==:IRBLEN		;START OF DEVICE SPECIFIC AREA
				;SEE MAGTAP FOR DEFSTR'S OF THIS AREA
	MTIRTL==:MTIRSD+2	;START OF TRANSFER LIST
	MTIRBL==:MTIRTL+MAXPPB+1	;TOTAL LENGTH OF MAGTAPE IORB
	MTABFL==MTAN*MTBUFN*MTIRBL
;**;[2954] CHANGE ONE VALUE CALCULATION 	RAH	JUN 15 83
	MTPBFL==MTBUFN*<MAXPPB+1>*MTAN	;[2954]
RS(MTAPBF,MTPBFL)		;SPACE FOR BUFFER PAGE POINTERS
RS(MTIRBF,MTABFL)		;SPACE FOR IORB'S

RS(MTIOWD,MTAN)			;Iowd for next transfer
RS(MTBIOW,MTAN)			;BACKUP IOWD (FOR NEXT XFER)
RS(MTAOLS,MTAN)			;LENGTH OF LAST XFER,,
RS(MTARCE,MTAN)			;Total error count
RS(REWCNT)			;Number of rewinding units
RS(MTERAS)			;Rewrite erase counter
RS(MTPNTR)			;Iowd during transfer
RS(MTAUNT)			;Unit currently attached to controller
RS(MTERRC)			;Retry counter
RS(MTERFL)			;State of retry
RS(MTACOM)			;Cono word of current operation
RS(MTDINR)			;Return address from data interrupt
RS(MTACLS)			;Clock routine switch, 0 for no clock wanted

;PRIVATE STORAGE FOR MT (DUMMY TAPES)

RS (TLABBP,2*MTAN)		;PNTR TO LOCKED BUFFER PAGE
RS (TLABR0,MTAN)		;RESIDENT STORAGE FOR LABEL INFO

NR (TLABL0,MTAN)		;NON-RESIDENT STORAGE FOR TAPE
NR (TLABL1,MTAN)		; LABEL INFORMATION
NR (TLABL2,MTAN)
NR (TLABL3,MTAN)
NR (TLABL4,MTAN)
NR (TLABL5,MTAN)
NR (TLABL6,MTAN)
NR (TLABL7,MTAN)
NR (TLABL8,MTAN)
NR (TLABL9,MTAN)
NR (TLAB10,MTAN)		;PROTECTION FIELD, ETC
NR (TLAB11,MTAN)		;WORD TO HOLD OF MAGTAP PARAMS
NR (TLAB12,MTAN)		;HOLD VOL SET NAME IN HERE
NR (TLAB13,MTAN)		;HOLD EXP DATE HERE
NR (TPFCNT,MTAN)		;MT FILCNT (JFN1
NR (TPFBYN,MTAN)		;MT FILBYN (JFN)
NR (TPFLEN,MTAN)		;MT FILLEN (JFN)
NR (TPFLNX,MTAN)		;COUNT OF BYTES (OF FILLEN(JFN))
				;WIICH ARE EXPECTED IN NEXT RECORD (SPANNED)
NR (TPSBYT,MTAN)		;SAVES POINTER TO WHERE SCW/SCW SHOULD GO
				;WHEN RECORD IS COMPLETE, ALSO TPSCUP
   >				;END IFG MTAN
IFE MTAN,<
MTCLVA::			;DUMMY FOR MTA CLEAR ALL VALID VOLUME BITS
MTCLVL::			;DUMMY FOR SINGLE CLEAR VALID VOLUME
MTAKFK::RET			;DUMMY FOR KILL PSI 
   >				;END IFE MTAN
RS(MTAJB0,1)			;JOB 0 FLAG FOR MTA UNIT CAME ON LINE
   IFG PLTN,<

;PLOTTER STORAGE

PLTBFZ==:401			; Size of plt buffer
RS(PLTBF1,PLTBFZ*PLTN)		; First buffer
RS(PLTBF2,PLTBFZ*PLTN)		; Second buffer
RS(PLTSTS,PLTN)		; Status word
RS(PLTLCK,PLTN)		; Plt open lock
RS(PLTCNT,PLTN)		; Count of full buffers
RS(PLTITC,PLTN)		; Count of items remaining in current buffer
RS(PLTFDC,PLTN)		; SPECIAL FUNCTION TO BE DONE
RS(PLTPTR,PLTN)		; Byte bointer for emptying current buffer
RS(PLTPWR,PLTN)		;PLOTTER HAS REMOTE POWER INDICATE
   >				;END OF IFG PLTN
   IFG PTPN,<
PTPBFZ==:41			; Size of ptp buffer
RS(PTPBF1,PTPBFZ)		; First buffer
RS(PTPBF2,PTPBFZ)		; Second buffer
RS(PTPSTS)			; Status word
RS(PTPLCK)			; Ptp open lock
RS(PTPCNT)			; Count of full buffers
RS(PTPITC)			; Count of items remaining in current buffer
RS(PTPFDC)			; Count of lines of feed left to punch
RS(PTPPTR)			; Byte bointer for emptying current buffer
RS(PTPSIO)			; Saved ios during interrupt
   >				;END IFG PTPN

   IFG PTRN,<
PTRBFZ==:41			; Size of ptr buffers
RS(PTRBF1,PTRBFZ)		; First buffer
RS(PTRBF2,PTRBFZ)		; Second buffer
RS(PTRSTS)			; Status word
RS(PTRLCK)			; Ptr open lock
RS(PTRCNT)			; Count of full buffers
RS(PTRITC)			; Count of room left in filling buffer
RS(PTRCHC)			; Count of items inserted in buffer
RS(PTRPTR)			; Byte pointer for filling buffers
RS(PTRSIO)			; Saved ios during int
   >				;END IFG PTRN

   IFG VBCN,<
RS(PENLOC,4)			;X,Y COORDINATE OF LAST PEN HIT
PENADR==:PENLOC+1		;PROGRAM ADDRESS OF WHERE HIT OCCURED
ERRLOC==:PENLOC+2		;X,Y COORDINATE OF FIRST ERROR SEEN
ERRADR==:PENLOC+3		;ADDRESS OF WHERE ERROR OCCURED

RS(DISREL)			;8 BIT BOUNDRY OF FIRST LOCKED PAGE
RS(DISPRT)			;# OF 1K PIECES OF CORE LOCKED
RS(DISBEG)			;LH=PROTECTION AND RELOCATION FOR DISPLAY
				;RH=STARTING ADDRESS OF DISPLAY PROGRAM

RS(VBCIOS)			;STATUS WORD
   >				;END IFG VBCN
   IFG NETN,<

;SIZES OF NETWORK TABLES.

NDG NSQ,10			;NUMBER OF SPECIAL IMP QUEUES TO HANDLE
IMP8XS==:40			;SIZE OF IRREG MESSAGE BUFFER
NIMSTK==:20			;SIZE OF PI LEVEL STACK
NDG IMPNLK,^D199		;SIZE OF LINK TABLES
NDG NSKT,^D127			;MAX NUMBER OF SOCKETS DEFINED AT ONCE
NDG NHOSTS,^D251		;LENGTH OF HOSTN TABLE (MUST BE PRIME)
NDG NHSTN,1000			;LENGTH OF HOST NAME TABLE (TEXT)
IMPLBT==:10			;LENGTH OF OLD BIT TABLE
NHSTST==:200			;LENGTH OF OLD HOST STATUS TABLE

;STORAGE

;FIRST IMPGTN ARE A GETAB TABLE - DON'T SEPARATE

RS IMPRDY,1			;0=DOWN, .GTR. 0 =GOING DOWN, -1=UP
RS NETON,1			;0=NETWORK OFF
RS NETENT,1			;FLAGS TO DRIVE NETSER. E.G., DON'T ALLOW LOGIN
RS NCPUPT,1			;GTAD OF LAST TIME NCP CYCLED UP.
RS IGDMSG,1			;MOST RECENT IMP-GOING-DOWN MSG
RS IMPDNT,1			;TIME OF LAST IMP READY LINE DROP
RS IMPUPT,1			;TIME OF LAST IMP READY LINE UP
RS IGDTIM,1			;TIME OF ABOVE IMP-GOING-DOWN MSG
IMPGTN==:10			;LENGTH OF THIS GETAB TABLE
;END OF GETAB GROUP

RS LDR96B,1			;FLAG FOR 96 BIT LEADERS
RS IMPORD,1			;OUTPUT READY. NON-ZERO PERMITS OUTGOING MSGS
RS IMPRDL,1			;READY LINE NOTICED OFF
RS IMPRDT,1			;TODCLK WHEN READY LINE FIRST WENT OFF
RS IMPFLG,1			;SERVICE NEEDED BY ASYNC PROCESS
RS NCPFRK,1			;FORKX OF NCP FORK
RS TTNOF,1			;SCAN OF NET TTY LINES REQUESTED IF NON-0
RS IMPNOS,1			;OUTPUT SCAN REQUEST FLAG
RS IDVLCK,1			;LOCAL LOCK
RS IDVLLK,1			;LAST IDVLCK LOCKER
RS IMPOJB,1			;OLD JOBBIT OF CURRENT IDVLCK LOCKER
RS IMPDRQ,1			;RESET CYCLE REQUESTED IN NON-0
RS NETTCH,1			;STATE OF NET HAS CHANGED IF NON-0
RS IMPFRI,1			;LIST OF FREE INPUT BUFFERS
RS IMPNFI,1			;COUNT OF FREE INPUT BUFFERS
RS IMPNIB,1			;NUMBER OF INPUT BUFFERS TO KEEP ON TAP
RS SIQIBI,NSQ			;SPECIAL QUEUE
RS SIQIBO,NSQ
RS SIQTIM,NSQ			;TIME OF FIRST MESSAGE ON SPECIAL QUEUE
RS SIQSPC,NSQ			;SPACE OCCUPIED BY SPECIAL INPUT Q
RS SQJOB,NSQ			;JOB TO WHICH SPECIAL Q IS ASSIGNED
RS SQVAL1,NSQ			;VALUES FOR UP TO 3 WORDS OF LEADER
RS SQVAL2,NSQ
RS SQVAL3,NSQ
RS SQMSK1,NSQ			;MASKS FOR UP TO 3 WORDS OF LEADER
RS SQMSK2,NSQ
RS SQMSK3,NSQ
RS SQLCK,1			;INTERLOCK FOR ASSIGNING SPECIAL Q
RS IMPIBI,1			;IN BUFFERS IN PTR
RS IMPIBO,1			;IN BUFFERS OUT PTR
RS IMPOBI,1			;OUTPUT BUFFERS IN POINTER
RS IMPOBO,1			;OUTPUT BUFFERS OUT POINTER
RS IMPHBI,1			;HI PRIORITY OUTPUT BUFFERS IN POINTER
RS IMPHBO,1			;HI PRIORITY OUTPUT BUFFERS OUT POINTER
RS IMIB,1			;CURRENT IN BFR, PI LEVEL
RS IMPOB,1			;BUFFER NOW BEING EMPTIED BY PI ROUTINE
RS IMPINP,1			;BLKI POINTER ON INPUT
RS IMPOUP,1			;BLKO POINTER
RS IMOTYP,1			;PACKING TYPE FOR OUTPUT BUFFER
RS IMITYP,1			;PACKING TYPE FOR INPUT BUFFER
RS IIMBUF,3			;IMP IRREG MSG BUFFER, FOR OUTPUT SIDE
RS IMINFB,1			;BUFFERS MADE FREE BY PI ROUTINES
RS ANIVI1,4			;TWO WORDS FOR INPUT INTERRUPT XPCW
IMIDSP=:ANIVI1+3		;INPUT DISPATCH ADDRESS
RS ANOVI1,4			;AND TWO FOR OUTPUT
IMODSP=:ANOVI1+3		;OUTPUT DISPATCH ADDRESS
RS IMOIRD,1			;TEMP FOR IRREG MSG OUTPUT DATA
RS IMPIOV,1			;FLAG FOR INPUT BUFFER OVERFLOW
RS IMPNCL,1			;NUMBER OF CONTROL INPUT CONNS
RS IMPNOL,1			;NUMBER OF CONTROL OUTPUT CONNS
RS LNKNDL,1			;NUMBER OF DELETES IN LINK TABLE
RS IMIS32,1			;INPUT REPACKING STATE WORD
RS IMOS32,1			;OUTPUT REPACKING STATE WORD
RS IMPTIM,1			;TIME OF NEXT CLOCK RUN DOWN
RS IBPTIM,1			;TIME OF NEXT IMPIBP RUN
RS NETTIM,1			;TIME OF NEXT CHECK OF FSM FOR HANGS
RS RFNTIM,1			;TIME OF NEXT CHECK FOR LOST RFNM'S
RS NEGTIM,1			;NEGOTIATION TIME-OUT CLOCK
RS ITMSTM			;TIME TO FLUSH ALL TTMSG'S TO NVT'S
RS IMPCHU,1			;0 IF CURRENT CONTROL MESS HOST NOT UP
RS IMPCHO,1			;HOST NUMBER OF CONTROL MSG, MUST PRECEDE I8CAL
RS I8CAL,5			;ARGS OF CONTROL OPERATION, MUST FOLLOW IMPCHO
RS I8COP,1			;LAST CONTROL OP-CODE
RS IMPFLS,1			;COUNT (NEG) OF MESSAGES TO FLUSH
RS NOPCNT,1			;COUNT OF NOPS LEFT TO SEND
RS IMPGDM,1			;LAST IMP GOING DOWN MSG
RS HSTGDM,1			;CURRENT HOST GOING DOWN MESSAGE
RS IMPCCH,1			;INDEX TO HOST NUMBER FOR PERIODIC CHECK

RS IMP8XI,1			;IRREG MES BUFFER IN PTR
RS IMP8XO,1			;.. .. OUT
RS IMP8XC,1			;.. .. COUNT
RS IMP8XB,3*IMP8XS		;IRREG MES BUFFER

RS HSTSTS,NHOSTS		;DEAD HOST STATUS TABLE (18 BITS PER HOST)
RS IMPIAC,5			;PI LEVEL AC STORAGE
RS IMPICX,2			;CX AND P AT INTERRUPT LEVEL
RS IMSTK,NIMSTK			;PI LEVEL STACK
RS IMINP,1
;TIME ACCUMULATORS

RS IMCCLK,1			;RUN TIME OF LAST CHECK
RS IMCLST,1			;POINTER TO CURRENT CLOCK
RS IMCIDL,1			;TIME SPENT IDLING
RS IMCNRB,1			;TIME SPENT RELEASING SPENT BUFFERS
RS IMCGC,1			;TIME SPENT GARBAGE COLLECTING LINK TABLES
RS IMCGIB,1			;TIME SPENT ASSIGNING INPUT BUFFERS
RS IMCCNP,1			;TIME SPENT PROCESSING CONTROL MESSAGES
RS IMCP1,1			;TIME SPENT DISPATCHING INPUT MESSAGES
RS IMC8XM,1			;TIME SPENT PROCESSING IRREGULAR MESSAGES
RS IMCTS,1			;TIME SPENT SCANNING FOR NVT OUTPUT
RS IMCNVI,1			;TIME SPENT UNPACKING NVT INPUT
RS IMCOS,1			;TIME SPENT SCANNING FOR OUTPUT TO DO
RS IMCNCK,1			;TIME SPENT PROBING NETWORK
RS IMCRFN,1			;TIME SPENT CHECKING OVERDUE RFNM'S
RS IMCNCC,1			;TIME SPENT IN NCP CHECKS
RS IMNIDL,1			;COUNT OF IDLING
RS IMNNRB,1			;COUNT OF RELEASING SPENT BUFFERS
RS IMNGC,1			;COUNT OF GARBAGE COLLECTING LINK TABLES
RS IMNGIB,1			;COUNT OF ASSIGNING INPUT BUFFERS
RS IMNCNP,1			;COUNT OF PROCESSING CONTROL MESSAGES
RS IMNP1,1			;COUNT OF DISPATCHING INPUT MESSAGES
RS IMN8XM,1			;COUNT OF PROCESSING IRREGULAR MESSAGES
RS IMNTS,1			;COUNT OF SCANNING FOR NVT OUTPUT
RS IMNNVI,1			;COUNT OF UNPACKING NVT INPUT
RS IMNOS,1			;COUNT OF SCANNING FOR OUTPUT TO DO
RS IMNNCK,1			;COUNT OF PROBING NETWORK
RS IMNRFN,1			;COUNT OF CHECKING OVERDUE RFNM'S
RS IMNNCC,1			;COUNT OF NCP CHECKS

;LINK TABLES

RS IMPLT1,IMPNLK		;LH -- UNIT (INDEX TO NCP TABLES)
				; OR -1 IF CONTROL LINK
				;B18-19 00 RECIEVE
				;	10 SEND
				;	11 FREE
				;	01 DELETE
				;B28-35 -- LINK
RS IMPLT2,IMPNLK		;B0-9 -- FLAGS
				;B10-17 -- BYTE SIZE
				;RH -- IN BFR PTR
RS IMPLT3,IMPNLK		;LH -- OUT BFR PTR
				;RH -- SAVE MESSAGE FOR RETRANSMISSION
RS IMPLT4,IMPNLK		;LH -- CURRENT BUFFER
				;RH -- MSG ALLOCATION
RS IMPLT5,IMPNLK		;B4-11 -- NETWORK
				;B12-27 -- IMP
				;B28-35 -- HOST
;VARIABLES

DBGNBF==:100

RS(DBGFAC,1)			;FAILURE COUNTER
RS(DBGSP,1)			;STORE POINTER
RS(DBGRP,1)			;READ POINTER
RS(DBGNWD,1)			;NUMBER OF WORDS IN BUFFER
RS(DBGERR,1)			;REPORT NCP ERRORS
RS(DBGNCP,1)			;REPORT NCP TRAFFIC
NR(DBGBUF,DBGNBF)		;DEBUG BUFFER

RS(LSKT,NSKT)			;LOCAL SOCKET NUMBER
RS(FSKT,NSKT)			;FOREIGN SOCKET NUMBER
RS(NETHST,NSKT)			;-1 IF NO HOST
				;B4-11 -- NETWORK
				;B12-27 -- IMP
				;B28-35 -- HOST
RS(NETAWD,NSKT)			;B0-8 -- LINK NUMBER (0 IF NONE)
				;B18-23 -- TIME-OUT COUNTDOWN
				;B24-35 -- INDEX TO LINK TABLES
RS(NETBAL,NSKT)			;BITS OF ALLOCATION
RS(NETDAL,NSKT)			;DESIRED LEVEL OF BIT ALLOCATION
RS(NETBUF,NSKT)			;LH -- BYTES PER BUFFER
				;RH -- BUFFER LOCATION -1 (0 FOR NONE)
RS(NETSTS,NSKT)			;B0-3 -- FSM STATE
				;B4-11 -- FLAG BITS
				;B12-17 -- BIT STREAM BYTE SIZE
				;RH -- MESSAGE COUNT STATISTICS
RS(NETFRK,NSKT)			;B0-5 -- INTERRUPT CHANNEL FOR INS
				;B12-17 -- FSM STATE CHANGE INTERRUPT CHANNEL
				;RH -- FORKX OF FORK TO INTERRUPT
RS(NETBTC,NSKT)			;BIT COUNT STATISTICS
RS(NCPLCK)			;LOCK TO PREVENT DOFSM CONFUSION
RS(NCPLLK)			;FORKX OF LAST NCPLCK LOCKER
RS(NCPLCN)			;COUNT OF NCPLCK LOCKS
RS(NCPLFC)			;COUNT OF NCPLCK FAILURES
RS(ASNTBC)			;ASNTBF TRAFFIC COUNTER
RS(NETCNC)			;COUNT OF TOTAL CONECTIONS OPENED
RS(FUNNYC)			;COUNT OF FUNNY INPUTS TO FSM
   IFE SMFLG,<
NTBUFS==:400000			;START OF NETWORK BUFFER SECTION TO USE
   >
   IFN SMFLG,<
NRP(NTBUFS,NNTBFS)		;ARPAnet buffers for KS10
   >
RS(NETFRE,5)			;NET BUFFER FREE LIST HEADER
				;WD 0 IS BUFFER FREE LIST POINTER
				;WD 1 BUFFER LOCK
				;WD 2 TOTAL FREE BUFFER SPACE
				;WD 3 START OF BUFFER AREA
				;WD 4 END OF BUFFER AREA
RS(ASNTHR,1)			;THRESHOLD BELOW WHICH WE GET NERVOUS
				; ABOUT BUFFER SPACE
RS(HOSTNN,NHOSTS)		;HOST NUMBERS
NR(HOSTN,NHOSTS)		;TABLE OF HOST FLAGS,,POINTERS TO NAMES.
NR(HSTNAM,NHSTN)		;TEXT TABLE OF HOST NAMES
NR(MHOSTS,1)			;MINUS NUMBER OF HOSTS IN TABLE.

   > ; END OF IFG NETN

;DUMMY ROUTINES FOR NON-ARPANET SYSTEMS

   IFE NETN,<
GTBHRT::			;IMPHRT TABLE SIMULATION
GTBHSS::			;HSTSTS TABLE SIMULATION
GHOSTN::			;HOSTN TABLE SIMULATION
GNTAWD::			;NETAWD TABLE SIMULATION
STHSTJ::			;SET THE LOCAL HOST NUMBER
CHKNVT::			;IS TERMINAL AN NVT
NETKFK::			;FORK KILLING TIME
NETLGO::			;JOB LOGOUT TIME
IMPHLT::			;SYSTEM SHUTDOWN TIME (HSYS4)
IMPBEG::			;SYS STARTUP TIME, CREATE JOB 0 FORK
HSTINI::			;SYS STARTUP AND SMON. INIT HOST TABLES
CHKNET::			;WAIT FOR NET TO FINISH
NETINI::RET			;INITIALIZATION OF NCP FORK
NR (NETON)			;CELL USED BY SMON, RSO DEFINE IT.
NR (IMPDRQ)			;EVEN THOUGH NEVER USED BY SYSTEM
.GTNCP::
.GTHST::
.ASNSQ::
.CVSKT::
.SNDIM::
.RELSQ::
.FLHST::
.CVHST::
.ATNVT::
.RCVIM::ITERR ILINS2		;NETWORK ONLY JSYS'S

NTBFIX==:0			;NEWORK BUFFER SECTION PAGE TABLE

IMPGTN==:0			;NETWORK GETAB TABLES
IMPRDY==:0
IMPLBT==:0
NHSTST==:0
NHSTN==:0
HSTNAM==:0
NHOSTS==:0
HOSTN==:0
NSKT==:0
LSKT==:0
FSKT==:0
NETAWD==:0
NETBAL==:0
NETSTS==:0
NETBUF==:0
NETBTC==:0
NETHST==:0
NETFRK==:0
NETDAL==:0
IMPNLK==:0
IMPLT1==:0
IMPLT2==:0
IMPLT3==:0
IMPLT4==:0
IMPLT5==:0

   >;END OF IFE NETN
;STORAGE FOR RS04 SERVICE

IFG DRMN,<
  IFG RS04F,<

NTRK==:^D8			;NUMBER OF TRACKS ON RS04
DRMSEC==:^D64			;NO. OF DRUM SECTORS

;SWAP ALLOCATOR PARAMETERS

SWPSEC==:DRMSEC			;USE DISK PARAMETERS
NDST=<<NDST+SWPSEC-1>/SWPSEC>*SWPSEC
SWPTRK==:NDST/SWPSEC		;..
SWPNUN==:1			;..

   IFN PHYIOF,<
NDRMEW==:1
RS DRMCFE,1

MAXDRM==:^D8			;MAX NUMBER OF UNITS
				;CAN BE GREATER THAN 8
RS DRMNUM,1			;NUMBER OF DRUMS (COUNTED BY RS4INI)
RS DRMTAB,MAXDRM		;VIRTUAL TO PHYSICAL DRUM ADDRESSES
				;CDB,,UDB
   >;IFN PHYIOF

   IFE PHYIOF,<

MAXDRM==:^D8			;MAX NUMBER UNITS

NDRCCW==:10			;NUMBER OF DRUM CCWS
DRMCCL==:50			;TEMP UNTIL RH20 FIXED

NDRMEW==:5			;NUMBER OF DRUM ERROR WORDS FOR GETAB
RS DRMCFE,5			;DRM ERR BLOCK (NAME IS HISTORICAL) SEE DRMERP FOR DESCR
RS DRMEC,1			;ERROR COUNT, THIS XFER
RS DRMERR,1			;TOTAL NUMBER OF DRUM ERRORS
RS DRMNRE,1			;DRM NON REC ERRS

RS DRMNRQ,1			;NUMBER OF REQUESTS IN QUEUE OR IN PROGRESS

;PER CHANNEL DATA (WILL LIVE IN CCB EVENTUALLY)

RS RHPBAR,1			;CURRENT BAR - ALSO USED AS ACTIVE FLG
RS RHPTCR,1			;CURRENT TCR
RS RHPUCB,1			;UCB CORRESPONDING TO ABOVE
RS RHPCCW,1			;WILL POINT TO BEG OF PRI. CCW LIST

RS RHSBAR,1			;SBAR
RS RHSTRC,1			;STCR
RS RHSUCB,1			;UCB FOR ABOVE
RS RHSCCW,1			;WILL POINT TO BEG OF SEC CCW LIST

RS RHCNI,1			;CONI ON LAST INTERRUPT
;PER UNIT DATA - UCB OFFSETS

RHURI==:0			;READ Q INPUT PTR
RHURO==:RHURI+DRMSEC		;READ Q OUTPUT PTR
RHUWI==:RHURO+DRMSEC		;WRITE Q INPUT PTR
RHUWO==:RHUWI+DRMSEC		;WRITE Q OUTPUT PTR
RHUSEC==:RHUWO+DRMSEC		;NEXT AVAILABLE SECTOR ON UNIT
RHUERR==:RHUSEC+1		;ERR REG,,TOTAL ERR COUNT
RHUNRE==:RHUERR+1		;ERR REG,NON REC ERRS
RHUNRQ==:RHUNRE+1		;NUMBER OF REQUESTS TO THIS UNIT
RHUUNI==:RHUNRQ+1		;DRIVE NUMBER
RHUODT==:RHUUNI+1		;TIME WHEN UNIT REQUEST IS OVERDUE
RHUSTS==:RHUODT+1		;UNIT STATUS:
				; B0 - OFFLINE

UCBLEN==:RHUSTS+1

RS UCBDAT,UCBLEN*MAXDRM		;STORAGE AREA FOR UCBS
RS RH0UTB,MAXDRM		;LH INDEX BY PHYS UNIT #, RH INDEX BY LOG UNIT #

RS DRMACS,5			;AC0-4 DURING DRUM INTERRUPT
RS DRMACP,1			;AC P DURING INTERRUPT
RS DRMP12,2			;INTERRUPT ACS P1&P2
NDRMPD==:25			;PDL SIZE FOR DRM PD LISTS
RS DRMPDL,NDRMPD			;PDL FOR DRUM INTERRUPT SERVICE
RS DRMSPP,1			;SAVED P AT NON INT LEVEL
RS DRMPD1,NDRMPD		;PDL FOR NON PI LEVEL

RS RHXIOA		;IO ADDRESS OF MBC
RS RHXICO		;INITIAL CONO
RS RHXATN		;CONI ATTN BIT
RS RHXRAE		;REG ACCESS ERR IN CONI
RS RHXENB		;CONO ENABLE BITS NEEDED TO SEE ALL CONI BITS
RS RHXCRE		;MACHINE INSTR. NEEDED TO CLEAR RAE
RS RHXERR		;CONI ERROR BITS
RS RHXBAR		;LH OF BLOCK ADDR REG LOAD DATAO
RS RHXTCR		;LH OF TRANSFER CONTROL REG LOAD DATAO
RS RHXCIJ		;CHANNEL INITIAL JUMP
RS RHXCHL		;CHANNEL HALT
RS RHXCWC		;CHANNEL WORD COULD
RS RHXLIA		;DATAO TO LOAD INT VECOTR
   >;END IFE PHYIOF
  >;END IFG RS04F
   >				;END IFG DRMN
;STORAGE FOR RC10 DRIVER

   IFG DRMN,<IFG RC10F,<
NTRK==:^D90/2			;NUMBER OF TRACKS PER DRIVE
DRMSEC==:^D15			;NO. OF DRUM SECTORS
MAXDRM==:^D4			;MAX NUMBER UNITS

;SWAP ALLOCATOR PARAMETERS

SWPSEC==:DRMSEC			;USE DRUM PARAMETERS
NDST=<<NDST+SWPSEC-1>/SWPSEC>*SWPSEC
NDST=<<NDST+SWPSEC-1>/SWPSEC>*SWPSEC
SWPTRK==:NTRK			;..
SWPNUN==:MAXDRM			;..

DRMPST==:^D60			;NUMBER OF PHYSICAL SECTORS PER TRACK
DRMNWS==:^D64			;NUMBER OF WORDS PER DRUM SECTOR
DRMNSP==:PGSIZ/DRMNWS		;NUMBER OF DRUM SECTORS PER PAGE
RS DRMRI,DRMSEC*MAXDRM		;DRUM READ  QUEUE INPUT POINTER
RS DRMRO,DRMSEC*MAXDRM		;DRUM READ  QUEUE OUTPUT POINTER
RS DRMWI,DRMSEC*MAXDRM		;DRUM WRITE QUEUE INPUT POINTER
RS DRMWO,DRMSEC*MAXDRM		;DRUM WRITE QUEUE OUTPUT POINTER

RS DRMCCL,2			;COMMAND LIST FOR DF10
RS DRMEC,1			;ERROR COUNT, THIS XFER
RS DRMACT,1			;DRUM IS ACTIVE IF NON-0
RS DRMDAO,1			;LAST DATAO TO DRUM

NDRMEW==:4			;NUMBER OF DRUM ERROR WORDS FOR GETAB

RS DRMCFE,1			;COUNT OF CFM ERRORS
RS DRMLER,3			;LAST ERRONEOUS DRUM COMMAND AND ERROR BITS
   >>				;END IFG DRMN & RC10F
;STORAGE FOR DUMMY DRUM DRIVER

   IFE DRMN,<

DRMSEC==:0			;NO SECTORS...
NTRK==:0			;NO TRACKS...
MAXDRM==:0			;NO UNITS...

SWPSEC==:^D95			;USE DISK PARAMETERS
NDST=<<NDST+SWPSEC-1>/SWPSEC>*SWPSEC
SWPTRK==:NDST/SWPSEC		;..
SWPNUN==:1			;..

NDRMEW==:1			;NUMBER OF DRUM ERROR WORDS FOR GETAB

RS DRMCFE,1			;COUNT OF ERRORS

   IFN PHYIOF,<
RS DRMNUM,1			;PHONEY NUMBER OF DRUMS (0)
RS DRMTAB,1
   >;IFN PHYIOF

   >;IFE DRMN

;STORAGE FOR SWAP ALLOCATOR -- MUST FOLLOW ALL DRUM DRIVER DECLARATIONS

	NDG SWDST,NDST		;IF NOT ALREADY DEFINED, THIS IS DEFAULT
DRMMXB==:SWPNUN*SWPTRK		;MAX NUMBER OF BANDS POSSIBLE
DRMBSZ==:<SWPSEC+^D35>/^D36	;NUMBER OF BIT WORDS PER TRACK

;PARAMETERS FOR SWAPPING STRUCTURE

RS NPDRMS,1			;NUMBER OF PHYSICAL DRUMS, SET BY DRMIOI
RS MAXDRA,1			;NUMBER OF PAGES OF PHYSICAL DRUMS

;FOLLOWING VARIABLES ARE FOR "LOGICAL" DRUM, I.E. SWAPPING SPACE
;RESERVED ON DISK

RS DRMBND,1			;NUMBER OF DRUM TRACKS
RS MDRMBD,1			;MINUS DRMBND
RS DRMTPG,1			;TOTAL NUMBER OF PAGES ON DRUM

;STORAGE

RS DRMBBT,DRMMXB*DRMBSZ		;BIT TABLE - DRMMXB GROUPS OF DRMSEC BITS
RS DRMCNT,DRMMXB		;FREE PAGE COUNT FOR EACH TRACK
RS DRMBN0,1			;TRACK NUMBER OF LAST ADDRESS ASSIGNED
RS DRMFRE,1			;TOTAL FREE PAGE COUNT FOR DRUM
;STORAGE FOR SYSERR FACILITY

SEBBSZ==:1000			;BUFFER SIZE
RS SEBBFR,SEBBSZ		;BUFFER - PI LEVEL TO JOB 0
RS SEBFRE,1			;FREE PTR - BEG OF CONTIGUOUS BUFFER
RS SEBEFE,1			;END OF CONTIGUOUS FREE BUFFER
RS SEBQIN,1			;JOB 0 QUEUE - IN PTR
;SEBQOU IS IN A FIXED PLACE IN LOWER CORE
RS SEBFCT,1			;FREE COUNT - CONTIG BUFFER SPACE
RS SEBRLQ,1			;QUEUE OF RELEASED BLOCKS
RS SEBJFN,1			;JFN FOR SYSERR.LOG FILE
RS SECHKF,1			;FLAG TO WAKE JOB 0 SYSERR FORK
RS SEIETM,1			;TIME AFTER WHICH FAILING SEBOFI TRIED AGAIN

;STORAGE COMMON TO ALL DRUM DRIVERS

RS DRMJ0R,1			;JOB 0 INTERLOCK ON ERROR BLOCK
RS DST,NDST			;DRUM STATUS TABLE
;STORAGE IN THE SYMBOL TABLE PSECT
;IF HIDSYM IS ON, THIS STORAGE IS HIDDEN WITH THE SYMBOLS


IFN HIDSYM,<
ST SYMMAP,PGSIZ			;ALTERNATE MMAP
>;IFN HIDSYM


IFE HIDSYM,<
ST SYMMAP,0
>;IFE HIDSYM
;SWAPPER PAGES RESERVED IN PROCESSOR-PRIVATE AREA

DEFINE ASNPPG (P,N)<
	.PSECT PPVAR
P'A::	BLOCK N*PGSIZ
P==:P'A_-PGSFT
	.ENDPS PPVAR
...CNT==...CNT+N
>
...CNT==0


ASNPPG CSWPG,1			;SWAPPER TEMP
ASNPPG FITPG,1			;PRELOAD/POSTPG TEMP
ASNPPG PRLPG,1			;PRELOAD/POSTPURGE TEMP
ASNPPG PIPG,1			;FOR REAL-CORE REFS AT PI LEVEL

NRSPG==:...CNT
;STORAGE AND CODE BOUNDARIES

;JOB-COMMON AREA
DEFINE ASNJSB (P,N)<
P'A::	BLOCK N*PGSIZ
P=:P'A_-PGSFT
>
;JSB FREE PAGES

NDG NJSBPG,^D50		;NUMBER OF FREE JSB PAGES
	.PSECT JSVAR		;DECLARE ALL PAGES OWNED BY JSB


ASNJSB JSBPG,1			;JSB IS FIRST PAGE IN JOB-COMMON AREA
ASNJSB JFNPG,3			;3 PAGES FOR JFNS
ASNJSB JSJFN,0			;END OF THE JFN STORAGE AREA
ASNJSB JTBPG,2			;JSYS TRAP BLOCKS.  FIRST WORD USED BY
				; NEWJTB

JTBFRE=:JTBPGA			; Free JTB bit table (jffo)
JTBIFR==:777777,,770000		; initial contents of JTBFRE
JTBOFF==:JTBPGA+1		; address of 0th JTB

ASNJSB FREJP,NJSBPG		;JOB FREE STORAGE.  MUST BE LAST
				; DEFINITION IN JOB AREA
ASNJSB JSLST,0			;END OF JSB. MUST BE LAST.
	.ENDPS JSVAR		;END OF JSB OWNED PAGES
;JOB STORAGE BLOCK ASSIGNMENTS


;JSB STORAGE

DEFINE JS(T,N)<
	T=:JSBPGA+JSBLOC
	IFB <N>,<
	JSBLOC==JSBLOC+1>
	IFNB <N>,<
	JSBLOC==JSBLOC+N>
>

	.PSECT JSVAR
JSBLOC==0			;INITIAL VALUES

JS(JOBMAP,<<JSLSTA-JSBPGA>/PGSIZ>)	;OBJECT MAP FOR JOB-COMMON AREA
JOBM0=:JOBMAP-JSBPG		;BEG OF JOBMAP RELATIVE TO VIR PG 0

NUFKS==:30			;MAX NUMBER FORKS/JOB
JS SYSFK,NUFKS			;JOB FORK INDEX TO SYSTEM FORK INDEX
JS FKCTTY,NUFKS-<NUFKS/2>	; 1/2 word per fork
JS FKJTB,NUFKS			; Address of Jsys Trap Block
JS FKPTRS,NUFKS			;FORK POINTERS (STRUCTURE)
JS FKPSIE,NUFKS			;TERM INTERRUPT ENABLED WORD
JS FKDPSI,NUFKS			;DEFERRED TERM INTERRUPTS MASK
JS FREJFK,1			;FREE JOB FORK SLOT LIST
JS FKLOCK,1			;LOCK FOR FORK STRUCTURE MODIFICATION
JS FLKCNT,1			;NEST COUNT FOR FORK LOCK
JS FLKOWN,1			;FORK THAT LOCKED THE FORK LOCK
JS FKTIMW,1			;TIMER WORD FOR LOCK TIMEOUT
JS FKCNT,1			;COUNT OF ACTIVE FORKS IN THIS JOB
JS LSTLGN,1			; Last login D&T
JS SRTTIM,1			;DATE AND TIME THIS JOB WAS INITIALIZED
JS ARDFRT,1			; Job default for retrievals
JS CTRLTT,1			;LINE NUMBER OF CONTROLLING TTY
JS TTSPSI,1			;CODE ENABLED ANYWHERE IN THIS JOB
JS TTSDPS,1			;TERM INT CODE DEFERRED
JS TTJTIW,1			;TERMINAL INTERRUPT ENABLE MASK
JS (CONSTO,1)			;CONSOLE TIME ON (TODCLK UNITS)
JS (CTIMON,1)			;CONNECT TIME ON (GTAD UNITS)
JS (CONCON,1)			;CONSOLE CONNECT TIME (FOR USAGE)
JS (JBRUNT,1)			;JOB RUN TIME (FOR USAGE)
JS (JBNODE,1)			; NODE NAME (SIXBIT)
JS (JBBNAM,1)			; BATCH JOB NAME (SIXBIT)
JS (JBBSEQ,1)			; BATCH SEQUENCE NUMBER
JS (ACCTSL,1)			;LENGTH OF ACCTSR
JS (ACCTSR,MAXLW)		;ACCOUNT STRING
JS (ACCTSX,1)			;EXPIRATION DATE OF ACCTSR
JS (CSHACT,MAXLW)		;MOST RECENTLY VALIDATED ACCOUNT
JS (CSHUSR,1)			;USER FOR WHOM CACHED ACCOUNT WAS VALIDATED
JS (CSHACX,1)			;CSHACT EXPIRATION DATE
JS (CSHCLS,1)			;CLASS OF CACHED ACCOUNT
JS (LLSR,WPN)			;LOGICAL LOCATION (I DON'T UNDERSTAND WHY SOME OF THESE HAVE "+1")
JS (JSSRM,MAXLW+1)		;SESSION REMARK
JS (USRNAM,MAXLW+1)		;USER NAME STRING

JS(JFNLCK)			; Lock to prevent tampering with jfn's
JS(MAXJFN)
JS(ENQLST)			; LH - QUOTAS AND COUNTS
				; RH - POINTER TO Q-BLOCKS FOR THIS JOB
JS(TIMALC)			; TIMER clocks limit
JS(LNTABP)			; POINTER TO LOGICAL NAME TABLE
JS(LNMLCK)			; LOCK FOR LOGICAL NAME DATA BASE
JS(JOBUNT)			; CONNECTED DSK UNIT
JS JBCLCK,1			; LOCK FOR ASGPAG
JS(JBCOR,4)			; Page allocation bit table
JS(JSBFRE,7)			; Job area free storage header
JS(JSFREE,IJSFRE)		; Free storage area in job block

;STRUCTURE TABLES, 3 WORDS PER STRUCTURE.  DATA INCLUDES STRUCTURE NUMBER

JSSTMX==:4			;NO ENTRIES PER STRUCTURE
JS JSSTRT,JSSTMX*STRN		;3 WORDS PER STRUCTURE
JSSTRF==:0			;OFFSET FOR (FLAGS,,STRUCTURE UNIQUE CODE)
JSGRPS==:1			;OFFSET FOR (AOBJN POINTER TO LIST OF GROUPS)
JSADIR==:2			;OFFSET FOR (UNUSED,,ACCESSED DIRECTORY NUMBER)
JSFKMT==:3			;OFFSET FOR FORK-MOUNT BIT WORD
IFG NUFKS-44,<PRINTX ONLY ONE WORD HAS BEEN ALLOCATED FOR FORKS IN JSFKMT>
JS JSSTLK,1			;LOCK ON THE JSSTRT BLOCK

JS(JSBSDN)			; CONNECTED STRUCTURE UNIQUE CODE,,DIRECTORY #
JS(JSBCDS)			;POINTER TO CONNECTED DIR NAME STRING
JS(MODES)			; DDBMOD WORD FROM LOGIN
JS(GROUPS)			; GROUPS TO WHICH LOGIN USER BELONGS

JS RSCNPT,1			;RESCAN POINTER
JS RSCNBP,1			;POINTER TO RSCAN BUFFER
RSCMXC==:777			;MAX SIZE OF RSCAN BUFFER

JS JBINFO,1			;PID OF PRIVATE [SYSTEM]INFO FOR JOB
JS JSCDR,1			;SPOOLED CDR INFORMATION
				;LH = NEXT VERSION NUMBER - 1
				;RH = ADDRESS OF SPOOL SET STRING
JS JSMTA1,1			;DEFAULT DENSITY, MODE, AND RECORD SIZE
				; FOR MAGTAPES BEING USED BY THIS JOB
JS JBFLAG,1			;LH = FLAGS SENT TO SPOOLER ON CLOSE
				; OF SPOOLED FILE AND LOGOUT
				;RH = GENERAL JOB WIDE FLAGS (SEE PROLOG)
				;RH = GENERAL JOB WIDE FLAGS (SEE PROLOG)
JS JSLOPD,1			;PID TO GET LOGOUT MESSAGE, FROM CRJOB.
JS JSLOJB,1			;JOB NUMBER OF WHO DID LGOUT TO ME
JS JSFSTK,1			;STACK OF THINGS TO BE DONE ON
				; FORK CLEAN UP
JS JSFLCK,1			;THE LOCK FOR THE JSFSTK STRUCTURE
JS CRJFLG,1			;FLAG THAT THIS IS A CRJOB STARTUP.
				; USED BY MEXEC AND LOGIN
JS DCNCNT,1			;NETWORK LINK QUOTA,,COUNT
JS JSSRTM,1			;Runtime at start of this accounting session
JS JSSCTM,1			;Console time at start of this session
;**;[7456] At JSSCTM add 1 line				GAS	23-Apr-87
JS JSSCTI,1			;[7456] Universal date time at start of session
JS JSATCT,1			;ATS HTN QUOTA,,COUNT
JS JOBSKD,1			;SPECIAL JOB SCHEDULING PARAMETER
JS BATSTF,1			;BATCH STREAM NUMBER AND FLAGS WORD
;**;[7259]At BATSTF+0L add 1 line  JYCW  7-Mar-86
JS BATRID,1			;[7259]Batch request ID
;JFN BLOCK - EACH JFN USES BLOCK OF N WORDS, JFNS CAN GROW
;BEYOND END OF JSB INTO SUCCESSIVE PAGES.
; *** THIS MUST BE LAST STORAGE DEFINED IN JSB ***

;NAMES DEFINED WITH 0 OVERLAY THE NAME FOLLOWING.   POSSIBLE
;BECAUSE THEY ARE USED ONLY DURING GTJFN

;FIRST DEFINE JFN LIMITS AND SIZES

MLJFN==:23			; # OF WORDS PER JFN BLOCK
MJFN==:<<JSJFNA-JFNPGA+MLJFN-1>/MLJFN> ;MAX NUMBER OF JFNS
RJFN==:MJFN*MLJFN		;ACTUAL SPACE USED BY JFNS

JS(JFN0,0)			; FIRST JFN
JS(FILTMP,0)			; Lh -0 ptr to temp string block for default
				; Rh -0 point to temp string block
JS(FILBYT)			; Byte pointers to current window
JS(FILPRT,0)			; Pointer to protection string or protection #
JS(FILBYN)			; Byte number of current byte
JS(FILACT,1)			; Pointer to account string or account number
JS(FILLEN)			; Total length of file in bytes
JS(FILCNT)			; Bytes remaining in current buffer
JS(FILLCK)			; File lock word
JS(FILSKT,0)			;ARPANET CONNECTION NUMBER,,UNUSED
JS(FILOPT,0)			; Byte pointer to store string in gtjfn
JS(FILWND)			; Lh - current page number
				; Rh - location of current window
JS(FILSTS)			; Lh - file status bits
				; RH - STATUS, AND MODE IN BITS 32-35
JS(FILDEV)			; Device dependent  information
JS (FILATB,0)			; FOR ATS, POINTER TO DATA NOT IN JOB SPACE
JS (FILLLB,0)			; FOR DECNET, POINTER TO LL BLOCK
JS (FILMTP,0)			;FOR MT ,HOLD PROTECTION WORD
JS(FILOFN)			; Lh - ofn for this file
				; Rh - ofn of long file pt table
JS(FILLNM,0)			; RH - POINTER TO LOGICAL NAME CHAIN
				; LH - POINTER TO RDTXT BUFFER
JS(FILLFW)			; LH - COUNT OF PAGES MAPPED
				; Rh - location of page table table
JS(FILDDN)			; Lh - pointer to device string block
				; Rh - directory number
JS(FILDNM)			; LH - DIR NAME STRING
				; RH - POINTER TO ATTRIBUTE LIST (FILATL)
	PFXMSK==:777		;UP TO 512 POSSIBLE PREFIXES
	NOATRF==:1B18		;THIS ATTRIBUTE DOES NOT HAVE A VALUE
	.PFACT==:1		;ACCOUNT STRING ATTRIBUTE
	.PFPRT==:2		;PROTECTION ATTRIBUTE
	.PFCOP==:3		;SPOOLED FILE COPIES
	.PFFRM==:4		;SPOOLED FILE FORMS
	.PFALC==:5		;PREALLOCATE FILE SPACE
	.PFBLK==:6		;MAGTAPE BLOCK LENGTH
	.PFEXP==:7		;MAGTAPE EXPIRATION DATE
	.PFFMT==:10		;MAGTAPE RECORD FORMAT
	.PFPOS==:11		;MAGTAPE POSITION
	.PFRLN==:12		;MAGTAPE RECORD LENGTH
	.PFUDT==:13		;NETWORK USER I.D.
	.PFPWD==:14		;NETWORK ASCII PASSWORD
	.PFBPW==:15		;NETWORK BINARY PASSWORD
	.PFACN==:16		;NETWORK ACCOUNT STRING
	.PFOPT==:17		;NETWORK OPTDATA FIELD
	.PFBOP==:20		;NETWORK BINARY OPTDATA
	.PFACC==:21		;MAGTAPE ACCESS
	.PFEXP==:22		;MAGTAPE EXPIRATION DATE
	.PFOFL==:23		; OFFLINE file attribute

JS(FILNEN)			; Lh - pointer to file name string block
				; Rh - pointer to extension string block
JS(FILVER)			; Lh - fork number of originator of this jfn
				; Rh - version number
JS (FILBFO,0)			;FOR DECNET, OUPTU BUFFER POINTER
JS(FILMS1)			; LH- DIRECTORY WILD MASK
				; RH- NAME WILD MASK
JS(FILIDX,0)			; RH - INDEX INTO DEVICE TABLES FOR THE
				;	ORIGINAL DEVICE GTJFN'ED.  I.E.
				;	DOES NOT CHANGE DURING SPOOLING
JS (FILBFI,0)			;FOR DECNET, POINTER TO INPUT BUFFER
JS(FILMS2)			; LH- EXTENSION WILD MASK
JS (FILBCT,0)			;FOR DECNET, POINTER TO COUNTS
JS(FILFDB)			; ADDRESS OF THE FDB IN THE DIRECTORY
JS(FILCOD)			;C(LH) := STRUCTURE UNIQUE CODE
				;C(RH) := PT0 OFN FOR LONG FILE

	.ENDPS JSVAR
;PROCESS-PRIVATE AREA

DEFINE ASNPSB (P,N)<
P'A::	BLOCK N*PGSIZ
P=:P'A_-PGSFT
>

.PSECT PSVAR		;START OF PSB OWNED PAGES


ASNPSB PSSPS,0			;START OF PSB SPECIAL PAGES,MUST BE FIRST
ASNPSB CXBPG,1			;SWAPPER, MAP TEMP
ASNPSB CPTPG,1			; ..
ASNPSB CPYPG,1			; ..
ASNPSB PSSPE,0			;END OF PSB SPECIAL PAGES
ASNPSB FPG0,1			;FORK UTILITY PAGES
ASNPSB FPG1,1			; ..
ASNPSB FPG2,1			;FORK UTILITY PAGES
ASNPSB FPG3,1			; ..
	NPSIPG==:2		;# OF PAGES FOR PI STORAGE
ASNPSB PSIPG,NPSIPG		;PSI IN PROGRESS STORAGE
	NIDXPG==:^D16		;NUMBER OF PAGES FOR THE INDEX
IFE EXADF,<ASNPSB IDXPG,NIDXPG>	;INDEX TABLE IS MAPPED HERE
IFN EXADF,<ASNPSB IDXPG,0>
   IFE EXADF,<NDG DRMASZ,DRSMDA>	;NUMBER OF DIR PAGES
   IFN EXADF,<NDG DRMASZ,0>
ASNPSB DIRPG,DRMASZ		;DIRECTORY WINDOW
	NDDTPG==:2		;NUMBER OF PAGES FOR MDDT
ASNPSB DDTPG,NDDTPG		;MDDT PRIVATE SEGMENT

;FROM HERE TO THE END OF THE PSB ARE MAGIC PAGES. THEY NEED TO LIVE
;TOGETHER AT THE END.

ASNPSB UPTPG,1			;USER SECTION 0 PAGE TABLE
ASNPSB HWPT,0			;HARDWARE VARIABLES IN PSB
ASNPSB PSBPG,1			;PROCESS CONTEXT VARIABLES
ASNPSB PSB1,1			;PSB ADDITION (STACK AND WS), MUST BE LAST

PSBMSZ==:<<PSB1A-PSSPSA>_-PGSFT>+1 ;SIZE OF PSB (PAGES)

.ENDPS PSVAR		;END OF PSB OWNED PAGES
;MACROS FOR DECLARATION OF STORAGE

;PSB STORAGE

DEFINE TS(T,N)<
	T=:PSBPGA+TSBLOC
	IFB <N>,<
	TSBLOC==TSBLOC+1>
	IFNB <N>,<
	TSBLOC==TSBLOC+N>
>


;PROCESS STORAGE BLOCK ASSIGNMENTS

	.PSECT PSVAR
TSBLOC==0			;INITIAL VALUES

TS UACB,NUACB			;MONITOR-CALL AC STACK
TS EUACB,0			;END

TS JOBNO,1			;JOB NUMBER TO WHICH THIS FORK BELONGS
TS JOBBIT,1			;SCHEDULER CONTROL BITS
TS FNPMAX,1			;MAX NUMBER PAGES IN WS FOR THIS FORK
TS JOBCK0,1			;VARIABLES FOR SCHEDULER TIME QUARANTEE
TS JOBCK1,1			; ..
TS RUNT2,1			;RUNTIME FRACTIONAL PARTS OF A MILLISECOND

NLFKS==:NUFKS			;MAX NUMBER FORK HANDLES/PROCESS
TS FKTAB,NLFKS/2		;LOCAL FORK HANDLE TO JOB HANDLE TABLE

TS FORKN,1			;JOB FORK NUMBER OF TOP FORK,,THIS FORK
TS FKRT,1			;FORK RUN TIME

TS PRARGP,1			;POINTER TO PROCESS ARGUMENTS
TS MPP,1			;MONITOR SAVED STACK POINTER AT LAST MENTR
TS(PRIMRY,1)			; Primary io indirection pointers
TS SLOWF,1			;SLOW MON ROUTINE FLAG
TS INTDF,1			;DEFER INTERRUPTS IF .GE. 0
TS INTDFF,1			;SOS INTDF  OR JSYS PSISV1
TS MJRSTF,1			;JRSTF @FPC  OR  JRST PSISV0
TS ACBAS,1			;CURRENT AC STACK POINTER

TS ITFFL,1			;FLAGS ON INTERRUPT TO MEXEC ***MUST STAY WITH ITFPC
TS ITFPC,1			;PC ON INTERRUPT TO MEXEC
TS TRPID,1			;IDENT OF PT OR PAGE CAUSING TRAP
TS TRPPTR,1			;STORAGE ADDRESS OR POINTER CAUSING TRAP

TS UAC,20			;USER AC'S (FROM BLOCK 1)
TS PAC,20			;PROCESS AC'S
TS PFL,1			;PROCESS FLAGS ***MUST STAY WITH PPC
TS PPC,1			;PROCESS PC
TS NSKED,1			;NO-SCHEDULE WORD
TS RSKED,1			;NO-SCHEDULE TRAP

NTSK==:62			;SIZE OF PAGER TRAP STACK
TS TRAPSK,NTSK			;STACK USED DURING PAGER TRAPS
TS TRAPSW,1			;TRAP STATUS WORD
TS TRAPAP,1			;PAGE TRAP SAVED P
TS TRAPC,1			;PAGER TRAP RECURSION COUNT
TS UTRPCT,1			;COUNT OF PAGER TRAPS FOR THIS PROCESS
TS USWPCT,1			;COUNT OF SWPINW CALLS FOR THIS PROCESS
TS PTTIM,1			;TIME SPENT IN PAGER TRAPS
TS LSTXGR,1			;TIME (FKRT) OF LAST XGC
TS FKTLST,1			;LOST TIME WHILE CLOCK TURNED OFF
TS CRSKED,1			;IN CRITICAL SECTION IF NON-0
TS SKDFL,1			;SCHEDULER TEMP (RETURN FLAGS)
TS SKDPC,1			;SCHEDULER TEMP (RETURN) **MUST STAY WITH SKDFL
TS MONFL,1			;TEMP MONITOR PC AND FLAGS
TS MONPC,1			;MUST STAY TOGETHER ****
TS PSIPT,1			;PSI STORAGE LIST POINTER
TS PIOLDS,1			;FKSTAT PRIOR TO PSI IF WAS WAITING
TS LEVCHN,1			;LEVEL TABLE,,CHANNEL TABLE  ADDRESSES
TS PSISYS,1			;NON-0 IF PSI SYSTEM OFF
TS MONCHN,1			;CHANNELS RESERVED BY MONITOR

NPIPDL==:35			;SIZE OF PSI STACK
				;*** NOTE, THIS VALUE SHOULD BE
				;GREATER THAN THE VALUE NUFKS.
				;HOW MUCH GREATER IS VARIABLE, BUT
				;IT SHOULD BE AT LEAST 2 MORE.***
TS PIPDB,NPIPDL			;PSI ROUTINES STACK
TS PIAC,20			;SAVED USER AC'S DURING BREAK START
TS PSICHA,NTERMI/6		;CHANNEL ASSIGNED TO TERM CODE
TS PIMSK,1			;PSI REQUEST WORD BEING PASSED TO PSI SERVICE
TS PSIBW,1			;BREAK WAITING WORD
TS FORCTC,1			;CHANNEL WHICH CAUSED FORCED FORK TERMINATION
TS PSICHM,1			;CHANNEL ENABLED WORD
TS SUPCHN,1			;CHANNELS RESERVED BY SUPERIOR

   				;LEAVE ROOM FOR HARDWARE STORAGE

;WARNING: THESE VARIABLES MUST BEGIN AT OFFSET 420. THE CURRENT
;DEFINITIONS THAT PRECEDE THIS WARNING CREATE 420 WORDS. NO WORDS
;MAY BE ADDED WITHOUT MOVING AN EQUAL NUMBER BEYOND OFFSET 600

IFN TSBLOC-420,<PRINTX ?PSB STORAGE NOT ALIGNED TO HDWR BOUNDARY>

;CELLS IN USER PROCESS TABLE (UPT)

UPTPPM=:HWPTA+400		;PER-PROCESS MAP ORIGIN
NPPMPG==40			;NUMBER OF ENTRIES (2/WORD) IN PP MAP
UPTTPI=:HWPTA+420		;TRAP INSTRUCTIONS
KLLUUO=:HWPTA+420		;LUUO TRAP ADDRESS
UPTOVI=:HWPTA+421		;OVERFLOW TRAP INSTRUCTION
KIMUFL=:HWPTA+424		;MUUO FLAGS
KIMUPC=:HWPTA+425		;MUUO PC
KIMUEF=:HWPTA+426		;EFFECTIVE ADDRESS
KIMPCW=:HWPTA+427		;PROCESS CONTEXT WORD
UPTPCW=:HWPTA+427		;PROCESS CONTEXT WORD
UPTDSP=:HWPTA+430		;DISPATCH VECTOR-UUO NEW PC WORDS
USECTB=:HWPTA+540		;USER SECTION TABLE
UPTPFW=:HWPTA+500		;PAGE FAIL WORD
TRAPS0==:UPTPFW			;PAGE FAIL WORD USED DIRECTLY
UPTPFL=:HWPTA+501		;PAGE FAIL OLD FLAGS WORD
UPTPFO=:HWPTA+502		;PAGE FAIL OLD PC WORD
UPTPFN=:HWPTA+503		;PAGE FAIL NEW PC WORD

FFL==:KIMUFL			;MENTR-MRETN PC
FPC==:KIMUPC			;MENTR-MRETN PC

TRAPFL==:UPTPFL
TRAPPC==:UPTPFO
TSBLOC=600
TS PSIBIP,1			;BREAK IN PROGRESS WORD (LEVELS)
TS ENSKR,4			;SCHEDULER TEMP (RETURN)
TS ADRBRK,1			;ADDRESS BREAK INFO
TS ADRBK1,1			;ADDRESS OF INSTRUCTION CAUSING ADDR BREAK
TS MONBK,1			;INTERRUPT TO MONITOR IF NON-0
TS PIFL,1			;SAVED FLAGS MUST STAY WITH PIPC *****
TS PIPC,3			;SAVED PC DURING INITIAL PI SERVICE
				; CALLED WITH XPCW
TS FKTOFF,1			;TIME AT WHICH CPU CLOCK TURNED OFF
TS NWSCE,1			;NUMBER OF ENTRIES IN WS CACHE
TS LSTXGT,1			;TIME (TODCLK) OF LAST XGC
TS SYMPAG,1			;PAGE USED BY MDDT FOR MAPPING SYMBOLS
TS UTRSW,1			;SAVED TRAPSW FOR USER
TS UMUUOW,2			;SAVE MUUO WORD FOR USER
TS KIMUU1,2			;LAST UUO WORD FROM USER
TS PSLEVT,1			;ADDRESS OF USER'S LEVEL TABLE
TS PSCHNT,1			;ADDESS OF USER'S CHANNEL TABLE
TS PSBITS,1			;MISCELLANEOUS PER PROCESS BITS
TS TRPDSP,1			;DISPATCH FOR MON ILLEG MEM REF
; Variables in psb associated with DIRECTORIES

TS(DRLOC,1)			;LOCATION IN DIR DURING SEARCHES
TS(DRINP,1)			;POINTER TO INPUT NAME DURING LOOKUP
TS(DRINL,1)			;LENGTH OF INPUT STRING
TS(DRMSK,1)			;MASK OF 0 BITS IN LAST WORD OF STRING
TS(DRSCN,1)			;POINTER TO FDB LINK DURING LOOKUPS
TS(DROFN,1)			;RH = OFN OF LAST DIRECTORY MAPPED
				;LH = LAST FDB CHECKED
TS(DRMAP,1)			;ADDRESS OF MAP PAGE WHEN SEC2
TS (DIRCAD,1)			;CACHE ADDRESS OF LAST MAPDIR
TS(IDXMAP,1)			;ADDRESS OF IDX TABLE PAGE MAP WHEN EXTENDED ADDRESSING

TS(STRINF,1)			;FILE STRUCTURE INFORMATION
TS ENTVEC,1			;ENTRY VECTOR POINTER
TS PATADR,1			;10/50 COMPATABILITY ENTRY VECTOR
TS PATU40,1			;WHERE TO STORE C(40), SETUP AS UMOVEM 1,XX
TS PATUPC,1			;WHERE TO STORE PC, SETUP AS UMOVEM 1,YY

TS DMSADR,1			;DMS ENTRY VECTOR
TS DMSU40,1			;WHERE TO STORE C(40) ON DMS CALL
TS DMSUPC,1			;WHERE TO STORE PC OF DMS CALL

TS(CAPMSK,1)
TS(CAPENB,1)
TS(SNPPGS,1)			; PAGES LOCKED DOWN FOR SNOOPING
				; XWD  COUNT  ,,  PAGE # OF FIRST PAGE
TS(SNPLST,1)			; XWD FLAGS ,, LINK TO 1ST BP FOR FORK
TS(LSTERR,1)			; Last error number
NERRSV==:4			; NUMBER OF ERROR PARAMETERS
TS(ERRSAV,NERRSV)		; Block of error parameters

TS(PSBMAP,PSBMSZ)		;MAP FOR PROCESS AREA
PSBM0=:PSBMAP-PSSPS		;BEG OF PSBMAP RELATIVE TO VIRT P G 0
PPLOW==:<PSBMAP-PSBPGA>+<PSSPEA-PSSPSA>/PGSIZ ;LOWEST NON-SPECIAL PAGE IN PP AREA
PPHI==:<PPLOW+<UPTPGA-PSSPEA>/PGSIZ>-1	;HIGHEST NONSPECIAL PAGE

; STORAGE ASSOCIATED WITH JSYS TRAPS

TS JTBLK,1			; FKJTB+forkn for this fork
TS JTLCK,1			; Lock on jsys traps to monitor (this)
				; fork;  protects JTTRW and allows only
				; one jsys trap interrupt at a time to
				; this monitor
TS JTTRW,1			; Jsys Trap Trap Word
				; (set by interrupting fork)
				; Contains trapping instruction
TS JTTFK,1			; Forkn of trapping fork
TS JTMNW,1			; Jsys Traps Monitor fork Word
				;  B12-B17: monitor's PSI channel,
				; 	  77 means don't PSI this montior
				;  RH: forkn of mon interrupted (PSI'd)
TS PNSKDC,1			;NOSKED'S DONE BY DIAG AND OTHER
				; RESOURCE MONGERS
TS ARTHTR,1			;USER-SPECIFIED ARITHMETIC TRAP
TS CRTRGN,1			;FLAG TO INDICATE CODE NOW
				; IN CRITICAL REGION OF MONITOR.
				; INHIBITS REMOVAL FROM BALSET
TS STRWRD,1			;FLAGS,,# OF STRUCTURES MOUNTED BY FORK.
				; THIS NUMBER MAY NOT BE ACCURATE AS IT
				; IS NOT DECREMENTED WHEN A DRIVE IS
				; REMOVED FROM THE SYSTEM, AND THE FORK
				; HAS NOT DECREMENTED IT.  THE COUNT IS
				; USED AT KSELF TIME TO SEE IF IT IS
				; NECESSARY TO GO THRU EXTRA STRUCTURE
				; CODE.
TS FKXORA,1			;FORK IDXORA DURING CREATION OF STRUCTURE
IFG TSBLOC-1000,<
	PRINTX PSB STORAGE OVERFLOWS ONE PAGE>

TSBLOC=1000			;PUT WS CACHE AT START OF SECOND PAGE
WSCNCW==:200			;SIZE OF WS CACHE - MUST MATCH VALUES IN PAGEM
TS WSCSH,WSCNCW			;WORKING SET CACHE

NUPDL==:400			;[7151]SIZE OF MONITOR CALL STACK
UPDL=:PSBPGA+2*PGSIZ-NUPDL		;PUT UPDL AT TOP OF STACK PAGE
IFL <2*PGSIZ-NUPDL>,<PRINTX ?PSB VARIABLES AND STACK CONFLICT>
	.ENDPS PSVAR
;SWAPPABLE PATCH AREA:


	SWAPCD			;PUT SWPF IN SWAP MONITOR CODE

SWPF::	XLIST
	REPEAT 100,<0>
	LIST




;THE FOLLOWING MUST BE THE FIRST RESIDENT CODE LOADED

	RESCD

;**;[2868] Add 7L at RESCD	PED	15-NOV-82
;ASSEMBLE THE COPYRIGHT NOTICE SO THAT IT WILL BE SEEN IF
;ANYONE DUMPS THE EXE FILE OR MEMORY

DEFINE $ASCIZ (TEXT)<
	ASCIZ /TEXT/>

	CPYRYT ($ASCIZ)		;CALLS ITS ARG WITH NOTICE TEXT

;PATCH SPACE FOR RESIDENT CODE

FFF::
FFF1::
FFF2::	REPEAT 100,<
	XLIST
	0>
	LIST

;PARAMETER DEPENDENT DEVICE CODE

;DTE
	

DTSCNW::0			;HOLD CONO WORD FOR MASTER DTE
MSTRDT::0			;ID OF MASTER DTE
	IFG DTEN,<		;DTE STORAGE
PWRFLE::CALL DTEPWF		;TELL MASTER -11 OF POWER FAIL
PROFLG::1			;IF 0 DON'T GO INTO PRIMARY PROTOCOL
FEFLG::0			;USE 2ND PROTOCOL UNITL FURTHER NOTICE
FEDBSW::0			;FE DEBUG SWITCH
SVDTRJ::BLOCK 1			;DOES A JSR TO HERE
	JRST SVDTAC		;GO SAVE REGS AND SET UP STACK

QQ==0				;GENERATE INT VECTOR
DTETRP::REPEAT DTEN,<DTEINN \QQ	;DO ONE
		QQ==QQ+1>	;DO ALL DTE'
QQ==0				;NOW DO INTERRUPT CODE
REPEAT DTEN,<DTEPRO \QQ		;DO ONE
		QQ==QQ+1>	;AND DO ALL

QQ==0				;DEFINE PROTOTYPE HARDWARE INSTRUCTIONS
CNDO::	REPEAT DTEN,<CONO DTE0+QQ,
			QQ==QQ+4> ;DO ALL DTE'S
QQ==0
DATO::	REPEAT DTEN,<DATAO DTE0+QQ, ;THE DATAO TABLE
			QQ==QQ+4> ;DO ALL DTE'S
DTESTK::IOWD DTESZ,DTESKP	;DTE LOCAL STACK
	>
   IFE DTEN,<			;IF NO DTE
PWRFLE::JFCL			;NO SPECIAL POWER FAIL CODE
   >

	IFN SMFLG,<

;SM10

;THESE ARE CURRENTLY USED ONLY FOR TTY SERVICE FOR SINGLE/MULTI TTYS.
PROFLG::1			;PROTOCOL FLAG 0 DON'T ENTER PROMAIY PROTOCOL
FEFLG::0			;USE 2ND PROTOCOL UNTIL FURTHER NOTICE
	>

   IFE DCN,<			;IF NO DECNET SUPPORT
DEDMCB::
NSPSPC::
NSPQ::	BUG(NSPUDF)
NODINI::
NSPINI::RET			;NOTHING TO DO
.NODE::	JRST UJSYS0		;UNDEFINED IF NO DECNET SUPPORT
DCOPNM==:0			;DEFAULT OF 0 IF NO DECNET

;ROUTINE TO INITIALIZE NODE NAME TO NULL FOR NON-DECNET SYSTEM

NAMINI::SETZM OURNAM		;NO NODE NAME
	SETZM OURCNT		;NO CHARACTERS IN NAME
	RET
   >
   IFE MTAN,<			;IF NO MAGTAPES (YOU LUCKY DEVIL)
RELMT::RET>			;DUMMY ROUTINE

   IFE ATS,<			;IF NO APPLICATIONS TERMINAL SERVICE
ATSINI::HRLOI T1,377777		;SET ATS TIMER NOT TO GO REQUIRE WAKEUP
	MOVEM T1,ATSTYM
DOATSQ::RET			;FOR NSPTSK - DON'T DO ANYTHING
CKATSQ::			;FOR NSPTST - DON'T WAKEUP
CHKATS::RETSKP			;DUMMY CHKATS - INDICATES NOT AN ATS JFN
.SINM::	JRST UJSYS0		;UNDEFINED IF NO ATS SUPPORT
.SOUTM::JRST UJSYS0		;UNDEFINED IF NO ATS SUPPORT
>

;BUFFER ADDRESSES

LPTRLP::
	XX==0
   REPEAT LPTN,<
	-NLPBF,,LPTBUF+XX
	XX=XX+2*NLPBF>

;TTYSRV

IBFRC::	EXP <^D20>B7+<NTTBL>B11+<NTTBL>B15+<NTTBL*NCHBF-1>B25+<NTTBL*NCHBF-2>B35
IBFRC1:: EXP <^D100>B7+<NTTBL>B11+<NTTBL1>B15+<NTTBL*NCHBF-1>B25+<NTTBL1*NCHBF-2>B35
OVRBCT==:1			;NUMBER OF EXTRA BUFFERS FOR HIGH SPEED LINES
;GLOBAL CONTROL FLAGS

HNGU0F:: HNGU0			;HANGUP IF JOB NOT LOGGED IN
HNGU1F:: HNGU1			;HANGUP IF JOB LOGGED IN
;**;[7324] Add 2 lines at HNGU1F:+1L	MDR	17-JUN-86
TPRCYC:: .STDFE			;[7324] Tape recycle time (max offline exp.)
ARRCYC:: .STDAE			;[7324] Archive tape recycle time

DRUMP::	DRMN			;1 = SWAP ON DRUM, 0 = SWAP ON DSK,
				;-1 = DO NOT SWAP
NSWPGS::SWDST			;NUMBER OF SWAP PAGES TO ALLOCATE
PRELDF::0			;NO PRELOADING IF 0
SWRSAF::1			;REASSIGN SWAP ADDRESSES IF .G. 0
POSPGF::1			;POST PURGE IF .G. 0

SMLKF::	0			; .G 0 MEANS LOCK SWPMON IN CORE,
				; .E 0 MEANS DEMAND PAGE SWPMON
HIDSYF::HIDSYM			;HIDE SYMBOLS IF NON-ZERO
CTYLNO::0			;CTY LINE NUMBER (STORED IN TTINIT)
CTYTYP::TYPCTY			;LINE TYPE FOR CTY
KLILNO::0			;KLINIK LINE NUMBER
PSNAM::	'PS    '			;NAME OF THE PUBLIC STRUCTURE
LPSNAM::0				;LOGICAN NAME IF OTHER THAN PS

;DISK QUOTA ENFORCEMENT FLAG AND VALUE

NDG	USRSCF,-1		;INITIAL CONTENTS OF USRSPC (NON-0 TO PREVENT
				; WRITE OPENF IF USER OVER ALLOCATION)

USRSPC:: USRSCF			;TRUE = DON'T ALLOW WRITE OPEN IF USER EXCEEDS
				;DIRECTORY DISK ALLOCATION

SYSSPC:: SYSSCF			;DON'T ALLOW WRITE OPEN IF SYSTEM FREE PAGE
				;COUNT IS .L. C(SYSSPC)

RS APRSER,1			;APR SERIAL NUMBER
EXADFL::0			;EXTENDED ADDRESSING FLAG 1=MODEL B MACHINE
EXADF1::0			;MUUO/PAGE FAIL FLAG 1=MODEL B MACHINE
SMFLAG::SMFLG			;VALUE OF SMFLG (0=NON SM10 1=SM10)

EXADDR::0			;DIRECTORY FLAG 0=SEC 0 740000
				;+>= SEC 2 MAX SIZE 30 PGS
				;- = SEC 2 MAX SIZE 256. PGS

SYSTAD::0			;SYSTEM LOAD DATE/TIME
SWCEND::
IFE BUGSTF,<NRCODL>		;END OF SWAPPABLE MONITOR
IFN BUGSTF,<BGPTRL>		;END OF SWAPPABLE MONITOR+BUGSTRINGS+BUGPOINTERS

;POINTER TO BUGPOINTER TABLE

NBUGP==:BGPTRZ-BGPTR+1
BUGTP::	
IFE BUGSTF,<0>			;NO BUGPOINTERS IF BUGSTF=0
IFN BUGSTF,<-NBUGP,,BGPTR>	;-LEN,,ADDR OF BGPTR PSECT
;SYSTEM LOGICAL NAME INITIAL VALUES

	SWAPCD

SYNMTB::XWD [ASCIZ/SYS/],[ASCIZ/PS:<SUBSYS>/]
	XWD [ASCIZ/HLP/],[ASCIZ/SYS:/]
	XWD [ASCIZ/SYSTEM/],[ASCIZ/PS:<NEW-SYSTEM>,PS:<SYSTEM>/]
	XWD [ASCIZ/EDITOR/],[ASCIZ/SYS:EDIT.EXE/]

SYNMCT==:.-SYNMTB
;TERMINAL TYPE TABLES
; B0, B1, B2, B3, B4-7, B8-11, B12-15, B16-19
; FF,TAB, LC, --, CRPD, LFPAD, TABPAD, FF PAD

;NORMAL MODE IS LOWERCASE BIT ON, MOST DEVICES WILL PRINT LC CHAR
;AS UC.  FF AND TAB PADDING IS SPECIFIED FOR TTYS IN CASE
;FF OR TAB BIT TURNED ON MANUALLY

DEFINE TY(BB,CRPD,LFPD,TBPD,FFPD,WID,LEN)<
	^D<<BB>B2+<CRPD>B7+<LFPD>B11+<TBPD>B15+<FFPD>B19+<WID>B27+<LEN>B35>
>
	RESCD


TTYPE0::TY(0,0,0,2,12,72,66)	; 0 - MOD 33
	TY(6,0,0,2,12,72,66)	; 1 - MOD 35
	TY(1,0,0,2,12,72,66)	; 2 - MOD 37
	TY(1,10,0,0,0,80,66)	; 3 - TI
	0			; 4 - RESERVED FOR CUSTOMER
	0			; 5 -   "  "  "
	0			; 6 -   "  "  "
	0			; 7 -  "  "  "
	TY(1,6,6,2,12,72,66)	; 8 - DEFAULT: MAX PADDING, ETC.
	TY(7,0,0,0,0,0,0)	; 9 - 'IDEAL' TERMINAL, NO FILL INF SIZ
	TY(2,0,4,0,12,72,20)	; 10 - VT05
	TY(2,0,0,0,0,80,12)	; 11 - VT50
	TY(0,6,6,2,12,80,66)	; 12 - LA30
	TY(1,0,0,0,0,80,30)	; 13 - GT40 (WITH SMALL CHAR STRAPPING)
	TY(1,0,0,0,0,132,66)	; 14 - ;LA36. SAME AS VT50 BUT WIDER
	TY(3,0,0,0,0,80,24)	; 15 - VT52
	TY(3,0,0,0,0,80,24)	; 16 - VT100
	TY(3,0,0,0,0,132,66)	; 17 - LA38
	TY(7,0,0,0,0,132,66)	; 18 - LA120
;**;[2009] Add 4 lines at NTYPES==:-2L	PED	29-MAR-82
	REPEAT ^D16,<
	0	>		;[2009] TYPES 19-34 RESERVED FOR CUSTOMERS
	TY(3,0,0,0,0,80,24)	;[2009] 35 - VT125
;**;[6711] CHANGE 1 [2009] LINE FOR VK100
	TY(3,0,0,0,0,84,24)	;[2009][6711] 36 - VK100

NTTYPS==:.-TTYPE0
;SECOND PARALLEL TYPE INFORMATION TABLE

DEFSTR DSPTB,TTYPE1,35,18	;ADDRESS OF DISPLAY CONTROL TABLE

;BIT 0 OF TTYPE1 INDICATES WHETHER TERMINAL TYPE AUTOMATICALLY
;ENABLES XON AND XOFF PROCESSING.


DEFINE TY1(DPTAB)<
	DPTAB
>

TTYPE1::
   REPEAT ^D10,<		;TYPES 0-9 ARE NOT DISPLAYS
	TY1(0)
>
	TY1(VT05TB)		; 10 - VT05
	TY1(VT50TB)		; 11 - VT50
	TY1(0)			; 12 - LA30
	TY1(0)			; 13 - GT40
	TY1(0)			; 14- LA36
	TY1 (VT52TB)		; VT52
	TY1 (VT100T)		; VT100
	TY1 (0)			; 17 - LA38
	TY1 (0)			; 18 - LA120
;**;[2009] Add 4 lines at TTYPE1:+11.L	PED	29-MAR-82
	REPEAT ^D16,<
	TY1(0)
>				;[2009] 19-34 - ARE NOT DISPLAYs
	TY1(VT125T)		;[2009] 35 - VT125
	TY1(VK100T)		;[2009] 36 - VK100

IFN <.-TTYPE1>-NTTYPS,<PRINTX %%TERM TYPE TABLES OF DIFFERENT LENGTHS>
;CURSOR CONTROL TABLES.  TABLE FOR EACH TERMINAL TYPE, INDEXED 
;BY FUNCTION.

.STP==:377			;STOP CODE

;VT05 TABLE AND FUNCTION INDEX DEFINITIONS

VT05TB::
	PHASE 0
.CURUP::!Z [BYTE (8)32,0,0,0,0,.STP]
.CURDN::!Z [BYTE (8)13,0,0,0,0,.STP]
.CURBK::!BYTE (8).CHBSP,.STP
.CURFW::!BYTE (8)30,.STP
.CURHM::!Z [BYTE (8)35,0,0,0,0,.STP]
.CURES::!Z [BYTE (8)37,0,0,0,0,.STP]
.CUREL::!Z [BYTE (8)36,0,0,0,0,.STP]
	DEPHASE

;VT100 TABLE

;**;Add 2 lines at VT100T:+0L	PED	29-MAR-82
VT125T::				;[2009]
VK100T::				;[2009]
VT100T::
	BYTE (8).CHESC,"[","A",.STP	;UP
	BYTE(8).CHESC,"[","B",.STP	;DOWN
	BYTE(8).CHESC,"[","D",.STP	;BACK
	BYTE(8).CHESC,"[","C",.STP	;FORWARD
	BYTE(8).CHESC,"[","H",.STP	;HOME
	BYTE(8).CHESC,"[","J",.STP	;ERASE TO END OF SCREEN
	BYTE(8).CHESC,"[","K",.STP	;ERASE TO END OF LINE

;VT50 TABLE - USES ESCAPE SEQUENCES

VT52TB::
VT50TB::BYTE (8).CHESC,"A",.STP	;CURSOR UP
	Z [BYTE (8).CHLFD,0,0,0,0,.STP] ;CURSOR DOWN
	BYTE (8).CHBSP,.STP	;CURSOR BACK
	BYTE (8).CHESC,"C",.STP	;CURSOR FORWARD
	BYTE (8).CHESC,"H",.STP	;CURSOR HOME
	BYTE (8).CHESC,"J",.STP	;ERASE SCREEN
	BYTE (8).CHESC,"K",.STP	;ERASE LINE

	SWAPCD
;**;[2941] INSERT 2 LINES AT VT50TB:+11L	TAM	7-APR-83
COFMIN==:5			;[2941] MINUTES TO LEAVE A JOB DETACHED AFTER CARRIER OFF
COFTIM::^D60000*COFMIN		;[2941]
; NAME OF FILE INTO WHICH ACCOUNTING INFO IS WRITTEN

FCTFIL::ASCIZ /PS:<ACCOUNTS>FACT.BIN/
USGFIL::ASCIZ /PS:<ACCOUNTS>SYSTEM-DATA.BIN/
CKPFIL::ASCIZ /PS:<ACCOUNTS>CHECKPOINT.BIN.1/

;ACCOUNTING SYSTEM DATA-BASE

NR USGJFN,1			;JFN OF USGFIL
NR USGEOF,1			;END OF FILE FOR USAGE FILE
NR USGBEG,1			;HEAD OF QUEUE FOR JOB 0
NR USGEND,1			;TAIL OF QUEUE FOR JOB 0
NR USQCNT,1			;COUNT OF ITEMS ON USAGE QUEUE
NR CKPJFN,1			;JFN OF CKPFIL
NR CKPINV,1			;CHECKPOINT INTERVAL (SETTABLE)
NR CKPTIM,1			;CHECKPOINT TIMER CELL
NR CKPDTL,1			;DATE/TIME OF LAST CHECKPOINT
;**;[1942] Insert one line before USGLOK	RAS	15-SEP-81
NR USGMUP,1			;[1942] MONITOR UPTIME SINCE LAST RELOAD
RS USGLOK,1			;LOCK ON USAGE FILE
NR ASCTIM,1			;Next automatic accounting shift change time
				; relative to TODCLK
NR ASCPTR,1			;AOBJN pointer to accounting shift change times block
NR ASCFLG,1			;Flag -1 if accounting shift change, 0 if checkpoint
NR ASCLOK,1			;Lock on ASCPTR
	RESCD

;PHYSIO STORAGE

IFG PHYIOF,<

;TABLE OF KNOWN CHANNEL DISPATCH ROUTINES

PHYCHT::
	IFG RH20F,<	XWD .CTRH2,RH2DSP>
	IFG RH11F,<	XWD .CTRH2,RH2DSP>
PHYCHL==:PHYCHT-.		;NEGATIVE LENGTH OF TABLE

;TABLE OF KNOWN UNIT DISPATCH ROUTINES

PHYUNT::
	IFG RS04F,<	XWD .UTRS4,RS4DSP>
	IFG RP04F,<	XWD .UTRP4,RP4DSP>
	IFG TM02F,<	XWD .UTTM2,TM2DSP>
	IFG DX20F,<	XWD .UTDX2,DX2DSP>
PHYUNL==:PHYUNT-.		;NEGATIVE LENGTH OF TABLE

RS CHNTAB,CHNN		;TABLE FOR CDB POINTERS
RS MAXCHN		;HIGHEST NUMBERED CHANNEL IN USE
RS ZSEND		;CURRENT END OF PAGE ZERO STORAGE
RS PHYSEC		;PHYSIO MINUTE COUNTER

;RESIDENT STORAGE FOR DIAG

RS(DIAGLK)	;LOCK ON DIAG
RS(DIAGFK)	;TEMP PAGE,,FORK WHO HAS DIAG LOCK
RS DIAGAR,1			;AR/ARX INTERCEPT LOCATION

;UDSKIO STORAGE

RS UIOLST		;FREE LIST FOR UDSKIO IORBS
RS UDIORB,<NUIORB*UIOLEN> ;POOL FOR UDSKIO IORBS

;SAVE AREAS AND PDLS

RS PHYACS,20		;INTERRUPT SAVE ACS
RS PHYPDL,LPHYPD	;PRIVATE PDL FOR REQUESTS
RS PHYSVP		;CALLERS PDL
RS PHYIPD,LPHIPD	;INTERRUPT PDL


;STORAGE ASSOCIATED WITH THE HOME BLOCK CHECKING LOGIC

RS CHBUDB,1		;UDB BEING CHECKED
RS CHBODT,1		;OVERDUE TIME FOR CURRENT REQUEST
RS CHBLUC,1		;UDB OF LAST UNIT CHECKED - TO PREVENT LOCKOUT
RS CHBIRB,IRBLEN	;IORB
RS CHBCCL,2		;CHANNEL COMMAND LIST
RS CHBHB1,176		;BUFFER FOR FIRST PART OF HOME BLOCK
RS CHBHB2,2		;LAST 2 WORDS OF HOME BLOCK
   >			;END IFG PHYIOF
IFN RP04F,<
;RESIDENT TABLES OF SIZE DATA FOR DISKS BASED ON TYPE
;THE VALUES CONTAINED IN THESE TABLES ARE DEFINED EARLIER IN THIS
;MODULE.  DSKSIZ IS PARALLEL TO DSKUTP (DEFINED IN PHYSIO), WHICH CONTAINS
;CODES FOR THE KNOWN DISK TYPES.  WHEN AN ENTRY IS ADDED TO DSKUTP, A
;CORRESPONDING ENTRY MUST BE ADDED TO DSKSIZ TO POINT TO THE CORRECT
;SIZE DATA FOR THAT TYPE OF DISK.

;OFFSETS INTO DSKSIZ TABLES

SECPAG==:0			;SECTORS PER PAGE
SECCYL==:1			;SECTORS PER CYLINDER
PAGCYL==:2			;PAGES PER CYLINDER
CYLUNT==:3			;CYLINDERS PER UNIT
SECUNT==:4			;SECTORS PER UNIT
BTWCYL==:5			;BIT WORDS IN BIT TABLE PER CYLINDER
MINFPG==:6			;MINIMUM FREE PAGES FOR FREE CHOICE
MAXFPU==:7			;MAXIMUM FREE PAGES BEFORE TURNING POINT
LPPCYL==:10			;LOST SECTORS PER CYLINDER
SECSRF==:11			;SECTORS PER SURFACE
USSECU==:12			;MICROSECONDS PER LATOPT SECTOR UNIT

;RP04 AND RP05

DSKSZ0::SECPG0			;SECTORS PER PAGE
	SECCY0			;SECTORS PER CYLINDER
	PAGCY0			;PAGES PER CYLINDER
	CYLUN0			;CYLINDERS PER UNIT
	SECUN0			;SECTORS PER UNIT
	BTWCY0			;BIT WORDS IN BIT TABLE PER CYLINDER
	MINFP0			;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
				; IN DSKASN
	MAXFP0			;MAX FREE BEFORE DSKASN TURNING POINT
	LPPCT0			;LOST SECTORS PER CYL
	SECSF0			;SECTORS/SURFACE
	USSCU0			;USEC/UNIT

;RP06

DSKSZ1::SECPG1			;SECTORS PER PAGE
	SECCY1			;SECTORS PER CYLINDER
	PAGCY1			;PAGES PER CYLINDER
	CYLUN1			;CYLINDERS PER UNIT
	SECUN1			;SECTORS PER UNIT
	BTWCY1			;BIT WORDS IN BIT TABLE PER CYLINDER
	MINFP1			;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
				; IN DSKASN
	MAXFP1			;MAX FREE BEFORE DSKASN TURNING POINT
	LPPCT1			;LOST SECTORS PER CYL
	SECSF1			;SECTORS/SURFACE
	USSCU1			;MICROSECONDS PER UNITS

;RP07

DSKSZ2::SECPG2			;SECTORS PER PAGE
	SECCY2			;SECTORS PER CYLINDER
	PAGCY2			;PAGES PER CYLINDER
	CYLUN2			;CYLINDERS PER UNIT
	SECUN2			;SECTORS PER UNIT
	BTWCY2			;BIT WORDS IN BIT TABLE PER CYLINDER
	MINFP2			;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
	MAXFP2			;MAX FREE BEFORE DSKASN TURNING POINT
	LPPCT2			;LOST SECTORS PER CYL
	SECSF2			;SECTORS/SERFACE
	USSCU2			;MICROSECONDS PER UNITS

;RM03

DSKSZ3::SECPG3			;SECTORS PER PAGE
	SECCY3			;SECTORS PER CYLINDER
	PAGCY3			;PAGES PER CYLINDER
	CYLUN3			;CYLINDERS PER UNIT
	SECUN3			;SECTORS PER UNIT
	BTWCY3			;BIT WORDS IN BIT TABLE PER CYLINDER
	MINFP3			;MINIMUM FREE PAGES FOR FREE CHOICE ALLOCATION
	MAXFP3			;MAX FREE BEFORE DSKASN TURNING POINT
	LPPCT3			;LOST SECTORS PER CYL
	SECSF3			;SECTORS/SURFACE
	USSCU3			;USEC/UNIT
;THE POINTERS TO THE ABOVE TABLES ARE IN PHYSIO IN A TABLE CALLED
;DSKSIZ

>
;**;[1818] Remove 5 lines at DSKSZ3: +16L	JGZ	13-DEC-80
;BREAK POINT PAGE ASSIGNMENTS

	SNPBPS==:1000		;LEN OF BREAK POINT PAGE (MUST BE 1000)
NRP (SNPBPP,SNPBPS)		;BREAK POINT PAGE

;*** SNPDPC <= 36. SINCE SNPFTB BITTABLE IS 1 WORD
	SNPDPC==:^D12		;[2873] NUMBER OF PAGES FOR USER CODE
	SNPDPS==:1000*SNPDPC	;LENGTH OF SNOOP VIRTUAL AREA
NRP (SNPDAT,SNPDPS)		;DATA PAGES FOR USER CODE

;CAUTION:  SNPBPP AND SNPDAT MUST BE CONTIGUOUS FOR SCHED TEST. (CHKSNP)

;SNOOP BREAK POINT LABEL DEFINITIONS

REPEAT 0,<

BP$000	1 MILLISECOND INTERVAL
	RUNS AT APR INTERRUPT LEVEL WITH NO STACK SET UP.
	ALL ACS MUST BE SAVED AND RESTORED

BP$001	POWER LINE FREQUENCY INTERVAL (50 OR 60 CYCLES)
	RUNS AT APR INTERRUPT LEVEL WITH NO STACK SET UP.
	ALL ACS MUST BE SAVED AND RESTORED.

BP$002	1 SECOND INTERVAL
	RUNS AT APR INTERRUPT LEVEL WITH NO STACK SET UP.
	ALL ACS MUST BE SAVED AND RESTORED.

BP$003	BREAKPOINT FOR OPEN NEW FILE
	ASSUMPTIONS: JOB CONTEXT, STACK, OFN IN T1
	OFFSET FOR JOB'S JFN TABLE IN  11
	THESE ASSUMPTIONS HOLD FOR BP$003-BP$009

BP$004	BREAKPOINT FOR OPEN EXISTING FILE
	SEE ASSUMPTIONS FOR BP$003

BP$005	BREAKPOINT FOR  GET EXISTING PTT
	SEE ASSUMPTIONS FOR BP$003

BP$006	BREAKPOINT FOR  MAKE NEW PTT FOR LONG FILE
	SEE ASSUMPTIONS FOR BP$003

BP$007	BREAKPOINT FOR PT-0 OF LONG FILE
	SEE ASSUMPTIONS FOR BP$003

BP$008	BREAKPOINT FOR MAKE NEW PT IN LONG FILE
	ASSUMES PT-NUMBER IN -2(P); ALSO:
	SEE ASSUMPTIONS FOR BP$003

BP$009	BREAKPOINT FOR GET EXISTING PT IN LONG FILE
	ASSUMES PT-NUMBER IN 0(P); ALSO:
	SEE ASSUMPTIONS FOR BP$003

BP$010	(AT DASOFN) BREAKPOINT TO RELEASE OFN
	ASSUMES JOB CONTEXT, OFN IN T1, STACK

BP$011	(AT REMFP2) BREAKPOINT FOR DELETE PAGE IN CORE
	ASSUMES CST-INDEX IN T1

BP$012	(BELOW BKUP3) BREAKPOINT FOR WRITE TO DISC
	ASSUMES CST-INDEX IN T1

BP$013	(BELOW BKUP3) BREAKPOINT FOR WRITE TO RPLQ
	ASSUMES CST-INDEX IN T1

BP$014	(BELOW SWPO2) BREAKPOINT FOR WRITE TO DRUM
	ASSUMES CST-INDEX IN T1

BP$015	(BELOW BKUP0) BREAKPOINT FOR WRITE TO RPLQ (DRUM ADDR)
	ASSUMES CST-INDEX IN T1

BP$016	(AT SWPI5) BREAKPOINT FOR READ FROM DEVICE
	ASSUMES [STG-ADDR] IN T4, [IDENT] IN T1 (I.E., [SPTN,,PN])

BP$017	(BELOW TRP0C) BREAKPOINT FOR READ FROM RPLQ
	ASSUMES STACK.  WILL CALL GETPHA TO IDENTIFY PAGE

BP$018	(BELOW WCPY) BREAKPOINT FOR COPY-ON-WRITE
	ASSUMES TARGET [SPTN,,PN] IN T1, SOURCE CST-INDEX IN 0(P)

BP$019	(BELOW .CFORK) BREAKPOINT FOR CREATE SUB-FORK
	ASSUMES FORK-INDEX OF CREATED FORK IS IN 7

BP$020	(BELOW LOGI1) BREAKPOINT FOR CREATE MAIN FORK
	ASSUMES FORKX HAS FORK-INDEX, FKJOB(FORK-INDEX) HAS JOBNO

BP$021	(AT KSELF) BREAKPOINT FOR KILL FORK.
	ASSUMES FORKX HAS SUICIDAL FORK INDEX

BP$022	(AT MAPDI1-1 IN DIRECT) BREAKPOINT FOR ASOFN FOR DIRECTORIES
	ASSUMES DIRECTORY# IN T1, OFN IN DROFN USUALLY, BUT IN STRRDO
	IF T1=ROOTDN


>
;Define home block I/O page.  This page is used by fsiini and
;fsibat as a work page for home block I/O during system startup.

HOMPGA==:SNPDAT			;OVERLAY SNOOP DATA PAGES
HOMPG==:HOMPGA/1000		;DEFINE THE PAGE NUMBER AS WELL

;SCHEDULER TESTS - HERE BECAUSE NO OTHER RESIDENT CODE IN DIRECT

	EXTN <MLDTAB,NLDTAB>	;DEFINED IN DIRECT

LKDTST::HRRZ T1,Q3		;GET FORK INDEX
	IDIVI T1,^D36		;COMPUTE BIT ADDRESS
	MOVE T2,BITS(T2)
	TDNE T2,LCKDBT(T1)	;STILL WAITING?
	JRST 0(T4)		;YES
	JRST 1(T4)		;NO, WAKEUP

LKDSPT::MOVE T1,MLDTAB		;GET LIMIT OF TABLE
	CAIL T1,NLDTAB		;FULL?
	JRST 0(T4)		;YES
	JRST 1(T4)		;NO
;LOWER CORE DEFINITIONS - NOT CLEARED AT STARTUP

SCTLW==:20			;SCHEDULER HALT REQUEST WORD
;**;[2615] Add 3 lines at LKDSPT: +8L	JGZ	3-MAY-82

	LOC	25		;[2615] DOWN TO LOWER CORE
MMAPWD:	EXP MMAP		;[2615] POINTER TO MMAP FOR SETSPD

	LOC	70		;DOWN TO LOW CORE

PWRTRP::BLOCK 1			;EXECUTED ON POWER-FAIL AUTO RESTART
RLDADR::BLOCK 1			;FE EXECUTE'S THIS ON CERTAIN RELAODS
EDDTF::	IEDDTF			;RETAIN EDDT IF 1
CRSTAD::BLOCK 1			;TOD OF LAST CRASH
.JBDDT::DDTX			;JOBDDT
	BLOCK 1			;75 RESERVED - .JBHSO
DBUGSW::BLOCK 1			;BUGHLT ACTION SWITCH
DCHKSW::BLOCK 1			;BUGCHK ACTION SWITCH
	BLOCK 10		;100 THROUGH 107 RESERVED FOR
				;  FE COMMAND LANGUAGE FUNCTIONS

;CELLS NOT CHANGED DURING DISK RELOAD OF RES MON

STSBLK::BLOCK 1			;110-111: STATUS BLOCK POINTER
	BLOCK 1			;NEXT WORD TO HOLD PHYSICAL ADDRESS
.JBEDV::MONEDV			;112 - POINTER TO EXEC DATA VECTOR

;113-114 RESERVED FOR THE FUTURE.
;THESE TWO LOCATIONS ARE THE ONLY TWO IN LOW CORE STILL FREE IN
;BOTH THE TOPS-10 AND TOPS-20 MONITORS.  MAY BE NEEDED FOR EDDT
;ETC. IN THE FUTURE.

	RELOC			;BACK TO NORMAL

CRSTD1=:27			;CRASH TIME AND DATE SAVED WHILE RELOADING
BUGHAD=:26			;BUGHLT AND CHK ADDRESSES SAVED WHILE RELOADING
;**;[2615] Delete 1 line at BUGHAD=:26 +1L	JGZ	3-MAY-82
SEBQOU=:24			;OUTPUT PTR FOR SYSERR BLOCKS
				;IN A FIXED PLACE SO JOB 0 CAN QUEUE UP
				;BUGHLT BLOCK AFTER A CRASH.
CRSHTM=:23			;INITIAL TIME FOR RELOADS. -1 INDICATES NOT SETUP YET

NPISK==20			;SIZE OF STACK FOR PI LEVELS


;MONITOR'S EXEC DATA VECTOR

MONEDV::'EDV',,EDVLEN		;.EDCNT - COUNT OF WORDS FOLLOWING
HSYBLK::BLOCK 1			;.EDHSB - POINTER TO HSYSWP WHEN SYMBOLS HIDDEN
HSYPTR::BLOCK 1			;.EDSYM - .JBSYM IN SYMBOL SPACE
HUSPTR::BLOCK 1			;.EDUSY - .JBUSY IN SYMBOL SPACE
HSYFLP::EXP HSYFLG		;.EDHSF - POINTER TO SYMBOLS HIDDEN FLAG
EDVLEN==.-MONEDV


;AREA USED BY EDDT WHEN IT SWAPS ADDRESS SPACES

HSYSWP::EXP 5		;COUNT OF TOTAL WORDS FOLLOWING
	EXP 2		;COUNT OF WORDS TO SWAP (SECTIONS 0 AND 1)
	EXP MSECTB	;ADDRESS OF WHERE TO SWAP WORDS
	EXP SSECTB	;ADDRESS OF DATA TO PUT INTO MSECTB
	EXP OSECTB	;ADDRESS WHERE EDDT SAVES OLD MSECTB


;HIDDEN SYMBOLS FLAG - NON-ZERO IF MSECTB POINTS TO SYMBOLS

HSYFLG::BLOCK 1		;-1 IF SYMS HIDDEN NOW, 0 IF NOT (SET BY EDDT)
;ORIGIN OF MANUAL START TRANSFER VECTOR

SVECT=:140

;MANUAL START TRANSFER VECTOR

	LOC SVECT
EVDDT::	JRST DDTX		;EDDT
	JRST SYSDDT		;RESET AND GO TO EDDT
EVDDT2::JRST DDTX		;COPY OF EDDT IN CASE OTHER CLOBBERED
EVSLOD::JRST SYSLOD		;INITIALIZE DISK FILE SYSTEM
	Z 0			;UNUSED OFFSET
EVRST::	JRST SYSRST		;RESTART
EVLDGO::JRST SYSGO		;RELOAD AND START
EVGO::	JRST SYSGO1		;START

DDTPRS::-1			;DDT PRESENT IF NON-0, INITIALLY IS PRESENT

;AUTOMATIC RELOAD AND SWPMON LOAD STORAGE

BUTRXB::0			;XB OF ROOT DIR ON SPECIFIED STR
BUTMUN::0			;MAX. UNIT ON SPECIFIED STR
BUTDRT:: BLOCK 8		;LOGICAL/ PHYSICAL MAPPING OF SPEC STR
BUTCMD:: BLOCK ^D15		;ASCIZ MONITOR FILE NAME
BUTPGS::0			;START,,END ADDRESSES OF VBOOT PAGES
BUTEPT::0			;ADDRESS OF VBOOT PAGE TABLE PAGE
BUTPHY::0			;# OF PAGES TO MAP,,# OF FIRST CORE PAGE
BUTVIR::0			;VIRTUAL ADDRESS OF FIRST PAGE TO MAP
BOOTFL::0			;0 - NORMAL BOOTSTRAP, +N - SPECIAL BOOT

TMPSMM==:500			;TEMP SWPMON MAP DURING RESTART

DINFSW::0			;INFORMATIONAL BUG SWITCH

   IFN PHYIOF,<
;PAGE ZERO FREE STORAGE POOL FOR PHYSIO

PHYPZS::BLOCK PZSSIZ
   >				;END IFN PHYIOF

	RELOC

;PTR TO END OF RES VARS

ZROEND::RSVARZ

;NAME TO SAVE THE MONITOR IMAGE AFTER POSTLD AS

MONSNM::
IFE NETN,<IFN SMFLG,<	ASCIZ /SMONITR.EXE/>>
IFE SMFLG,<IFN NETN,<	ASCIZ /AMONITR.EXE/>>
IFN SMFLG,<IFN NETN,<	ASCIZ /TMONITR.EXE/>>
IFE SMFLG!NETN,< ASCIZ /MONITR.EXE/>

DEFINE ECALL (DEV)<
   IFG DEV'N,<
	CALL DEV'CHK
RS DEV'TIM>>

;SCHEDULER DEVICE-DEPENDENT CALLS

LV8CHK::ECALL VBC
   IFG DCN,<CALL NSPCH7>	;DO DECNET MESSAGES
	RET

;TABLE OF CALLS FOR SECOND LEVEL CLOCKS

RS CLK2TM,0			;SYMBOL OF FIRST CLOCK CELL IN TABLE

CLK2CL::
	CALL WTCHK		;CHECK NON-SPECIAL WAITING FORKS
RS WTTIM,1
   IFE PHYIOF,<
	ECALL DSK		;DISK RE-QUEUE CHECK
	ECALL DRM		;DRUM TIMEOUT CHECK
   >				;END IFE PHYIOF
   IFN PHYIOF,<
	CALL PHYCHK		;PHYSIO TIMER ROUTINE
	RS PHYTIM
   >				;END IFN PHYIOF
	ECALL DTE		;DO POLLER
	ECALL KDP		;CHECK KDP (KMC11/DUP11)
	ECALL PTP		;PAPER TAPE PUNCH
IFG PLTN,<	ECALL PLT>	;PLOTTER
IFG PCDPN,<			;CARD PUNCH
	CALL CDPCHK
	RS CDPTIM
   >
	ECALL DTA		;DECTAPE
	CALL LPTCHK		;PHYSICAL LPT
	RS LPTTIM
	ECALL CDR		;THE CARD READER
	ECALL DLX		;DL10
   IFN NETN,<
	CALL IMPCHK		;ARPANET
	RS IMPTM2
   >
	CALL TIMSCM
	RS TMMLTM		; Millisecond TIMER Q (elapsed time)
	CALL TIMSCD
	RS TMDTTM		; D&T TIMER Q
	CALL TTYCHK		;CHECK CONTROLLER THINGS
	RS TTYTIM		;ALLOCATE TIMER WORD
N2CLKS==:.-CLK2CL
;DEVICE INITIALIZATION AFTER SWPMON LOADED

	SWAPCD

DEFINE INICLL (DEV)<
   IFG DEV'N,<
	CALL DEV'INI>>

INIDEV::
	INICLL MTA
   IFG LPTN,< IFG LPTN-FELPTN,<
	INICLL LPT
   >>
   IFG CDRN,< IFG CDRN-FECDRN,<
	INICLL CDR
   >>
IFG PLTN,<	INICLL PLT>
IFG PCDPN,<	INICLL CDP>		;CARD PUNCH
	INICLL PTP
	INICLL PTR
	INICLL DTA
	INICLL VBC
   IFN NETN,<
	CALL IMPINI		;init IMP interface
   >
	RET

;DEVICE DEPENDENT ROUTINES USED ON KFORK

DEVKFK::
	RET


;DEVICE INITIALIZATION FOR FRONT END DEVICES

INIDV1::
	INICLL FE
   IFG CDRN,<IFG FECDRN,<
	INICLL CDR
   >>
   IFG LPTN,<IFG FELPTN,<
	INICLL LPT
   >>
	RET
;GENERATE THE PROTOCOL DEVICE DISPATCH TABLE
	RESCD

   IFG DTEN,<			;ONLY IF A DTE EXISTS
DEFINE DTV (DEV)<
   IFG DEV'N,<
	DEV'DTV		;DISPACTH ADDRESS
   >
   IFE DEV'N,<
	0			;NO DISPATCH
   >>

MINDEV==:.FECTY			;FIRST KNOWN DEVICE

DTEDTV::
	BLOCK MINDEV		;RESERVE SPACE FOR UNKNOWN DEVICES
   REPEAT 4,<TTYDTV>		;THE CTY,DL11,DH11, AND DLS DEVICES
   IFG FELPTN,<			;FRONT END LPT'S?
	DTV LPT>		;YES
   IFE FELPTN,<			;BA10 LPT?
	0>			;YES
   IFG FECDRN,<
	DTV CDR>		;THE CDR
   IFE FECDRN,<			;IF NO CRD
	0>			;RESERVE SPACE ANYWAY
	0			;UNKNOWN
	DTV FE			;THE FE DEVICE

MAXDEV==:.-DTEDTV+MINDEV-1	;LAST KNOWN DEVICE
   >				;END OF PROTOCOL TRANSFER VECTOR LOGIC


NOHOST::-1			; Old format host number
NVTPTR::0			; -number of nvt's,,first nvt
NLHOST::-1			; All references to lhostn should be
				; to this cell, So it can be patched
				; if needed.
NETFLD::12B11			; Network number for ARPA (shifted)
	RESCD

;RESET ALL AND GO TO EDDT

SYSDDT:	XCT PIRST
	XCT IORST
	JRST EVDDT2

;RELOAD SYSTEM FROM DISK AND RESTART

SYSGO::

;START SYSTEM KEEP EXISTING SWPMON PAGES

SYSGOX::MOVE P,PI7P		;GET A STACK
	CALL SAVSMM		;SAVE PRESENT SWPMON MAP
	MOVEI T1,IRBOOT		;NOTE SPECIAL INTERNAL BOOT
	MOVEM T1,BOOTFL
	JRST SYSGO1
;START FROM SCRATCH AFTER LOADING

SYSGO1::TDZA 7,7		;INDICATE NORMAL STARTUP TO SAVE IN STARTF
SYSLOD::MOVX 7,MI%RFS		;INDICATE REFRESHING
	MOVE P,PI7P
	XCT PIRST		;RESET PI AND IO
	XCT IORST
	SETZM STSBLK		;NO STATUS BLOCK NOW


;IF HIDING SYMBOLS, BLT THE SYMBOLS UP OUT OF THE PPVAR AND RSCOD
;AREAS SO WE CAN CLEAR THE ZROCOR (RSVAR) AREA.

	SKIPN HIDSYF		;INTEND TO HIDE THE SYMBOLS?
	JRST SYSLD3		;NO, PROCEED
	HLLZ T2,.JBSYM		;COUNT OF SYMBOLS
	SKIPGE .JBUSY		;AN UNDEFINED TABLE?
	ADD T2,.JBUSY		;YES, BUMP COUNT
	HLRO T2,T2		;GET TOTAL LENGTH OF SYMBOL TABLE
	MOVN T2,T2		;FORM POSITIVE LENGTH
	SKIPL T3,.JBUSY		;GET START OF UNDEFINED TABLE
	MOVE T3,.JBSYM		;OR REGULAR TABLE IF  NO UNDEFINEDS
	ADD T3,T2		;THENCE TO LAST ADDRESS OF TABLE+1
	TLZ T3,-1		;NOW CLEAR FOR INDEXING
	MOVEI T4,SYVARZ+1+200	;FIRST WORD OF NEW HOME (200 WORDS FOR PATCHING)
	ADD T4,T2		;LAST ADDRESS + 1
SYSLD2:	SUBI T3,1		;DECREMENT TO PREVIOUS SOURCE ADDRESS
	SUBI T4,1		;AND PREVIOUS DESTINATION ADDRESS
	MOVE T1,0(T3)		 ;FETCH NEXT WORD OF TABLE (GOING BACKWARDS)
	MOVEM T1,0(T4)		;STORE IN NEW HOME
	SOJG T2,SYSLD2		;LOOP OVER ENTIRE TABLE
	SUBM T4,T3		;OFFSET TO SYMBOLS' NEW HOME
	ADDM T3,.JBSYM		;UPDATE .JBSYM
	SKIPE .JBUSY		;UNDEFINED PTR SET UP?
	ADDM T3,.JBUSY		;YES, FIX IT TOO
	MOVE T1,[SYVAR,,SYVAR+1] ;NOW CLEAR SYMBOL MAPS AND PATCH SPACE
	SETZM SYVAR		; ..
	BLT T1,-1(T4)		; ..

SYSLD3:	MOVE 1,[XWD ZROCOR,ZROCOR+1]
	SETZM ZROCOR		;CLEAR FIRST WORD
	BLT 1,@ZROEND		;CLEAR RESIDENT STORAGE AREA

	CALL MONEPT		;SET TO MONITOR'S EPT
	CALL PGRON		;TELL HARDWARE ABOUT IT


	; ..
;NOW FIND THE MASTER DTE

   IFE SMFLG,<
	MOVSI T1,-DTEN		;NUMBER TO POLL
	MOVE T2,[CONSO DTE0,DTEPRV] ;LOOK FOR PRIVILEGED BIT
	MOVE T3,[CONSO DTE0,DTEPI0+7] ;CHECK FOR PI ASSIGNED
	MOVE T4,[CONO DTE0,0]	; A CONO WORD
FDMST1:	XCT T3			;HAVE A PI ASSIGNMENT?
	JRST [	HRRI T4,DTEPI0+DTEPIE ;NO TRY TO TURN ON PI 0
		XCT T4		;DO IT
		XCT T3		;DID IT TURN ON?
		JRST FDMST0	;NO. NON-EX DEVICE
		TRZ T4,DTEPI0	;TURN IT OFF
		XCT T4
		JRST .+1]	;AND PROCEED
	XCT T2			;THIS IT?
	JRST [	MOVEI T2,0(T1)	;YES. GET DTE NUMBER
		MOVEM T2,MSTRDT	;SAVE DTE NUMBER
		LSH T1,^D26	;ADJUST DEVICE FIELD
		ADD T1,[CONO DTE0,0(T1)] ;FORM CONO WORD
		MOVEM T1,DTSCNW	;STORE IN THE PROTOTYPE WORD
		JRST SYSLD1]	;AND PROCEED
FDMST0:	ADD T2,[4B11]		;NEXT DTE
	ADD T3,[4B11]
	ADD T4,[4B11]		;ADJUST ALL I/O INSTRUCTIONS
	AOBJN T1,FDMST1		;LOOK AT NEXT
	HALT .			;THIS CAN'T HAPPEN!!!!!!!!!!!!

SYSLD1:
   IFN DTFLG,<			;DOING FE PROTOCOLS?
	PIOFF			;MAKE SURE MACHINE IS QUIET
	JSR BUGMON		;MAKE SURE IN PROPER PROTOCOL
   >
   > ;END IFE SMFLG
   IFN SMFLG,<

SYSLD1:
	MOVEI T1,1		;START WITH SECOND MAPPING REGISTER
				;FIRST ONE RESERVED FOR BOOT
	MOVEM T1,SMADNX
   > ;END IFN SMFLG
	SETZM CRSTD1
	MOVEM 7,STARTF
	MOVE 1,[BTB]		;GET ADDRESS OF BIT TABLE
	MOVEM 1,BTBORA		;SET UP BASE ADDRESS FOR REFERENCE ELSEWHERE
	SETOM BTBLCK		;INITIALIZE BIT TABLE LOCK
	SKIPE 1,CRSTAD		;HAVE SAVED PRE-CRASH INFO?
	MOVE 1,BUGHAD		;YES, RESTORE CELLS
	HRRZM 1,BUGHLT
	HLRZM 1,BUGCHK
	AOS INSKED
	MOVE 1,[JRST BUGH0]	;SETUP JSR DISPATCHES
	MOVEM 1,BUGHLT+1
	MOVE 1,[JRST BUGC0]
	MOVEM 1,BUGCHK+1
	MOVE 1,[JRST BUGI0]
	MOVEM 1,BUGINF+1
	CALL GAPRID		;READ APR SERIAL NUMBER
	MOVEM T1,APRSER
;**;[7406] Move 1 line from SYSLD1:+26L to SYSLD1:+24L	MDR	19-DEC-86
   IFE SMFLG,<			;[7406] If not KS, check for extended addressing
	APRID T1		;FIND TYPE OF MACHINE
	TRZ 1,737777		;CHECK FOR MODEL B MACHINE
	SKIPE [MSEC1]		;WANT TO TRY EXTENDED ADDRESSING SECTIONS?
	HRRZM 1,EXADFL		;YES, SET FLAG
	HRRZM 1,EXADF1		;AND SET PC FORMAT FLAG
   IFN EXADF,<			;IF INTENDING TO USE EXTENDED FEATURES
	TRNE T1,-1		;MUST HAVE EXTENDED MACHINE
	SKIPN [MSEC1]		;AND BE USING MULTIPLE SECTIONS
	BUG (NOXADR)
   >				;END OF IFN EXADF
   >
;**;[7406] Change 2 lines at SYSLD1:+38L	MDR	19-DEC-86
   IFN SMFLG,<
	SETOM EXADF1		;[7406] KS doesn't have extended addressing
	SETZM EXADFL		;[7406] Note it here for APRSRV
   >
	MOVEI 1,RLDHLT		;THE BUGHLT ADDRESS FOR A KEEP ALIVE RELOAD
	MOVEM 1,RLODPC+3	;SET UP XPCW PC'S
	SETOM BUGLCK		;INIT LOCK
	; ..
	CALL RESFPI		;INITIALIZE THE RESIDENT FREE POOL
	SETOM RESIFL		;MARK THAT WE ARE IN SYSTEM START UP
	CALL PAGRST		;INIT PAGER SIMULATION (FOR KI10)
	CALL PGRINI		;INIT DST, CST, ETC.
   IFN SMFLG,<
	CALL UNBINI		;INIT UNIBUS ADAPTER
   >
   IFN PHYIOF,<
	CALL PHYINI		;MUST INIT BEFORE PAGER (GRABS RES STG)
   >				;END IFN PHYIOF
   IFE PHYIOF,<
;	DRUM IS INITIALIZED AFTER CALLING FSIINI
	CALL DSKINI		 ;DISK
   >				;END IFE PHYIOF
	CALL TTINIT		 ;TELETYPE MODULE
	IFG DLXN,<CALL DLXINI> ;DL10 CONTROLER
	CALL SCDIN		;SCHEDULER
	CALL PIINIT		;PI MODULE - LAST INIT
	SETZM RESIFL		;END OF SYSTEM START UP (FOR RES FREE POOL)
	MOVS 1,CTYLNO		;GET CTY LINE NUMBER
	HRRI 1,JOBSRT		;START A NEW JOB LOCATION
	CALL SCDRQ7		;INITIATE FIRST JOB
	JRST SCHED0		;TO SCHEDULER
;ROUTINE TO RETURN THE LINE FREQUENCY OF THE POWER LINE
;RETURNS LINE FREQUENCY IN A. CLOBBERS ONLY A

LINFRQ::PUSH P,B		;SAVE AN AC
	MOVEI A,^D60		;ASSUME 60 HZ
	APRID B			;GET LINE FREQ INFO
	TRNE B,1B18		;60 HZ?
	MOVEI A,^D50		;NO. TELL HIM IT IS 50 HZ
	POP P,B			;RESTORE B
	RET			;RETURN VALUE IN A
;RESTART SYSTEM

DEFINE DEVRST (DEV)<
   IFG DEV'N,<CALL DEV'RST>>

SYSRST::MOVE P,PI7P
   IFG DTFLG,<			;DOING FE PROTOCOLS?
	PIOFF			;MAKE SURE ALL PI'S ARE OFF
	JSR BUGMON		;MAKE SURE IN PROPER PROTOCOL
   >
	XCT PIRST
	XCT IORST		;RESET PI AND IO
	SETOM SCDRN1
	PUSH P,PWRDWN		;SAVE POWER FAIL INDICATOR
	SETZM PWRDWN
	CALL PAGRST		;INIT PAGER SIMULATION
	CALL PGRRST
   IFN SMFLG,<
	CALL UNBRST		;RESTART UNIBUS ADAPTER
   >
	CALL TTRSET
   IFE PHYIOF,<
	DEVRST DRM
	DEVRST DSK
	DEVRST MTA
   >				;END IFE PHYIOF
   IFN PHYIOF,<
	CALL PHYRST
   >				;END IFN PHYIOF
	DEVRST LPT
   IFG KSCDRN,<
	DEVRST CDR
   >
	DEVRST DTA
	DEVRST PTR
IFG PCDPN,<	DEVRST CDP>		;CARD PUNCH
	DEVRST PTP
IFG PLTN,<	DEVRST PLT>
	DEVRST VBC
	DEVRST DLX
	PUSH P,INSKED
	MOVEI 1,1
	MOVEM 1,INSKED
	SETZM SKEDF1
	CALL PIINIT
	CALL SWPRST		;SWAPPER CLEANUP
   IFG DTFLG,<			;DOING FE DH CONFIGURATIONS?
	SKIPE PROFLG		;AND DOING PRIMARY PROTOCOL?
	CALL DTERST>		;YES. GO INIT THE PROTOCOL
	POP P,1
	EXCH 1,0(P)		;SAVE OLD INSKED, RESTORE OLD PWRDWN
	SKIPGE 1		;DOING POWER RESTART?
	CALL TTDALL		;YES DETACH ALL JOBS THEN
	POP P,1			;GET OLD INSKED
	JUMPN 1,SCHED0		;RESUME SCHED IF THERE AT CRASH
	CALL SETPPG		;REESTABLISH CONTEXT
	SETZM INSKED
	SETOM TRAPC
	MOVSI 1,(UMODF)		;CRASH PROCESS RUNNING AT CRASH
	MOVEM 1,FFL
	SETZM FPC
	SETOM SLOWF		;FAKE A USER CONTEXT SO RETURN CODE
				; WILL ALWAYS WIN
	JRST ITRAP
;DISPATCHES FOR PI CHANNELS 5-6.
;EACH ROUTINE CALLED WITH 'CALL'.
;ROUTINE SHOULD RETURN WITH 'RET' (CALLER +1) IF PI IS NOT FOR IT.
;ROUTINE SHOULD RETURN WITH 'UNBRK DEV' (JRST DEVCHR) AFTER HANDLING
;INTERRUPT.

DEFINE PICALL (DEV)<
   IFG DEV'N,<CALL DEV'SV>>

PISC5::	XWD PI5R,.+1
   IFN DTAN+PTRN+PCDPN,<		;GENERATE IF HELLIWELL IS ASSEMBLING OR CDP PRESENT
	DMOVEM T1,PI5AC		;SAVE TEMP ACS
	DMOVEM T3,PI5AC+2
	DMOVEM CX,PI5CX		;SAVE CX, P
	MOVE P,[IOWD NPISK,PI5STK]
	PICALL CDP		;CARD PUNCH
	PICALL DTA
	PICALL PTR
CDPCHR::
PTRCHR::
DTACHR::
	DMOVE T1,PI5AC		;RESTORE TEMPS
	DMOVE T3,PI5AC+2
	DMOVE CX,PI5CX		;RESTORE CX, P
	XJEN PI5R

RS PI5R,4
RS PI5AC,4
RS PI5CX,2
RS PI5STK,NPISK
>
   IFE DTAN+PTRN+PCDPN,<
	EXCH T1,PI5CNT		;SAVE AC AND GET COUNTER
	AOS T1			;BUMP COUNTER
	CAILE T1,^D10		;REACHED THRESHOLD YET?
	BUG (PI5ERR)		;YES, COMPLAIN
	EXCH T1,PI5CNT		;RESTORE AC AND COUNT
	CLSB	5		;CLEAR THE INTERRUPT ON 5
	XJEN	PI5R		;RESTORE INTERRUPTED PC
RS PI5R,4
>
PISC6::	XWD PI6R,.+1
   IFN SMFLG!<PLTN+VBCN+PTPN>,<		;GENERATE FOR KS10 AND/OR HELLIWELL
	DMOVEM T1,PI6AC		;SAVE TEMP ACS
	DMOVEM T3,PI6AC+2
	DMOVEM CX,PI6CX		;SAVE CX, P
	MOVE P,[IOWD NPISK,PI6STK]
   IFN SMFLG,<
	CALL DZCTIN		;CALL TERMINAL SERVICE
   >
	PICALL PLT
	PICALL VBC
	PICALL PTP
PLTCHR::
VBCCHR::
PTPCHR::
LPTCHR::
	DMOVE T1,PI6AC
	DMOVE T3,PI6AC+2
	DMOVE CX,PI6CX		;RESTORE ACS
	XJEN PI6R

RS PI6R,4
RS PI6AC,4
RS PI6CX,2
RS PI6STK,NPISK
   >;IFN SMFLG!<PLTN+VBCN+PTPN>

   IFE SMFLG!<PLTN+VBCN+PTPN>,<
	BUG (PI6ERR)
	CLSB	6		;CLEAR THE INTERRUPT ON 6
	XJEN	PI6R		;RESTORE INTERRUPTED PC
RS PI6R,4
   >;IFE SMFLG!<PLTN+VBCN+PTPN>
;DUMMY ROUTINES FOR DEVICES NOT PRESENT

   IFE DTAN,<			;IF NO DECTAPES

DTADTB::
DTAACK::
DTAMCK::
DTASTS::
	RET
   >

   IFE DRMN!PHYIOF,<

;DRUM DRIVER - DUMMY DRUM, USES DSK
	RESCD

;DRUM IO DRIVER

; AC1/ 18-35 CORE PAGE NUMBER (CST INDEX) OF PAGE
;      DWRBIT WRITE OPERATION IF 1, READ IF 0

DRMIO::	HLLZS CST3(1)		;SINGLE PAGE REQUEST, ZERO REST OF LIST
DRMIOM::SKIPG DRUMP		;DRUM ON SYSTEM?
	JRST DSKIOM		;NO, USE DISK
	BUG(DRUMP1)

DRMINI::SETOM DRMJ0R
	RET
   >				;END IFE DRMN!PHYIOF
		SUBTTL ATSSRV STORAGE

;POINTERS FOR BACKGROUND PROCESS QUEUES

NR ATBTR1			;HEAD OF TERMINAL BLOCK QUEUE
NR ATBTR2			;TAIL OF TERMINAL BLOCK QUEUE
NR ATBDD1			;HEAD OF DATA PIPE DATA QUEUE
NR ATBDD2			;TAIL OF DATA PIPE DATA QUEUE
NR ATBCD1			;HEAD OF CONTROL PIPE DATA QUEUE
NR ATBCD2			;TAIL OF CONTROL PIPE DATA QUEUE
NR ATBPI1			;HEAD OF PIPE BLOCK QUEUE
NR ATBPI2			;TAIL OF PIPE BLOCK QUEUE

RS ATBPFG			;FLAG TO WAKE UP BACKGROUND PROCESS
				; (-1 TO WAKE, 0 TO SLEEP)
NR NRBKGR			;NRM BACKROUND TASK NEEDS TO DISMS AND TRY AGAIN

NDG ATMAX,^D96			;MAXIMUM NUMBER OF HTN'S IN SYSTEM
NR HTNADR,ATMAX+1		;TABLE OF ADDRESSES OF TERMINAL DATA
				; INDEXED BY HTN (WORD 0 UNUSED)

;SYSTEM INPUT BIT MASK - ONE BIT PER HTN

AMDAT==:1			;FIRST WORD IN BLOCK THAT HAS VALID BITS
NATMSK==:<<ATMAX+^D36>/^D36>+AMDAT ;NUMBER WORDS OF FREE SPACE
	TNXEND
	END	EVGO